Wednesday, June 20, 2018

YAML Fundamentals


Notes
All Ansible playbooks are written in YAML.
YAML - is a data structure format.
The # precedes all comments.
All YAML files can optionally begin with “----”
All YAML files can optionally end with “…”

Concepts
List/Array use Dictionaries to define the items within them.
Invalid number of spaces will generate an error message.


Key Value Pair
YAML’s fundamental data handlings are “Key Value Pair.”
Key - a variable.
Value - the value of the variable.
Key Value Pair = Key + Pair.
Syntax:
Key:(space)Value
A space after the semicolon is required.


How to type an Array/List
The Dash ( - ) means that the Pair that follows it is a part of an Array/List.
Syntax:
    Key:
         - (space)Key
  
Use a List/Array when it is multiple types of items of the same type of object.
For multiple List/Arrays the order of the Keys must be identical to each other.


How to type a Dictionary/Map
Syntax:
    Key:
        Key:(space)Pair
        Key: Pair

Use Dictionaries to add specific details about a specific individual item.
For multiple Dictionaries the Keys can be defined in any order as long as the values to those Keys exactly match.


List/Array with nested Dictionary
Syntax:
    Key/List_Name:
        - Key/List_Item:
            Key/Attribute_Detail: Pair
            Key/Attribute_Detail: Pair

Start your List/Array with a Key which will serve as the “Name” of the List/Array followed by a semi colon. Individual List/Array entries will follow the List/Array syntax. To add Attributes or Details to an individual item of the list nest a Dictionary under the specific List/Array entry following the Dictionary syntax.


Additional Educational Resources
1. Official YAML documentation.
2. Official Ansible documentation.

4 comments:

  1. I needed to leave a little remark to help you and wish you a decent continuation. Wishing you the good luck for all your blogging endeavors. Hire a legit hacker online

    ReplyDelete
  2. Wow, such a nice blog it is. Kindly do share more that kind of blogs. This is really helpful. Visit Cyber Security Course

    ReplyDelete
  3. Hi
    I visited your blog you have shared amazing information, i really like the information provided by you, You have done a great work. I hope you will share some more information regarding Cyber Security. I appreciate your work.
    Thanks
    Have a Great Day

    ReplyDelete
  4. Nice blog, thank you for sharing the valuable information about Best Cybersecurity Services in the USA.

    ReplyDelete