<h2>YAML Basics<aclass="headerlink"href="#yaml-basics"title="Permalink to this headline">¶</a></h2>
<p>For <cite>ansible</cite>, every YAML script must be a list at it’s root-most
element. Each item in the list is a dictionary. These dictionaries
represent all the options you can use to write a <cite>ansible</cite> script. In
addition, all YAML files (regardless of their association with
<cite>ansible</cite> or not) should start with <ttclass="docutils literal"><spanclass="pre">---</span></tt>.</p>
<p>In YAML a list can be represented in two ways. In one way all members
of a list are lines beginning at the same indentation level starting
with a <ttclass="docutils literal"><spanclass="pre">-</span></tt> character:</p>
<divclass="highlight-python"><pre>---
# A list of tasty fruits
- Apple
- Orange
- Strawberry
- Mango</pre>
</div>
<p>In the second way a list is represented as comma separated elements
surrounded by square brackets. Newlines are permitted between
elements:</p>
<divclass="highlight-python"><pre>---
# A list of tasty fruits
[apple, orange, banana, mango]</pre>
</div>
<p>A dictionary is represented in a simple <ttclass="docutils literal"><spanclass="pre">key:</span></tt> and <ttclass="docutils literal"><spanclass="pre">value</span></tt> form:</p>
<divclass="highlight-python"><pre>---
# An employee record
name: John Eckersberg
job: Developer
skill: Elite</pre>
</div>
<p>Like lists, dictionaries can be represented in an abbreviated form:</p>
<divclass="highlight-python"><pre>---
# An employee record
{name: John Eckersberg, job: Developer, skill: Elite}</pre>
</div>
<pid="truthiness">You can specify a boolean value (true/false) in several forms:</p>
<divclass="highlight-python"><pre>---
knows_oop: True
likes_emacs: TRUE
uses_cvs: false</pre>
</div>
<p>Finally, you can combine these data structures:</p>
<divclass="highlight-python"><pre>---
# An employee record
name: John Eckersberg
job: Developer
skill: Elite
employed: True
foods:
- Apple
- Orange
- Strawberry
- Mango
languages:
ruby: Elite
python: Elite
dotnet: Lame</pre>
</div>
<p>That’s all you really need to know about YAML to get started writing