Rename 'yamlscripts' to 'yamlsyntax', add some extra crosslinking to make sure folks find the

interesting docs pages, some misc editing here and there.
pull/1256/head
Michael DeHaan 13 years ago
parent 02549869b1
commit d3fe5f617a

@ -6,7 +6,7 @@
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>YAML Format &mdash; Ansible v0.0.1 documentation</title> <title>YAML Syntax &mdash; Ansible v0.0.1 documentation</title>
<link rel="stylesheet" href="_static/default.css" type="text/css" /> <link rel="stylesheet" href="_static/default.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" /> <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/bootstrap.css" type="text/css" /> <link rel="stylesheet" href="_static/bootstrap.css" type="text/css" />
@ -115,7 +115,7 @@ s.parentNode.insertBefore(ga, s);
<li class="toctree-l1"><a class="reference internal" href="patterns.html">The Inventory File, Patterns, and Groups</a></li> <li class="toctree-l1"><a class="reference internal" href="patterns.html">The Inventory File, Patterns, and Groups</a></li>
<li class="toctree-l1"><a class="reference internal" href="examples.html">Command Line Examples</a></li> <li class="toctree-l1"><a class="reference internal" href="examples.html">Command Line Examples</a></li>
<li class="toctree-l1"><a class="reference internal" href="modules.html">Ansible Modules</a></li> <li class="toctree-l1"><a class="reference internal" href="modules.html">Ansible Modules</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="">YAML Format</a></li> <li class="toctree-l1 current"><a class="current reference internal" href="">YAML Syntax</a></li>
<li class="toctree-l1"><a class="reference internal" href="playbooks.html">Playbooks</a></li> <li class="toctree-l1"><a class="reference internal" href="playbooks.html">Playbooks</a></li>
<li class="toctree-l1"><a class="reference internal" href="api.html">Using the Python API</a></li> <li class="toctree-l1"><a class="reference internal" href="api.html">Using the Python API</a></li>
<li class="toctree-l1"><a class="reference internal" href="faq.html">Frequently Asked Questions</a></li> <li class="toctree-l1"><a class="reference internal" href="faq.html">Frequently Asked Questions</a></li>
@ -127,7 +127,7 @@ s.parentNode.insertBefore(ga, s);
<a href="#" <a href="#"
class="dropdown-toggle">Page</a> class="dropdown-toggle">Page</a>
<span class="localtoc"><ul> <span class="localtoc"><ul>
<li><a class="reference internal" href="#">YAML Format</a><ul> <li><a class="reference internal" href="#">YAML Syntax</a><ul>
<li><a class="reference internal" href="#yaml-basics">YAML Basics</a></li> <li><a class="reference internal" href="#yaml-basics">YAML Basics</a></li>
</ul> </ul>
</li> </li>
@ -168,21 +168,33 @@ alt="Fork me on GitHub"
alt="Fork me on GitHub"></a> alt="Fork me on GitHub"></a>
<div class="container"> <div class="container">
<div class="section" id="yaml-format"> <div class="section" id="yaml-syntax">
<h1>YAML Format<a class="headerlink" href="#yaml-format" title="Permalink to this headline"></a></h1> <h1>YAML Syntax<a class="headerlink" href="#yaml-syntax" title="Permalink to this headline"></a></h1>
<p>This page provides a basic overview of correct YAML syntax, which is how Ansible <p>This page provides a basic overview of correct YAML syntax, which is how Ansible
playbooks (our configuration management language) are expressed. playbooks (our configuration management language) are expressed.</p>
You may also wish to read playbook examples and will quickly pick this up from those.</p> <p>We use YAML because it is easier to read and write for humans than other common
data formats like XML or JSON. Further, there are libraries available for reading
and writing YAML in most programming languages.</p>
<p>You may also wish to read playbook examples at the same time to see how this
is used in practice.</p>
<div class="admonition-see-also admonition seealso">
<p class="first admonition-title">See also</p>
<dl class="last docutils">
<dt><a class="reference internal" href="playbooks.html"><em>Playbooks</em></a></dt>
<dd>See YAML examples in practice in playbooks</dd>
</dl>
</div>
<div class="section" id="yaml-basics"> <div class="section" id="yaml-basics">
<h2>YAML Basics<a class="headerlink" href="#yaml-basics" title="Permalink to this headline"></a></h2> <h2>YAML Basics<a class="headerlink" href="#yaml-basics" title="Permalink to this headline"></a></h2>
<p>For <cite>ansible</cite>, every YAML file must be a list at it&#8217;s root-most <p>For <cite>ansible</cite>, every YAML file starts with a list of things
element. Each item in the list is a dictionary. These dictionaries to do. Each item in the list is a list of key/value pairs, commonly
represent all the options you can use to write an <cite>ansible</cite> file. In called a &#8220;hash&#8221; or a &#8220;dictionary&#8221;. So, we need to know how
addition, all YAML files (regardless of their association with to write lists and dictionaries in YAML.</p>
<cite>ansible</cite> or not) should start with <tt class="docutils literal"><span class="pre">---</span></tt>.</p> <p>There&#8217;s another small quirk to YAML. All YAML files (regardless of their association with
<p>In YAML a list can be represented in two ways. In one way all members <cite>ansible</cite> or not) should start with <tt class="docutils literal"><span class="pre">---</span></tt>. This is just a YAML
of a list are lines beginning at the same indentation level starting format thing that means &#8220;this is the start of a document&#8221;.</p>
with a <tt class="docutils literal"><span class="pre">-</span></tt> character:</p> <p>All members of a list are lines beginning at the same indentation level starting
with a <tt class="docutils literal"><span class="pre">-</span></tt> (dash) character:</p>
<div class="highlight-python"><pre>--- <div class="highlight-python"><pre>---
# A list of tasty fruits # A list of tasty fruits
- Apple - Apple
@ -190,13 +202,6 @@ with a <tt class="docutils literal"><span class="pre">-</span></tt> character:</
- Strawberry - Strawberry
- Mango</pre> - Mango</pre>
</div> </div>
<p>In the second way a list is represented as comma separated elements
surrounded by square brackets. Newlines are permitted between
elements:</p>
<div class="highlight-python"><pre>---
# A list of tasty fruits
[apple, orange, banana, mango]</pre>
</div>
<p>A dictionary is represented in a simple <tt class="docutils literal"><span class="pre">key:</span></tt> and <tt class="docutils literal"><span class="pre">value</span></tt> form:</p> <p>A dictionary is represented in a simple <tt class="docutils literal"><span class="pre">key:</span></tt> and <tt class="docutils literal"><span class="pre">value</span></tt> form:</p>
<div class="highlight-python"><pre>--- <div class="highlight-python"><pre>---
# An employee record # An employee record
@ -204,18 +209,20 @@ name: John Eckersberg
job: Developer job: Developer
skill: Elite</pre> skill: Elite</pre>
</div> </div>
<p>Like lists, dictionaries can be represented in an abbreviated form:</p> <p>Dictionaries can also be represented in an abbreviated form if you really want to:</p>
<div class="highlight-python"><pre>--- <div class="highlight-python"><pre>---
# An employee record # An employee record
{name: John Eckersberg, job: Developer, skill: Elite}</pre> {name: John Eckersberg, job: Developer, skill: Elite}</pre>
</div> </div>
<p id="truthiness">You can specify a boolean value (true/false) in several forms:</p> <p id="truthiness">Ansible doesn&#8217;t really use these too much, but you can also specify a
boolean value (true/false) in several forms:</p>
<div class="highlight-python"><pre>--- <div class="highlight-python"><pre>---
knows_oop: True knows_oop: True
likes_emacs: TRUE likes_emacs: TRUE
uses_cvs: false</pre> uses_cvs: false</pre>
</div> </div>
<p>Finally, you can combine these data structures:</p> <p>Let&#8217;s combine what we learned so far in an arbitary YAML example. This really
has nothing to do with Ansible, but will give you a feel for the format:</p>
<div class="highlight-python"><pre>--- <div class="highlight-python"><pre>---
# An employee record # An employee record
name: John Eckersberg name: John Eckersberg
@ -237,8 +244,10 @@ languages:
<div class="admonition-see-also admonition seealso"> <div class="admonition-see-also admonition seealso">
<p class="first admonition-title">See also</p> <p class="first admonition-title">See also</p>
<dl class="last docutils"> <dl class="last docutils">
<dt><a class="reference internal" href="playbooks.html"><em>Playbooks</em></a></dt>
<dd>Learn what playbooks can do and how to write/run them.</dd>
<dt><a class="reference external" href="http://yamllint.com/">YAMLLint</a></dt> <dt><a class="reference external" href="http://yamllint.com/">YAMLLint</a></dt>
<dd>YAML Lint gets the lint out of your YAML</dd> <dd>YAML Lint (online) helps you debug YAML syntax if you are having problems</dd>
</dl> </dl>
</div> </div>
</div> </div>
@ -251,7 +260,7 @@ languages:
<p class="pull-right"><a href="#">Back to top</a></p> <p class="pull-right"><a href="#">Back to top</a></p>
<p> <p>
&copy; Copyright 2012 Michael DeHaan.<br/> &copy; Copyright 2012 Michael DeHaan.<br/>
Last updated on Mar 10, 2012.<br/> Last updated on Mar 11, 2012.<br/>
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.8.<br/> Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.8.<br/>
</p> </p>
</div> </div>

@ -115,7 +115,7 @@ s.parentNode.insertBefore(ga, s);
<li class="toctree-l1"><a class="reference internal" href="patterns.html">The Inventory File, Patterns, and Groups</a></li> <li class="toctree-l1"><a class="reference internal" href="patterns.html">The Inventory File, Patterns, and Groups</a></li>
<li class="toctree-l1"><a class="reference internal" href="examples.html">Command Line Examples</a></li> <li class="toctree-l1"><a class="reference internal" href="examples.html">Command Line Examples</a></li>
<li class="toctree-l1"><a class="reference internal" href="modules.html">Ansible Modules</a></li> <li class="toctree-l1"><a class="reference internal" href="modules.html">Ansible Modules</a></li>
<li class="toctree-l1"><a class="reference internal" href="YAMLScripts.html">YAML Format</a></li> <li class="toctree-l1"><a class="reference internal" href="YAMLSyntax.html">YAML Syntax</a></li>
<li class="toctree-l1"><a class="reference internal" href="playbooks.html">Playbooks</a></li> <li class="toctree-l1"><a class="reference internal" href="playbooks.html">Playbooks</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="">Using the Python API</a></li> <li class="toctree-l1 current"><a class="current reference internal" href="">Using the Python API</a></li>
<li class="toctree-l1"><a class="reference internal" href="faq.html">Frequently Asked Questions</a></li> <li class="toctree-l1"><a class="reference internal" href="faq.html">Frequently Asked Questions</a></li>
@ -244,7 +244,7 @@ command line tools <tt class="docutils literal"><span class="pre">ansible</span>
<p class="pull-right"><a href="#">Back to top</a></p> <p class="pull-right"><a href="#">Back to top</a></p>
<p> <p>
&copy; Copyright 2012 Michael DeHaan.<br/> &copy; Copyright 2012 Michael DeHaan.<br/>
Last updated on Mar 10, 2012.<br/> Last updated on Mar 11, 2012.<br/>
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.8.<br/> Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.8.<br/>
</p> </p>
</div> </div>

@ -115,7 +115,7 @@ s.parentNode.insertBefore(ga, s);
<li class="toctree-l1"><a class="reference internal" href="patterns.html">The Inventory File, Patterns, and Groups</a></li> <li class="toctree-l1"><a class="reference internal" href="patterns.html">The Inventory File, Patterns, and Groups</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="">Command Line Examples</a></li> <li class="toctree-l1 current"><a class="current reference internal" href="">Command Line Examples</a></li>
<li class="toctree-l1"><a class="reference internal" href="modules.html">Ansible Modules</a></li> <li class="toctree-l1"><a class="reference internal" href="modules.html">Ansible Modules</a></li>
<li class="toctree-l1"><a class="reference internal" href="YAMLScripts.html">YAML Format</a></li> <li class="toctree-l1"><a class="reference internal" href="YAMLSyntax.html">YAML Syntax</a></li>
<li class="toctree-l1"><a class="reference internal" href="playbooks.html">Playbooks</a></li> <li class="toctree-l1"><a class="reference internal" href="playbooks.html">Playbooks</a></li>
<li class="toctree-l1"><a class="reference internal" href="api.html">Using the Python API</a></li> <li class="toctree-l1"><a class="reference internal" href="api.html">Using the Python API</a></li>
<li class="toctree-l1"><a class="reference internal" href="faq.html">Frequently Asked Questions</a></li> <li class="toctree-l1"><a class="reference internal" href="faq.html">Frequently Asked Questions</a></li>
@ -289,7 +289,7 @@ the remote nodes will be killed.</p>
<p class="pull-right"><a href="#">Back to top</a></p> <p class="pull-right"><a href="#">Back to top</a></p>
<p> <p>
&copy; Copyright 2012 Michael DeHaan.<br/> &copy; Copyright 2012 Michael DeHaan.<br/>
Last updated on Mar 10, 2012.<br/> Last updated on Mar 11, 2012.<br/>
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.8.<br/> Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.8.<br/>
</p> </p>
</div> </div>

@ -115,7 +115,7 @@ s.parentNode.insertBefore(ga, s);
<li class="toctree-l1"><a class="reference internal" href="patterns.html">The Inventory File, Patterns, and Groups</a></li> <li class="toctree-l1"><a class="reference internal" href="patterns.html">The Inventory File, Patterns, and Groups</a></li>
<li class="toctree-l1"><a class="reference internal" href="examples.html">Command Line Examples</a></li> <li class="toctree-l1"><a class="reference internal" href="examples.html">Command Line Examples</a></li>
<li class="toctree-l1"><a class="reference internal" href="modules.html">Ansible Modules</a></li> <li class="toctree-l1"><a class="reference internal" href="modules.html">Ansible Modules</a></li>
<li class="toctree-l1"><a class="reference internal" href="YAMLScripts.html">YAML Format</a></li> <li class="toctree-l1"><a class="reference internal" href="YAMLSyntax.html">YAML Syntax</a></li>
<li class="toctree-l1"><a class="reference internal" href="playbooks.html">Playbooks</a></li> <li class="toctree-l1"><a class="reference internal" href="playbooks.html">Playbooks</a></li>
<li class="toctree-l1"><a class="reference internal" href="api.html">Using the Python API</a></li> <li class="toctree-l1"><a class="reference internal" href="api.html">Using the Python API</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="">Frequently Asked Questions</a></li> <li class="toctree-l1 current"><a class="current reference internal" href="">Frequently Asked Questions</a></li>
@ -326,6 +326,15 @@ without needing to install management packages on each node.</p>
<p>It also excels for writing distributed <p>It also excels for writing distributed
scripts and ad-hoc applications that need to gather data or perform arbitrary scripts and ad-hoc applications that need to gather data or perform arbitrary
tasks &#8211; whether for a QA sytem, build system, or anything you can think of.</p> tasks &#8211; whether for a QA sytem, build system, or anything you can think of.</p>
<div class="admonition-see-also admonition seealso">
<p class="first admonition-title">See also</p>
<dl class="last docutils">
<dt><a class="reference internal" href="examples.html"><em>Command Line Examples</em></a></dt>
<dd>Examples of basic commands</dd>
<dt><a class="reference internal" href="playbooks.html"><em>Playbooks</em></a></dt>
<dd>Learning ansible&#8217;s configuration management language</dd>
</dl>
</div>
</div> </div>
</div> </div>
</div> </div>
@ -337,7 +346,7 @@ tasks &#8211; whether for a QA sytem, build system, or anything you can think of
<p class="pull-right"><a href="#">Back to top</a></p> <p class="pull-right"><a href="#">Back to top</a></p>
<p> <p>
&copy; Copyright 2012 Michael DeHaan.<br/> &copy; Copyright 2012 Michael DeHaan.<br/>
Last updated on Mar 10, 2012.<br/> Last updated on Mar 11, 2012.<br/>
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.8.<br/> Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.8.<br/>
</p> </p>
</div> </div>

@ -113,7 +113,7 @@ s.parentNode.insertBefore(ga, s);
<li class="toctree-l1"><a class="reference internal" href="patterns.html">The Inventory File, Patterns, and Groups</a></li> <li class="toctree-l1"><a class="reference internal" href="patterns.html">The Inventory File, Patterns, and Groups</a></li>
<li class="toctree-l1"><a class="reference internal" href="examples.html">Command Line Examples</a></li> <li class="toctree-l1"><a class="reference internal" href="examples.html">Command Line Examples</a></li>
<li class="toctree-l1"><a class="reference internal" href="modules.html">Ansible Modules</a></li> <li class="toctree-l1"><a class="reference internal" href="modules.html">Ansible Modules</a></li>
<li class="toctree-l1"><a class="reference internal" href="YAMLScripts.html">YAML Format</a></li> <li class="toctree-l1"><a class="reference internal" href="YAMLSyntax.html">YAML Syntax</a></li>
<li class="toctree-l1"><a class="reference internal" href="playbooks.html">Playbooks</a></li> <li class="toctree-l1"><a class="reference internal" href="playbooks.html">Playbooks</a></li>
<li class="toctree-l1"><a class="reference internal" href="api.html">Using the Python API</a></li> <li class="toctree-l1"><a class="reference internal" href="api.html">Using the Python API</a></li>
<li class="toctree-l1"><a class="reference internal" href="faq.html">Frequently Asked Questions</a></li> <li class="toctree-l1"><a class="reference internal" href="faq.html">Frequently Asked Questions</a></li>
@ -173,7 +173,7 @@ alt="Fork me on GitHub"
<p class="pull-right"><a href="#">Back to top</a></p> <p class="pull-right"><a href="#">Back to top</a></p>
<p> <p>
&copy; Copyright 2012 Michael DeHaan.<br/> &copy; Copyright 2012 Michael DeHaan.<br/>
Last updated on Mar 10, 2012.<br/> Last updated on Mar 11, 2012.<br/>
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.8.<br/> Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.8.<br/>
</p> </p>
</div> </div>

@ -115,7 +115,7 @@ s.parentNode.insertBefore(ga, s);
<li class="toctree-l1"><a class="reference internal" href="patterns.html">The Inventory File, Patterns, and Groups</a></li> <li class="toctree-l1"><a class="reference internal" href="patterns.html">The Inventory File, Patterns, and Groups</a></li>
<li class="toctree-l1"><a class="reference internal" href="examples.html">Command Line Examples</a></li> <li class="toctree-l1"><a class="reference internal" href="examples.html">Command Line Examples</a></li>
<li class="toctree-l1"><a class="reference internal" href="modules.html">Ansible Modules</a></li> <li class="toctree-l1"><a class="reference internal" href="modules.html">Ansible Modules</a></li>
<li class="toctree-l1"><a class="reference internal" href="YAMLScripts.html">YAML Format</a></li> <li class="toctree-l1"><a class="reference internal" href="YAMLSyntax.html">YAML Syntax</a></li>
<li class="toctree-l1"><a class="reference internal" href="playbooks.html">Playbooks</a></li> <li class="toctree-l1"><a class="reference internal" href="playbooks.html">Playbooks</a></li>
<li class="toctree-l1"><a class="reference internal" href="api.html">Using the Python API</a></li> <li class="toctree-l1"><a class="reference internal" href="api.html">Using the Python API</a></li>
<li class="toctree-l1"><a class="reference internal" href="faq.html">Frequently Asked Questions</a></li> <li class="toctree-l1"><a class="reference internal" href="faq.html">Frequently Asked Questions</a></li>
@ -265,15 +265,17 @@ ssh-add ~/.ssh/id_rsa</pre>
<div class="highlight-python"><pre>ansible all /bin/echo hello</pre> <div class="highlight-python"><pre>ansible all /bin/echo hello</pre>
</div> </div>
<p>Congratulations. You&#8217;ve just contacted your nodes with Ansible. It&#8217;s <p>Congratulations. You&#8217;ve just contacted your nodes with Ansible. It&#8217;s
now time to read some of the more real-world examples, and explore now time to read some of the more real-world <a class="reference internal" href="examples.html"><em>Command Line Examples</em></a>, and explore
what you can do with different modules, as well as the Ansible what you can do with different modules, as well as the Ansible
playbooks language. Ansible is not just about running commands, but <a class="reference internal" href="playbooks.html"><em>Playbooks</em></a> language. Ansible is not just about running commands, but
you already have a working infrastructure!</p> you already have a working infrastructure!</p>
<div class="admonition-see-also admonition seealso"> <div class="admonition-see-also admonition seealso">
<p class="first admonition-title">See also</p> <p class="first admonition-title">See also</p>
<dl class="last docutils"> <dl class="last docutils">
<dt><a class="reference internal" href="patterns.html#inventoryformat"><em>Inventory</em></a></dt> <dt><a class="reference internal" href="examples.html"><em>Command Line Examples</em></a></dt>
<dd>Complete documentation on the inventory file format</dd> <dd>Examples of basic commands</dd>
<dt><a class="reference internal" href="playbooks.html"><em>Playbooks</em></a></dt>
<dd>Learning ansible&#8217;s configuration management language</dd>
</dl> </dl>
</div> </div>
</div> </div>
@ -286,7 +288,7 @@ you already have a working infrastructure!</p>
<p class="pull-right"><a href="#">Back to top</a></p> <p class="pull-right"><a href="#">Back to top</a></p>
<p> <p>
&copy; Copyright 2012 Michael DeHaan.<br/> &copy; Copyright 2012 Michael DeHaan.<br/>
Last updated on Mar 10, 2012.<br/> Last updated on Mar 11, 2012.<br/>
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.8.<br/> Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.8.<br/>
</p> </p>
</div> </div>

@ -1,3 +1,4 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
@ -113,7 +114,7 @@ s.parentNode.insertBefore(ga, s);
<li class="toctree-l1"><a class="reference internal" href="patterns.html">The Inventory File, Patterns, and Groups</a></li> <li class="toctree-l1"><a class="reference internal" href="patterns.html">The Inventory File, Patterns, and Groups</a></li>
<li class="toctree-l1"><a class="reference internal" href="examples.html">Command Line Examples</a></li> <li class="toctree-l1"><a class="reference internal" href="examples.html">Command Line Examples</a></li>
<li class="toctree-l1"><a class="reference internal" href="modules.html">Ansible Modules</a></li> <li class="toctree-l1"><a class="reference internal" href="modules.html">Ansible Modules</a></li>
<li class="toctree-l1"><a class="reference internal" href="YAMLScripts.html">YAML Format</a></li> <li class="toctree-l1"><a class="reference internal" href="YAMLSyntax.html">YAML Syntax</a></li>
<li class="toctree-l1"><a class="reference internal" href="playbooks.html">Playbooks</a></li> <li class="toctree-l1"><a class="reference internal" href="playbooks.html">Playbooks</a></li>
<li class="toctree-l1"><a class="reference internal" href="api.html">Using the Python API</a></li> <li class="toctree-l1"><a class="reference internal" href="api.html">Using the Python API</a></li>
<li class="toctree-l1"><a class="reference internal" href="faq.html">Frequently Asked Questions</a></li> <li class="toctree-l1"><a class="reference internal" href="faq.html">Frequently Asked Questions</a></li>
@ -271,8 +272,8 @@ you with questions about Ansible.</p>
<li class="toctree-l2"><a class="reference internal" href="modules.html#writing-your-own-modules">Writing your own modules</a></li> <li class="toctree-l2"><a class="reference internal" href="modules.html#writing-your-own-modules">Writing your own modules</a></li>
</ul> </ul>
</li> </li>
<li class="toctree-l1"><a class="reference internal" href="YAMLScripts.html">YAML Format</a><ul> <li class="toctree-l1"><a class="reference internal" href="YAMLSyntax.html">YAML Syntax</a><ul>
<li class="toctree-l2"><a class="reference internal" href="YAMLScripts.html#yaml-basics">YAML Basics</a></li> <li class="toctree-l2"><a class="reference internal" href="YAMLSyntax.html#yaml-basics">YAML Basics</a></li>
</ul> </ul>
</li> </li>
<li class="toctree-l1"><a class="reference internal" href="playbooks.html">Playbooks</a><ul> <li class="toctree-l1"><a class="reference internal" href="playbooks.html">Playbooks</a><ul>
@ -339,10 +340,10 @@ Puppet Labs, and rPath. Reach Michael by email <a class="reference external" hr
<p class="pull-right"><a href="#">Back to top</a></p> <p class="pull-right"><a href="#">Back to top</a></p>
<p> <p>
&copy; Copyright 2012 Michael DeHaan.<br/> &copy; Copyright 2012 Michael DeHaan.<br/>
Last updated on Mar 10, 2012.<br/> Last updated on Mar 11, 2012.<br/>
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.8.<br/> Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.8.<br/>
</p> </p>
</div> </div>
</footer> </footer>
</body> </body>
</html> </html>

@ -114,7 +114,7 @@ s.parentNode.insertBefore(ga, s);
<li class="toctree-l1"><a class="reference internal" href="patterns.html">The Inventory File, Patterns, and Groups</a></li> <li class="toctree-l1"><a class="reference internal" href="patterns.html">The Inventory File, Patterns, and Groups</a></li>
<li class="toctree-l1"><a class="reference internal" href="examples.html">Command Line Examples</a></li> <li class="toctree-l1"><a class="reference internal" href="examples.html">Command Line Examples</a></li>
<li class="toctree-l1"><a class="reference internal" href="modules.html">Ansible Modules</a></li> <li class="toctree-l1"><a class="reference internal" href="modules.html">Ansible Modules</a></li>
<li class="toctree-l1"><a class="reference internal" href="YAMLScripts.html">YAML Format</a></li> <li class="toctree-l1"><a class="reference internal" href="YAMLSyntax.html">YAML Syntax</a></li>
<li class="toctree-l1"><a class="reference internal" href="playbooks.html">Playbooks</a></li> <li class="toctree-l1"><a class="reference internal" href="playbooks.html">Playbooks</a></li>
<li class="toctree-l1"><a class="reference internal" href="api.html">Using the Python API</a></li> <li class="toctree-l1"><a class="reference internal" href="api.html">Using the Python API</a></li>
<li class="toctree-l1"><a class="reference internal" href="faq.html">Frequently Asked Questions</a></li> <li class="toctree-l1"><a class="reference internal" href="faq.html">Frequently Asked Questions</a></li>
@ -191,7 +191,7 @@ examples of these tools in use.</p>
<p class="pull-right"><a href="#">Back to top</a></p> <p class="pull-right"><a href="#">Back to top</a></p>
<p> <p>
&copy; Copyright 2012 Michael DeHaan.<br/> &copy; Copyright 2012 Michael DeHaan.<br/>
Last updated on Mar 10, 2012.<br/> Last updated on Mar 11, 2012.<br/>
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.8.<br/> Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.8.<br/>
</p> </p>
</div> </div>

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>ansible-playbook</title><link rel="stylesheet" href="./docbook-xsl.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.75.2" /></head><body><div xml:lang="en" class="refentry" title="ansible-playbook" lang="en"><a id="id458439"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>ansible-playbook — run an ansible playbook</p></div><div class="refsynopsisdiv" title="Synopsis"><a id="_synopsis"></a><h2>Synopsis</h2><p>ansible-playbook &lt;filename.yml&gt; … [options]</p></div><div class="refsect1" title="DESCRIPTION"><a id="_description"></a><h2>DESCRIPTION</h2><p><span class="strong"><strong>Ansible playbooks</strong></span> are a configuration and multinode deployment system. Ansible-playbook is the tool <html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>ansible-playbook</title><link rel="stylesheet" href="./docbook-xsl.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.75.2" /></head><body><div xml:lang="en" class="refentry" title="ansible-playbook" lang="en"><a id="id416216"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>ansible-playbook — run an ansible playbook</p></div><div class="refsynopsisdiv" title="Synopsis"><a id="_synopsis"></a><h2>Synopsis</h2><p>ansible-playbook &lt;filename.yml&gt; … [options]</p></div><div class="refsect1" title="DESCRIPTION"><a id="_description"></a><h2>DESCRIPTION</h2><p><span class="strong"><strong>Ansible playbooks</strong></span> are a configuration and multinode deployment system. Ansible-playbook is the tool
used to run them. See the project home page (link below) for more information.</p></div><div class="refsect1" title="ARGUMENTS"><a id="_arguments"></a><h2>ARGUMENTS</h2><div class="variablelist"><dl><dt><span class="term"> used to run them. See the project home page (link below) for more information.</p></div><div class="refsect1" title="ARGUMENTS"><a id="_arguments"></a><h2>ARGUMENTS</h2><div class="variablelist"><dl><dt><span class="term">
<span class="strong"><strong>filename.yml</strong></span> <span class="strong"><strong>filename.yml</strong></span>
</span></dt><dd> </span></dt><dd>

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>ansible</title><link rel="stylesheet" href="./docbook-xsl.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.75.2" /></head><body><div xml:lang="en" class="refentry" title="ansible" lang="en"><a id="id580533"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>ansible — run a command somewhere else</p></div><div class="refsynopsisdiv" title="Synopsis"><a id="_synopsis"></a><h2>Synopsis</h2><p>ansible &lt;host-pattern&gt; [-f forks] [-m module_name] [-a args]</p></div><div class="refsect1" title="DESCRIPTION"><a id="_description"></a><h2>DESCRIPTION</h2><p><span class="strong"><strong>Ansible</strong></span> is an extra-simple tool/framework/API for doing 'remote things' over <html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>ansible</title><link rel="stylesheet" href="./docbook-xsl.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.75.2" /></head><body><div xml:lang="en" class="refentry" title="ansible" lang="en"><a id="id560087"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>ansible — run a command somewhere else</p></div><div class="refsynopsisdiv" title="Synopsis"><a id="_synopsis"></a><h2>Synopsis</h2><p>ansible &lt;host-pattern&gt; [-f forks] [-m module_name] [-a args]</p></div><div class="refsect1" title="DESCRIPTION"><a id="_description"></a><h2>DESCRIPTION</h2><p><span class="strong"><strong>Ansible</strong></span> is an extra-simple tool/framework/API for doing 'remote things' over
SSH.</p></div><div class="refsect1" title="ARGUMENTS"><a id="_arguments"></a><h2>ARGUMENTS</h2><div class="variablelist"><dl><dt><span class="term"> SSH.</p></div><div class="refsect1" title="ARGUMENTS"><a id="_arguments"></a><h2>ARGUMENTS</h2><div class="variablelist"><dl><dt><span class="term">
<span class="strong"><strong>host-pattern</strong></span> <span class="strong"><strong>host-pattern</strong></span>
</span></dt><dd> </span></dt><dd>

@ -26,7 +26,7 @@
<script type="text/javascript" src="_static/bootstrap-dropdown.js"></script> <script type="text/javascript" src="_static/bootstrap-dropdown.js"></script>
<script type="text/javascript" src="_static/bootstrap-scrollspy.js"></script> <script type="text/javascript" src="_static/bootstrap-scrollspy.js"></script>
<link rel="top" title="Ansible v0.0.1 documentation" href="index.html" /> <link rel="top" title="Ansible v0.0.1 documentation" href="index.html" />
<link rel="next" title="YAML Format" href="YAMLScripts.html" /> <link rel="next" title="YAML Syntax" href="YAMLSyntax.html" />
<link rel="prev" title="Command Line Examples" href="examples.html" /> <link rel="prev" title="Command Line Examples" href="examples.html" />
<script type="text/javascript"> <script type="text/javascript">
(function () { (function () {
@ -115,7 +115,7 @@ s.parentNode.insertBefore(ga, s);
<li class="toctree-l1"><a class="reference internal" href="patterns.html">The Inventory File, Patterns, and Groups</a></li> <li class="toctree-l1"><a class="reference internal" href="patterns.html">The Inventory File, Patterns, and Groups</a></li>
<li class="toctree-l1"><a class="reference internal" href="examples.html">Command Line Examples</a></li> <li class="toctree-l1"><a class="reference internal" href="examples.html">Command Line Examples</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="">Ansible Modules</a></li> <li class="toctree-l1 current"><a class="current reference internal" href="">Ansible Modules</a></li>
<li class="toctree-l1"><a class="reference internal" href="YAMLScripts.html">YAML Format</a></li> <li class="toctree-l1"><a class="reference internal" href="YAMLSyntax.html">YAML Syntax</a></li>
<li class="toctree-l1"><a class="reference internal" href="playbooks.html">Playbooks</a></li> <li class="toctree-l1"><a class="reference internal" href="playbooks.html">Playbooks</a></li>
<li class="toctree-l1"><a class="reference internal" href="api.html">Using the Python API</a></li> <li class="toctree-l1"><a class="reference internal" href="api.html">Using the Python API</a></li>
<li class="toctree-l1"><a class="reference internal" href="faq.html">Frequently Asked Questions</a></li> <li class="toctree-l1"><a class="reference internal" href="faq.html">Frequently Asked Questions</a></li>
@ -149,8 +149,8 @@ s.parentNode.insertBefore(ga, s);
<li><a href="examples.html" <li><a href="examples.html"
title="previous chapter">&laquo; Command Line Examples</a></li> title="previous chapter">&laquo; Command Line Examples</a></li>
<li><a href="YAMLScripts.html" <li><a href="YAMLSyntax.html"
title="next chapter">YAML Format &raquo;</a></li> title="next chapter">YAML Syntax &raquo;</a></li>
@ -380,7 +380,7 @@ arguments just like they would be passed with ansible.</p>
<p class="pull-right"><a href="#">Back to top</a></p> <p class="pull-right"><a href="#">Back to top</a></p>
<p> <p>
&copy; Copyright 2012 Michael DeHaan.<br/> &copy; Copyright 2012 Michael DeHaan.<br/>
Last updated on Mar 10, 2012.<br/> Last updated on Mar 11, 2012.<br/>
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.8.<br/> Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.8.<br/>
</p> </p>
</div> </div>

@ -115,7 +115,7 @@ s.parentNode.insertBefore(ga, s);
<li class="toctree-l1 current"><a class="current reference internal" href="">The Inventory File, Patterns, and Groups</a></li> <li class="toctree-l1 current"><a class="current reference internal" href="">The Inventory File, Patterns, and Groups</a></li>
<li class="toctree-l1"><a class="reference internal" href="examples.html">Command Line Examples</a></li> <li class="toctree-l1"><a class="reference internal" href="examples.html">Command Line Examples</a></li>
<li class="toctree-l1"><a class="reference internal" href="modules.html">Ansible Modules</a></li> <li class="toctree-l1"><a class="reference internal" href="modules.html">Ansible Modules</a></li>
<li class="toctree-l1"><a class="reference internal" href="YAMLScripts.html">YAML Format</a></li> <li class="toctree-l1"><a class="reference internal" href="YAMLSyntax.html">YAML Syntax</a></li>
<li class="toctree-l1"><a class="reference internal" href="playbooks.html">Playbooks</a></li> <li class="toctree-l1"><a class="reference internal" href="playbooks.html">Playbooks</a></li>
<li class="toctree-l1"><a class="reference internal" href="api.html">Using the Python API</a></li> <li class="toctree-l1"><a class="reference internal" href="api.html">Using the Python API</a></li>
<li class="toctree-l1"><a class="reference internal" href="faq.html">Frequently Asked Questions</a></li> <li class="toctree-l1"><a class="reference internal" href="faq.html">Frequently Asked Questions</a></li>
@ -199,6 +199,8 @@ looks like this:</p>
<span class="n">three</span><span class="o">.</span><span class="n">example</span><span class="o">.</span><span class="n">com</span> <span class="n">three</span><span class="o">.</span><span class="n">example</span><span class="o">.</span><span class="n">com</span>
</pre></div> </pre></div>
</div> </div>
<p>The things in brackets are group names, you don&#8217;t have to have them,
but they are useful.</p>
</div> </div>
<div class="section" id="selecting-targets"> <div class="section" id="selecting-targets">
<h2>Selecting Targets<a class="headerlink" href="#selecting-targets" title="Permalink to this headline"></a></h2> <h2>Selecting Targets<a class="headerlink" href="#selecting-targets" title="Permalink to this headline"></a></h2>
@ -206,16 +208,18 @@ looks like this:</p>
<div class="highlight-python"><pre>all <div class="highlight-python"><pre>all
*</pre> *</pre>
</div> </div>
<p>It is also possible to address specific hosts:</p> <p>Basically &#8216;all&#8217; is an alias for &#8216;*&#8217;. It is also possible to address a specific host or hosts:</p>
<div class="highlight-python"><pre>one.example.com <div class="highlight-python"><pre>one.example.com
one.example.com:two.example.com</pre> one.example.com:two.example.com
192.168.1.50
192.168.1.*</pre>
</div> </div>
<p>The following patterns address one or more groups, which are denoted <p>The following patterns address one or more groups, which are denoted
with the bracket headers in the inventory file:</p> with the aforementioned bracket headers in the inventory file:</p>
<div class="highlight-python"><pre>webservers <div class="highlight-python"><pre>webservers
webservers:dbservers</pre> webservers:dbservers</pre>
</div> </div>
<p>Individual hosts, but not groups, can also be referenced using <p>Individual host names (or IPs), but not groups, can also be referenced using
wildcards:</p> wildcards:</p>
<div class="highlight-python"><pre>*.example.com <div class="highlight-python"><pre>*.example.com
*.com</pre> *.com</pre>
@ -225,8 +229,9 @@ wildcards:</p>
</div> </div>
<div class="admonition note"> <div class="admonition note">
<p class="first admonition-title">Note</p> <p class="first admonition-title">Note</p>
<p class="last">It is not possible to target a host not in the inventory file.</p> <p class="last">It is not possible to target a host not in the inventory file. This is a safety feature.</p>
</div> </div>
<p>Easy enough. Now see <a class="reference internal" href="examples.html"><em>Command Line Examples</em></a> and then <a class="reference internal" href="playbooks.html"><em>Playbooks</em></a> for how to do things to selected hosts.</p>
</div> </div>
</div> </div>
@ -237,7 +242,7 @@ wildcards:</p>
<p class="pull-right"><a href="#">Back to top</a></p> <p class="pull-right"><a href="#">Back to top</a></p>
<p> <p>
&copy; Copyright 2012 Michael DeHaan.<br/> &copy; Copyright 2012 Michael DeHaan.<br/>
Last updated on Mar 10, 2012.<br/> Last updated on Mar 11, 2012.<br/>
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.8.<br/> Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.8.<br/>
</p> </p>
</div> </div>

@ -27,7 +27,7 @@
<script type="text/javascript" src="_static/bootstrap-scrollspy.js"></script> <script type="text/javascript" src="_static/bootstrap-scrollspy.js"></script>
<link rel="top" title="Ansible v0.0.1 documentation" href="index.html" /> <link rel="top" title="Ansible v0.0.1 documentation" href="index.html" />
<link rel="next" title="Using the Python API" href="api.html" /> <link rel="next" title="Using the Python API" href="api.html" />
<link rel="prev" title="YAML Format" href="YAMLScripts.html" /> <link rel="prev" title="YAML Syntax" href="YAMLSyntax.html" />
<script type="text/javascript"> <script type="text/javascript">
(function () { (function () {
/** /**
@ -115,7 +115,7 @@ s.parentNode.insertBefore(ga, s);
<li class="toctree-l1"><a class="reference internal" href="patterns.html">The Inventory File, Patterns, and Groups</a></li> <li class="toctree-l1"><a class="reference internal" href="patterns.html">The Inventory File, Patterns, and Groups</a></li>
<li class="toctree-l1"><a class="reference internal" href="examples.html">Command Line Examples</a></li> <li class="toctree-l1"><a class="reference internal" href="examples.html">Command Line Examples</a></li>
<li class="toctree-l1"><a class="reference internal" href="modules.html">Ansible Modules</a></li> <li class="toctree-l1"><a class="reference internal" href="modules.html">Ansible Modules</a></li>
<li class="toctree-l1"><a class="reference internal" href="YAMLScripts.html">YAML Format</a></li> <li class="toctree-l1"><a class="reference internal" href="YAMLSyntax.html">YAML Syntax</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="">Playbooks</a></li> <li class="toctree-l1 current"><a class="current reference internal" href="">Playbooks</a></li>
<li class="toctree-l1"><a class="reference internal" href="api.html">Using the Python API</a></li> <li class="toctree-l1"><a class="reference internal" href="api.html">Using the Python API</a></li>
<li class="toctree-l1"><a class="reference internal" href="faq.html">Frequently Asked Questions</a></li> <li class="toctree-l1"><a class="reference internal" href="faq.html">Frequently Asked Questions</a></li>
@ -147,8 +147,8 @@ s.parentNode.insertBefore(ga, s);
<li><a href="YAMLScripts.html" <li><a href="YAMLSyntax.html"
title="previous chapter">&laquo; YAML Format</a></li> title="previous chapter">&laquo; YAML Syntax</a></li>
<li><a href="api.html" <li><a href="api.html"
title="next chapter">Using the Python API &raquo;</a></li> title="next chapter">Using the Python API &raquo;</a></li>
@ -183,7 +183,7 @@ alt="Fork me on GitHub"
<div class="admonition-see-also admonition seealso"> <div class="admonition-see-also admonition seealso">
<p class="first admonition-title">See also</p> <p class="first admonition-title">See also</p>
<dl class="last docutils"> <dl class="last docutils">
<dt><a class="reference internal" href="YAMLScripts.html"><em>YAML Format</em></a></dt> <dt><a class="reference internal" href="YAMLSyntax.html"><em>YAML Syntax</em></a></dt>
<dd>Learn about YAML syntax</dd> <dd>Learn about YAML syntax</dd>
<dt><a class="reference internal" href="modules.html"><em>Ansible Modules</em></a></dt> <dt><a class="reference internal" href="modules.html"><em>Ansible Modules</em></a></dt>
<dd>Learn about available modules and writing your own</dd> <dd>Learn about available modules and writing your own</dd>
@ -393,7 +393,7 @@ from the configuration file to generate machine specific variables.</p>
<p class="pull-right"><a href="#">Back to top</a></p> <p class="pull-right"><a href="#">Back to top</a></p>
<p> <p>
&copy; Copyright 2012 Michael DeHaan.<br/> &copy; Copyright 2012 Michael DeHaan.<br/>
Last updated on Mar 10, 2012.<br/> Last updated on Mar 11, 2012.<br/>
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.8.<br/> Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.8.<br/>
</p> </p>
</div> </div>

@ -1,83 +0,0 @@
YAML Format
===========
This page provides a basic overview of correct YAML syntax, which is how Ansible
playbooks (our configuration management language) are expressed.
You may also wish to read playbook examples and will quickly pick this up from those.
YAML Basics
-----------
For `ansible`, every YAML file 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 an `ansible` file. In
addition, all YAML files (regardless of their association with
`ansible` or not) should start with ``---``.
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 ``-`` character::
---
# A list of tasty fruits
- Apple
- Orange
- Strawberry
- Mango
In the second way a list is represented as comma separated elements
surrounded by square brackets. Newlines are permitted between
elements::
---
# A list of tasty fruits
[apple, orange, banana, mango]
A dictionary is represented in a simple ``key:`` and ``value`` form::
---
# An employee record
name: John Eckersberg
job: Developer
skill: Elite
Like lists, dictionaries can be represented in an abbreviated form::
---
# An employee record
{name: John Eckersberg, job: Developer, skill: Elite}
.. _truthiness:
You can specify a boolean value (true/false) in several forms::
---
knows_oop: True
likes_emacs: TRUE
uses_cvs: false
Finally, you can combine these data structures::
---
# An employee record
name: John Eckersberg
job: Developer
skill: Elite
employed: True
foods:
- Apple
- Orange
- Strawberry
- Mango
languages:
ruby: Elite
python: Elite
dotnet: Lame
That's all you really need to know about YAML to get started writing
`Ansible` playbooks.
.. seealso::
`YAMLLint <http://yamllint.com/>`_
YAML Lint gets the lint out of your YAML

@ -0,0 +1,94 @@
YAML Syntax
===========
This page provides a basic overview of correct YAML syntax, which is how Ansible
playbooks (our configuration management language) are expressed.
We use YAML because it is easier to read and write for humans than other common
data formats like XML or JSON. Further, there are libraries available for reading
and writing YAML in most programming languages.
You may also wish to read playbook examples at the same time to see how this
is used in practice.
.. seealso::
:doc:`playbooks`
See YAML examples in practice in playbooks
YAML Basics
-----------
For `ansible`, every YAML file starts with a list of things
to do. Each item in the list is a list of key/value pairs, commonly
called a "hash" or a "dictionary". So, we need to know how
to write lists and dictionaries in YAML.
There's another small quirk to YAML. All YAML files (regardless of their association with
`ansible` or not) should start with ``---``. This is just a YAML
format thing that means "this is the start of a document".
All members of a list are lines beginning at the same indentation level starting
with a ``-`` (dash) character::
---
# A list of tasty fruits
- Apple
- Orange
- Strawberry
- Mango
A dictionary is represented in a simple ``key:`` and ``value`` form::
---
# An employee record
name: John Eckersberg
job: Developer
skill: Elite
Dictionaries can also be represented in an abbreviated form if you really want to::
---
# An employee record
{name: John Eckersberg, job: Developer, skill: Elite}
.. _truthiness:
Ansible doesn't really use these too much, but you can also specify a
boolean value (true/false) in several forms::
---
knows_oop: True
likes_emacs: TRUE
uses_cvs: false
Let's combine what we learned so far in an arbitary YAML example. This really
has nothing to do with Ansible, but will give you a feel for the format::
---
# An employee record
name: John Eckersberg
job: Developer
skill: Elite
employed: True
foods:
- Apple
- Orange
- Strawberry
- Mango
languages:
ruby: Elite
python: Elite
dotnet: Lame
That's all you really need to know about YAML to get started writing
`Ansible` playbooks.
.. seealso::
:doc:`playbooks`
Learn what playbooks can do and how to write/run them.
`YAMLLint <http://yamllint.com/>`_
YAML Lint (online) helps you debug YAML syntax if you are having problems

@ -181,3 +181,10 @@ It also excels for writing distributed
scripts and ad-hoc applications that need to gather data or perform arbitrary scripts and ad-hoc applications that need to gather data or perform arbitrary
tasks -- whether for a QA sytem, build system, or anything you can think of. tasks -- whether for a QA sytem, build system, or anything you can think of.
.. seealso::
:doc:`examples`
Examples of basic commands
:doc:`playbooks`
Learning ansible's configuration management language

@ -99,13 +99,16 @@ Now run a live command on all of your nodes::
ansible all /bin/echo hello ansible all /bin/echo hello
Congratulations. You've just contacted your nodes with Ansible. It's Congratulations. You've just contacted your nodes with Ansible. It's
now time to read some of the more real-world examples, and explore now time to read some of the more real-world :doc:`examples`, and explore
what you can do with different modules, as well as the Ansible what you can do with different modules, as well as the Ansible
playbooks language. Ansible is not just about running commands, but :doc:`playbooks` language. Ansible is not just about running commands, but
you already have a working infrastructure! you already have a working infrastructure!
.. seealso:: .. seealso::
:ref:`Inventory <inventoryformat>` :doc:`examples`
Complete documentation on the inventory file format Examples of basic commands
:doc:`playbooks`
Learning ansible's configuration management language

@ -88,7 +88,7 @@ Contents
patterns patterns
examples examples
modules modules
YAMLScripts YAMLSyntax
playbooks playbooks
api api
faq faq

@ -34,6 +34,8 @@ looks like this::
two.example.com two.example.com
three.example.com three.example.com
The things in brackets are group names, you don't have to have them,
but they are useful.
Selecting Targets Selecting Targets
+++++++++++++++++ +++++++++++++++++
@ -43,19 +45,20 @@ These patterns target all hosts in the inventory file::
all all
* *
It is also possible to address specific hosts:: Basically 'all' is an alias for '*'. It is also possible to address a specific host or hosts::
one.example.com one.example.com
one.example.com:two.example.com one.example.com:two.example.com
192.168.1.50
192.168.1.*
The following patterns address one or more groups, which are denoted The following patterns address one or more groups, which are denoted
with the bracket headers in the inventory file:: with the aforementioned bracket headers in the inventory file::
webservers webservers
webservers:dbservers webservers:dbservers
Individual hosts, but not groups, can also be referenced using Individual host names (or IPs), but not groups, can also be referenced using
wildcards:: wildcards::
*.example.com *.example.com
@ -66,4 +69,8 @@ It's also ok to mix wildcard patterns and groups at the same time::
one*.com:dbservers one*.com:dbservers
.. note:: .. note::
It is not possible to target a host not in the inventory file. It is not possible to target a host not in the inventory file. This is a safety feature.
Easy enough. Now see :doc:`examples` and then :doc:`playbooks` for how to do things to selected hosts.

@ -3,7 +3,7 @@ Playbooks
.. seealso:: .. seealso::
:doc:`YAMLScripts` :doc:`YAMLSyntax`
Learn about YAML syntax Learn about YAML syntax
:doc:`modules` :doc:`modules`
Learn about available modules and writing your own Learn about available modules and writing your own

@ -119,7 +119,7 @@ s.parentNode.insertBefore(ga, s);
<li class="toctree-l1"><a class="reference internal" href="patterns.html">The Inventory File, Patterns, and Groups</a></li> <li class="toctree-l1"><a class="reference internal" href="patterns.html">The Inventory File, Patterns, and Groups</a></li>
<li class="toctree-l1"><a class="reference internal" href="examples.html">Command Line Examples</a></li> <li class="toctree-l1"><a class="reference internal" href="examples.html">Command Line Examples</a></li>
<li class="toctree-l1"><a class="reference internal" href="modules.html">Ansible Modules</a></li> <li class="toctree-l1"><a class="reference internal" href="modules.html">Ansible Modules</a></li>
<li class="toctree-l1"><a class="reference internal" href="YAMLScripts.html">YAML Format</a></li> <li class="toctree-l1"><a class="reference internal" href="YAMLSyntax.html">YAML Syntax</a></li>
<li class="toctree-l1"><a class="reference internal" href="playbooks.html">Playbooks</a></li> <li class="toctree-l1"><a class="reference internal" href="playbooks.html">Playbooks</a></li>
<li class="toctree-l1"><a class="reference internal" href="api.html">Using the Python API</a></li> <li class="toctree-l1"><a class="reference internal" href="api.html">Using the Python API</a></li>
<li class="toctree-l1"><a class="reference internal" href="faq.html">Frequently Asked Questions</a></li> <li class="toctree-l1"><a class="reference internal" href="faq.html">Frequently Asked Questions</a></li>
@ -187,7 +187,7 @@ alt="Fork me on GitHub"
<p class="pull-right"><a href="#">Back to top</a></p> <p class="pull-right"><a href="#">Back to top</a></p>
<p> <p>
&copy; Copyright 2012 Michael DeHaan.<br/> &copy; Copyright 2012 Michael DeHaan.<br/>
Last updated on Mar 10, 2012.<br/> Last updated on Mar 11, 2012.<br/>
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.8.<br/> Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.8.<br/>
</p> </p>
</div> </div>

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save