This Blog is to share our knowledge and expertise on Linux System Administration and VMware Administration

Sunday, January 14, 2018

Basics of YAML - Ansible


YAML, like many other data serialization languages (such as JSON), has very few, basic concepts:

Associative arrays

A declaration is very similar to a variable in any other language, that is:
name: 'This is the name' 

To create a list, we will have to use '-':
- 'item1' 
- 'item2' 
- 'item3' 
YAML uses indentation to logically divide parents from children. So if we want to create associative arrays (also known as objects), we would just need to add an indentation:

  name: TheName 
  location: TheLocation 
Obviously, we can mix those together, that is:

  - name: Jhon
    number: +91123456
    country: India
  - name: Cena
    number: +44763520 
    country: UK 
Those are the basics of YAML. YAML can do much more, but for now this will be enough.

No comments:

Post a Comment