Introduction to YAML


Ansible uses YAML syntax to represent Ansible playbooks. This chapter provides an overview of YAML. Ansible uses YAML because it is easier for humans to understand, read and write than other data formats such as XML and JSON.

All YAML files can be selected to start with "---" and end with "...

In this section, you will learn about the different representations of YAML data.

Key-value pair

YAML uses simple key-value pairs to represent data. The dictionary is represented by a key-value pair.

Note: Space is required between the and values.

Example: Student Records

    ---#Optional YAML startup syntax


Name: Steeve John

Role number: 17

Points: B

Sex: Male

... #Option YAML exit grammar

You can also use abbreviations to represent dictionaries.

You can also represent a list in YAML. All elements (members) of the list should be written on a new line with the same indentation beginning with "x-" (- and spaces). 

Relevant Blogs:

Ansible Terraform VS Cloudformation 

Ansible Playbook 


Linux Containers (LXC)

Recent Comments

No comments

Leave a Comment