[Ansible] – How to create and use variable dictionaries in the YAML files?

The key-value pairs can be passed indented in the file like the following example.

  name: valuename
  key: value
  secondkey: 2

Also, it is possible to put all in the same line like the following example.


NOTE: Add all values in the same line is not a good practice at all since it makes hard to read. 

For further information, check YAML Syntax in the Ansible documentation.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s