Commit b12eeec8 by Michael DeHaan

Rebuild

parent f542e10c
...@@ -187,15 +187,25 @@ s.parentNode.insertBefore(ga, s); ...@@ -187,15 +187,25 @@ s.parentNode.insertBefore(ga, s);
<br/> <br/>
<div class="section" id="api-integrations"> <div class="section" id="api-integrations">
<h1>API &amp; Integrations<a class="headerlink" href="#api-integrations" title="Permalink to this headline"></a></h1> <h1><a class="toc-backref" href="#table-of-contents">API &amp; Integrations</a><a class="headerlink" href="#api-integrations" title="Permalink to this headline"></a></h1>
<p>There are two major ways to use Ansible from an API perspective. The primary way <p>There are two major ways to use Ansible from an API perspective. The primary way
is to use the Ansible python API to control nodes. Ansible is written in its own is to use the Ansible python API to control nodes. Ansible is written in its own
API so you have a considerable amount of power there.</p> API so you have a considerable amount of power there.</p>
<p>Also covered here, Ansible&#8217;s <p>Also covered here, Ansible&#8217;s
list of hosts, groups, and variables assigned to each host can be driven from list of hosts, groups, and variables assigned to each host can be driven from
external sources. We&#8217;ll start with the Python API.</p> external sources. We&#8217;ll start with the Python API.</p>
<div class="contents topic" id="table-of-contents">
<p class="topic-title first"><cite>Table of contents</cite></p>
<ul class="simple">
<li><a class="reference internal" href="#api-integrations" id="id2">API &amp; Integrations</a><ul>
<li><a class="reference internal" href="#python-api" id="id3">Python API</a></li>
<li><a class="reference internal" href="#external-inventory" id="id4">External Inventory</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="python-api"> <div class="section" id="python-api">
<h2>Python API<a class="headerlink" href="#python-api" title="Permalink to this headline"></a></h2> <h2><a class="toc-backref" href="#table-of-contents">Python API</a><a class="headerlink" href="#python-api" title="Permalink to this headline"></a></h2>
<p>The Python API is very powerful, and is how the ansible CLI and ansible-playbook <p>The Python API is very powerful, and is how the ansible CLI and ansible-playbook
are implemented.</p> are implemented.</p>
<p>It&#8217;s pretty simple:</p> <p>It&#8217;s pretty simple:</p>
...@@ -263,7 +273,7 @@ command line tools <tt class="docutils literal"><span class="pre">ansible</span> ...@@ -263,7 +273,7 @@ command line tools <tt class="docutils literal"><span class="pre">ansible</span>
</div> </div>
</div> </div>
<div class="section" id="external-inventory"> <div class="section" id="external-inventory">
<h2>External Inventory<a class="headerlink" href="#external-inventory" title="Permalink to this headline"></a></h2> <h2><a class="toc-backref" href="#table-of-contents">External Inventory</a><a class="headerlink" href="#external-inventory" title="Permalink to this headline"></a></h2>
<p>Often a user of a configuration management system will want to keep inventory <p>Often a user of a configuration management system will want to keep inventory
in a different system. Frequent examples include LDAP, <a class="reference external" href="http://cobbler.github.com">Cobbler</a>, in a different system. Frequent examples include LDAP, <a class="reference external" href="http://cobbler.github.com">Cobbler</a>,
or a piece of expensive enterprisey CMDB software. Ansible easily supports all or a piece of expensive enterprisey CMDB software. Ansible easily supports all
...@@ -422,9 +432,9 @@ e.g. ...@@ -422,9 +432,9 @@ e.g.
</ul> </ul>
<p>Both <tt class="docutils literal"><span class="pre">ec2_security_group_ids</span></tt> and <tt class="docutils literal"><span class="pre">ec2_security_group_names</span></tt> are comma-separated lists of all security groups. Each EC2 tag is a variable in the format <tt class="docutils literal"><span class="pre">ec2_tag_KEY</span></tt>.</p> <p>Both <tt class="docutils literal"><span class="pre">ec2_security_group_ids</span></tt> and <tt class="docutils literal"><span class="pre">ec2_security_group_names</span></tt> are comma-separated lists of all security groups. Each EC2 tag is a variable in the format <tt class="docutils literal"><span class="pre">ec2_tag_KEY</span></tt>.</p>
<p>To see the complete list of variables available for an instance, run the script by itself:</p> <p>To see the complete list of variables available for an instance, run the script by itself:</p>
<blockquote> <div class="highlight-python"><pre>cd examples/scripts
<div>cd examples/scripts ./ec2_external_inventory.py --host ec2-12-12-12-12.compute-1.amazonaws.com</pre>
./ec2_external_inventory.py &#8211;host ec2-12-12-12-12.compute-1.amazonaws.com</div></blockquote> </div>
<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">
......
...@@ -182,24 +182,37 @@ s.parentNode.insertBefore(ga, s); ...@@ -182,24 +182,37 @@ s.parentNode.insertBefore(ga, s);
<br/> <br/>
<div class="section" id="best-practices"> <div class="section" id="best-practices">
<h1>Best Practices<a class="headerlink" href="#best-practices" title="Permalink to this headline"></a></h1> <h1><a class="toc-backref" href="#contents">Best Practices</a><a class="headerlink" href="#best-practices" title="Permalink to this headline"></a></h1>
<p>Here are some tips for making the most of Ansible.</p> <p>Here are some tips for making the most of Ansible.</p>
<div class="contents topic" id="contents">
<p class="topic-title first">Contents</p>
<ul class="simple">
<li><a class="reference internal" href="#best-practices" id="id1">Best Practices</a><ul>
<li><a class="reference internal" href="#always-mention-state" id="id2">Always Mention State</a></li>
<li><a class="reference internal" href="#group-by-roles" id="id3">Group By Roles</a></li>
<li><a class="reference internal" href="#directory-organization" id="id4">Directory Organization</a></li>
<li><a class="reference internal" href="#bundling-ansible-modules-with-playbooks" id="id5">Bundling Ansible Modules With Playbooks</a></li>
<li><a class="reference internal" href="#miscellaneous-tips" id="id6">Miscellaneous Tips</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="always-mention-state"> <div class="section" id="always-mention-state">
<h2>Always Mention State<a class="headerlink" href="#always-mention-state" title="Permalink to this headline"></a></h2> <h2><a class="toc-backref" href="#contents">Always Mention State</a><a class="headerlink" href="#always-mention-state" title="Permalink to this headline"></a></h2>
<p>The &#8216;state&#8217; parameter is optional to a lot of modules. Whether <p>The &#8216;state&#8217; parameter is optional to a lot of modules. Whether
&#8216;state=present&#8217; or &#8216;state=absent&#8217;, it&#8217;s always best to leave that &#8216;state=present&#8217; or &#8216;state=absent&#8217;, it&#8217;s always best to leave that
parameter in your playbooks to make it clear, especially as some parameter in your playbooks to make it clear, especially as some
modules support additional states.</p> modules support additional states.</p>
</div> </div>
<div class="section" id="group-by-roles"> <div class="section" id="group-by-roles">
<h2>Group By Roles<a class="headerlink" href="#group-by-roles" title="Permalink to this headline"></a></h2> <h2><a class="toc-backref" href="#contents">Group By Roles</a><a class="headerlink" href="#group-by-roles" title="Permalink to this headline"></a></h2>
<p>A system can be in multiple groups. See <a class="reference internal" href="patterns.html"><em>Inventory &amp; Patterns</em></a>. Having groups named after things like <p>A system can be in multiple groups. See <a class="reference internal" href="patterns.html"><em>Inventory &amp; Patterns</em></a>. Having groups named after things like
<em>webservers</em> and <em>dbservers</em> is repeated in the examples because it&#8217;s a very powerful concept.</p> <em>webservers</em> and <em>dbservers</em> is repeated in the examples because it&#8217;s a very powerful concept.</p>
<p>This allows playbooks to target machines based on role, as well as to assign role specific variables <p>This allows playbooks to target machines based on role, as well as to assign role specific variables
using the group variable system.</p> using the group variable system.</p>
</div> </div>
<div class="section" id="directory-organization"> <div class="section" id="directory-organization">
<h2>Directory Organization<a class="headerlink" href="#directory-organization" title="Permalink to this headline"></a></h2> <h2><a class="toc-backref" href="#contents">Directory Organization</a><a class="headerlink" href="#directory-organization" title="Permalink to this headline"></a></h2>
<p>Playbooks should be organized like this:</p> <p>Playbooks should be organized like this:</p>
<div class="highlight-python"><pre># root of source control repository <div class="highlight-python"><pre># root of source control repository
├── acme/ ├── acme/
...@@ -240,14 +253,9 @@ these sections do, see <a class="reference internal" href="playbooks.html"><em>P ...@@ -240,14 +253,9 @@ these sections do, see <a class="reference internal" href="playbooks.html"><em>P
are contained in &#8216;acme/handlers/main.yml&#8217;. As a reminder, handlers are mostly just used to notify services to restart are contained in &#8216;acme/handlers/main.yml&#8217;. As a reminder, handlers are mostly just used to notify services to restart
when things change, and these are described in <a class="reference internal" href="playbooks.html"><em>Playbooks</em></a>.</p> when things change, and these are described in <a class="reference internal" href="playbooks.html"><em>Playbooks</em></a>.</p>
<p>Including more than one setup file or more than one handlers file is of course legal.</p> <p>Including more than one setup file or more than one handlers file is of course legal.</p>
<p>Having playbooks be able to include other playbooks is coming in a
future release. See <a class="reference external" href="https://github.com/ansible/ansible/issues/538">Issue 538</a>.</p>
<p>Until then, to manage your entire site, simply execute all of your playbooks together, in the order desired.
You don&#8217;t have to do this though. It&#8217;s fine to select sections of your infrastructure to manage at a single time.
You may wish to construct simple shell scripts to wrap calls to ansible-playbook.</p>
</div> </div>
<div class="section" id="bundling-ansible-modules-with-playbooks"> <div class="section" id="bundling-ansible-modules-with-playbooks">
<h2>Bundling Ansible Modules With Playbooks<a class="headerlink" href="#bundling-ansible-modules-with-playbooks" title="Permalink to this headline"></a></h2> <h2><a class="toc-backref" href="#contents">Bundling Ansible Modules With Playbooks</a><a class="headerlink" href="#bundling-ansible-modules-with-playbooks" title="Permalink to this headline"></a></h2>
<p class="versionadded"> <p class="versionadded">
<span class="versionmodified">New in version 0.5.</span></p> <span class="versionmodified">New in version 0.5.</span></p>
<p>If a playbook has a &#8221;./library&#8221; directory relative to it&#8217;s YAML file, <p>If a playbook has a &#8221;./library&#8221; directory relative to it&#8217;s YAML file,
...@@ -256,7 +264,7 @@ automatically be in the ansible module path. This is a great way to ...@@ -256,7 +264,7 @@ automatically be in the ansible module path. This is a great way to
keep modules that go with a playbook together.</p> keep modules that go with a playbook together.</p>
</div> </div>
<div class="section" id="miscellaneous-tips"> <div class="section" id="miscellaneous-tips">
<h2>Miscellaneous Tips<a class="headerlink" href="#miscellaneous-tips" title="Permalink to this headline"></a></h2> <h2><a class="toc-backref" href="#contents">Miscellaneous Tips</a><a class="headerlink" href="#miscellaneous-tips" title="Permalink to this headline"></a></h2>
<p>When you can do something simply, do something simply. Do not reach <p>When you can do something simply, do something simply. Do not reach
to use every feature of Ansible together, all at once. Use what works to use every feature of Ansible together, all at once. Use what works
for you. For example, you should probably not need &#8216;vars&#8217;, for you. For example, you should probably not need &#8216;vars&#8217;,
......
...@@ -186,14 +186,31 @@ s.parentNode.insertBefore(ga, s); ...@@ -186,14 +186,31 @@ s.parentNode.insertBefore(ga, s);
<br/> <br/>
<div class="section" id="command-line-examples-and-next-steps"> <div class="section" id="command-line-examples-and-next-steps">
<h1>Command Line Examples And Next Steps<a class="headerlink" href="#command-line-examples-and-next-steps" title="Permalink to this headline"></a></h1> <h1><a class="toc-backref" href="#contents">Command Line Examples And Next Steps</a><a class="headerlink" href="#command-line-examples-and-next-steps" title="Permalink to this headline"></a></h1>
<p>The following examples show how to use <cite>/usr/bin/ansible</cite> for running <p>The following examples show how to use <cite>/usr/bin/ansible</cite> for running
ad hoc tasks. Start here.</p> ad hoc tasks. Start here.</p>
<p>For configuration management and deployments, you&#8217;ll want to pick up on <p>For configuration management and deployments, you&#8217;ll want to pick up on
using <cite>/usr/bin/ansible-playbook</cite> &#8211; the concepts port over directly. using <cite>/usr/bin/ansible-playbook</cite> &#8211; the concepts port over directly.
(See <a class="reference internal" href="playbooks.html"><em>Playbooks</em></a> for more information about those)</p> (See <a class="reference internal" href="playbooks.html"><em>Playbooks</em></a> for more information about those)</p>
<div class="contents topic" id="contents">
<p class="topic-title first">Contents</p>
<ul class="simple">
<li><a class="reference internal" href="#command-line-examples-and-next-steps" id="id1">Command Line Examples And Next Steps</a><ul>
<li><a class="reference internal" href="#parallelism-and-shell-commands" id="id2">Parallelism and Shell Commands</a></li>
<li><a class="reference internal" href="#file-transfer" id="id3">File Transfer</a></li>
<li><a class="reference internal" href="#managing-packages" id="id4">Managing Packages</a></li>
<li><a class="reference internal" href="#users-and-groups" id="id5">Users and Groups</a></li>
<li><a class="reference internal" href="#deploying-from-source-control" id="id6">Deploying From Source Control</a></li>
<li><a class="reference internal" href="#managing-services" id="id7">Managing Services</a></li>
<li><a class="reference internal" href="#time-limited-background-operations" id="id8">Time Limited Background Operations</a></li>
<li><a class="reference internal" href="#limiting-selected-hosts" id="id9">Limiting Selected Hosts</a></li>
<li><a class="reference internal" href="#configuration-defaults" id="id10">Configuration &amp; Defaults</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="parallelism-and-shell-commands"> <div class="section" id="parallelism-and-shell-commands">
<h2>Parallelism and Shell Commands<a class="headerlink" href="#parallelism-and-shell-commands" title="Permalink to this headline"></a></h2> <h2><a class="toc-backref" href="#contents">Parallelism and Shell Commands</a><a class="headerlink" href="#parallelism-and-shell-commands" title="Permalink to this headline"></a></h2>
<p>Let&#8217;s use ansible&#8217;s command line tool to reboot all web servers in Atlanta, 10 at a time. First, let&#8217;s <p>Let&#8217;s use ansible&#8217;s command line tool to reboot all web servers in Atlanta, 10 at a time. First, let&#8217;s
set up SSH-agent so it can remember our credentials:</p> set up SSH-agent so it can remember our credentials:</p>
<div class="highlight-bash"><div class="highlight"><pre><span class="nv">$ </span>ssh-agent bash <div class="highlight-bash"><div class="highlight"><pre><span class="nv">$ </span>ssh-agent bash
...@@ -257,7 +274,7 @@ get it there. This is commonly referred to as &#8216;idempotence&#8217;, and is ...@@ -257,7 +274,7 @@ get it there. This is commonly referred to as &#8216;idempotence&#8217;, and is
However, we also recognize that running <em>ad hoc</em> commands is equally important, so Ansible easily supports both.</p> However, we also recognize that running <em>ad hoc</em> commands is equally important, so Ansible easily supports both.</p>
</div> </div>
<div class="section" id="file-transfer"> <div class="section" id="file-transfer">
<h2>File Transfer<a class="headerlink" href="#file-transfer" title="Permalink to this headline"></a></h2> <h2><a class="toc-backref" href="#contents">File Transfer</a><a class="headerlink" href="#file-transfer" title="Permalink to this headline"></a></h2>
<p>Here&#8217;s another use case for the <cite>/usr/bin/ansible</cite> command line. Ansible can SCP lots of files to multiple machines in parallel.</p> <p>Here&#8217;s another use case for the <cite>/usr/bin/ansible</cite> command line. Ansible can SCP lots of files to multiple machines in parallel.</p>
<p>To transfer a file directly to many different servers:</p> <p>To transfer a file directly to many different servers:</p>
<div class="highlight-bash"><div class="highlight"><pre><span class="nv">$ </span>ansible atlanta -m copy -a <span class="s2">&quot;src=/etc/hosts dest=/tmp/hosts&quot;</span> <div class="highlight-bash"><div class="highlight"><pre><span class="nv">$ </span>ansible atlanta -m copy -a <span class="s2">&quot;src=/etc/hosts dest=/tmp/hosts&quot;</span>
...@@ -281,7 +298,7 @@ same options can be passed directly to the <tt class="docutils literal"><span cl ...@@ -281,7 +298,7 @@ same options can be passed directly to the <tt class="docutils literal"><span cl
</div> </div>
</div> </div>
<div class="section" id="managing-packages"> <div class="section" id="managing-packages">
<h2>Managing Packages<a class="headerlink" href="#managing-packages" title="Permalink to this headline"></a></h2> <h2><a class="toc-backref" href="#contents">Managing Packages</a><a class="headerlink" href="#managing-packages" title="Permalink to this headline"></a></h2>
<p>There are modules available for yum and apt. Here are some examples <p>There are modules available for yum and apt. Here are some examples
with <a class="reference internal" href="modules.html#yum"><em>yum</em></a>.</p> with <a class="reference internal" href="modules.html#yum"><em>yum</em></a>.</p>
<p>Ensure a package is installed, but don&#8217;t update it:</p> <p>Ensure a package is installed, but don&#8217;t update it:</p>
...@@ -305,7 +322,7 @@ for other packages for now using the command module or (better!) contribute a mo ...@@ -305,7 +322,7 @@ for other packages for now using the command module or (better!) contribute a mo
for other package managers. Stop by the mailing list for info/details.</p> for other package managers. Stop by the mailing list for info/details.</p>
</div> </div>
<div class="section" id="users-and-groups"> <div class="section" id="users-and-groups">
<h2>Users and Groups<a class="headerlink" href="#users-and-groups" title="Permalink to this headline"></a></h2> <h2><a class="toc-backref" href="#contents">Users and Groups</a><a class="headerlink" href="#users-and-groups" title="Permalink to this headline"></a></h2>
<p>The <a class="reference internal" href="modules.html#user"><em>user</em></a> module allows easy creation and manipulation of <p>The <a class="reference internal" href="modules.html#user"><em>user</em></a> module allows easy creation and manipulation of
existing user accounts, as well as removal of user accounts that may existing user accounts, as well as removal of user accounts that may
exist:</p> exist:</p>
...@@ -318,7 +335,7 @@ exist:</p> ...@@ -318,7 +335,7 @@ exist:</p>
how to manipulate groups and group membership.</p> how to manipulate groups and group membership.</p>
</div> </div>
<div class="section" id="deploying-from-source-control"> <div class="section" id="deploying-from-source-control">
<h2>Deploying From Source Control<a class="headerlink" href="#deploying-from-source-control" title="Permalink to this headline"></a></h2> <h2><a class="toc-backref" href="#contents">Deploying From Source Control</a><a class="headerlink" href="#deploying-from-source-control" title="Permalink to this headline"></a></h2>
<p>Deploy your webapp straight from git:</p> <p>Deploy your webapp straight from git:</p>
<div class="highlight-bash"><div class="highlight"><pre><span class="nv">$ </span>ansible webservers -m git -a <span class="s2">&quot;repo=git://foo.example.org/repo.git dest=/srv/myapp version=HEAD&quot;</span> <div class="highlight-bash"><div class="highlight"><pre><span class="nv">$ </span>ansible webservers -m git -a <span class="s2">&quot;repo=git://foo.example.org/repo.git dest=/srv/myapp version=HEAD&quot;</span>
</pre></div> </pre></div>
...@@ -329,7 +346,7 @@ deploying Perl/Python/PHP/Ruby directly from git and then restarting ...@@ -329,7 +346,7 @@ deploying Perl/Python/PHP/Ruby directly from git and then restarting
apache.</p> apache.</p>
</div> </div>
<div class="section" id="managing-services"> <div class="section" id="managing-services">
<h2>Managing Services<a class="headerlink" href="#managing-services" title="Permalink to this headline"></a></h2> <h2><a class="toc-backref" href="#contents">Managing Services</a><a class="headerlink" href="#managing-services" title="Permalink to this headline"></a></h2>
<p>Ensure a service is started on all webservers:</p> <p>Ensure a service is started on all webservers:</p>
<div class="highlight-bash"><div class="highlight"><pre><span class="nv">$ </span>ansible webservers -m service -a <span class="s2">&quot;name=httpd state=started&quot;</span> <div class="highlight-bash"><div class="highlight"><pre><span class="nv">$ </span>ansible webservers -m service -a <span class="s2">&quot;name=httpd state=started&quot;</span>
</pre></div> </pre></div>
...@@ -344,7 +361,7 @@ apache.</p> ...@@ -344,7 +361,7 @@ apache.</p>
</div> </div>
</div> </div>
<div class="section" id="time-limited-background-operations"> <div class="section" id="time-limited-background-operations">
<h2>Time Limited Background Operations<a class="headerlink" href="#time-limited-background-operations" title="Permalink to this headline"></a></h2> <h2><a class="toc-backref" href="#contents">Time Limited Background Operations</a><a class="headerlink" href="#time-limited-background-operations" title="Permalink to this headline"></a></h2>
<p>Long running operations can be backgrounded, and their status can be <p>Long running operations can be backgrounded, and their status can be
checked on later. The same job ID is given to the same task on all checked on later. The same job ID is given to the same task on all
hosts, so you won&#8217;t lose track. If you kick hosts and don&#8217;t want hosts, so you won&#8217;t lose track. If you kick hosts and don&#8217;t want
...@@ -370,7 +387,7 @@ the remote nodes will be terminated.</p> ...@@ -370,7 +387,7 @@ the remote nodes will be terminated.</p>
shell commands or software upgrades only. Backgrounding the copy module does not do a background file transfer. <a class="reference internal" href="playbooks.html"><em>Playbooks</em></a> also support polling, and have a simplified syntax for this.</p> shell commands or software upgrades only. Backgrounding the copy module does not do a background file transfer. <a class="reference internal" href="playbooks.html"><em>Playbooks</em></a> also support polling, and have a simplified syntax for this.</p>
</div> </div>
<div class="section" id="limiting-selected-hosts"> <div class="section" id="limiting-selected-hosts">
<h2>Limiting Selected Hosts<a class="headerlink" href="#limiting-selected-hosts" title="Permalink to this headline"></a></h2> <h2><a class="toc-backref" href="#contents">Limiting Selected Hosts</a><a class="headerlink" href="#limiting-selected-hosts" title="Permalink to this headline"></a></h2>
<p class="versionadded"> <p class="versionadded">
<span class="versionmodified">New in version 0.7.</span></p> <span class="versionmodified">New in version 0.7.</span></p>
<p>What hosts you select to manage can be additionally constrained by using the &#8216;&#8211;limit&#8217; parameter or <p>What hosts you select to manage can be additionally constrained by using the &#8216;&#8211;limit&#8217; parameter or
...@@ -394,7 +411,7 @@ what their names or IP addresses are).</p> ...@@ -394,7 +411,7 @@ what their names or IP addresses are).</p>
<p>Both of these methods can be used at the same time, and ranges can also be passed to the &#8211;limit parameter.</p> <p>Both of these methods can be used at the same time, and ranges can also be passed to the &#8211;limit parameter.</p>
</div> </div>
<div class="section" id="configuration-defaults"> <div class="section" id="configuration-defaults">
<h2>Configuration &amp; Defaults<a class="headerlink" href="#configuration-defaults" title="Permalink to this headline"></a></h2> <h2><a class="toc-backref" href="#contents">Configuration &amp; Defaults</a><a class="headerlink" href="#configuration-defaults" title="Permalink to this headline"></a></h2>
<p class="versionadded"> <p class="versionadded">
<span class="versionmodified">New in version 0.7.</span></p> <span class="versionmodified">New in version 0.7.</span></p>
<p>Ansible has an optional configuration file that can be used to tune settings and also eliminate the need to pass various command line flags. The config file location is controlled by the ANSIBLE_CONFIG environment variable, if set, otherwise ~/.ansible.cfg or /etc/ansible/ansible.cfg will be loaded, whichever comes first. For those running from source, a sample configuration file lives in the examples/ directory. The RPM will install configuration into /etc/ansible/ansible.cfg automatically.</p> <p>Ansible has an optional configuration file that can be used to tune settings and also eliminate the need to pass various command line flags. The config file location is controlled by the ANSIBLE_CONFIG environment variable, if set, otherwise ~/.ansible.cfg or /etc/ansible/ansible.cfg will be loaded, whichever comes first. For those running from source, a sample configuration file lives in the examples/ directory. The RPM will install configuration into /etc/ansible/ansible.cfg automatically.</p>
......
...@@ -193,14 +193,38 @@ s.parentNode.insertBefore(ga, s); ...@@ -193,14 +193,38 @@ s.parentNode.insertBefore(ga, s);
<br/> <br/>
<div class="section" id="faq"> <div class="section" id="faq">
<h1>FAQ<a class="headerlink" href="#faq" title="Permalink to this headline"></a></h1> <h1><a class="toc-backref" href="#contents">FAQ</a><a class="headerlink" href="#faq" title="Permalink to this headline"></a></h1>
<div class="contents topic" id="contents">
<p class="topic-title first">Contents</p>
<ul class="simple">
<li><a class="reference internal" href="#faq" id="id1">FAQ</a><ul>
<li><a class="reference internal" href="#why-is-it-called-ansible" id="id2">Why Is It Called Ansible?</a></li>
<li><a class="reference internal" href="#what-inspired-ansible" id="id3">What inspired Ansible?</a></li>
<li><a class="reference internal" href="#comparisons" id="id4">Comparisons</a><ul>
<li><a class="reference internal" href="#vs-func" id="id5">vs Func?</a></li>
<li><a class="reference internal" href="#vs-puppet" id="id6">vs Puppet?</a></li>
<li><a class="reference internal" href="#vs-chef" id="id7">vs Chef?</a></li>
<li><a class="reference internal" href="#vs-capistrano-fabric" id="id8">vs Capistrano/Fabric?</a></li>
</ul>
</li>
<li><a class="reference internal" href="#other-questions" id="id9">Other Questions</a><ul>
<li><a class="reference internal" href="#what-is-ansible-s-approach-to-security" id="id10">What is Ansible&#8217;s approach to security?</a></li>
<li><a class="reference internal" href="#how-does-ansible-scale" id="id11">How does Ansible scale?</a></li>
<li><a class="reference internal" href="#are-transports-other-than-ssh-supported" id="id12">Are transports other than SSH supported?</a></li>
<li><a class="reference internal" href="#what-are-some-ideal-uses-for-ansible" id="id13">What are some ideal uses for Ansible?</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="section" id="why-is-it-called-ansible"> <div class="section" id="why-is-it-called-ansible">
<h2>Why Is It Called Ansible?<a class="headerlink" href="#why-is-it-called-ansible" title="Permalink to this headline"></a></h2> <h2><a class="toc-backref" href="#contents">Why Is It Called Ansible?</a><a class="headerlink" href="#why-is-it-called-ansible" title="Permalink to this headline"></a></h2>
<p>One of my favorite books is Orson Scott Card&#8217;s &#8220;Ender&#8217;s Game&#8221;. In the book, the Ansible is a method of instantaneous <p>One of my favorite books is Orson Scott Card&#8217;s &#8220;Ender&#8217;s Game&#8221;. In the book, the Ansible is a method of instantaneous
long distance &#8220;hyperspace&#8221; communication with a large number of space ships. You should read it!</p> long distance &#8220;hyperspace&#8221; communication with a large number of space ships. You should read it!</p>
</div> </div>
<div class="section" id="what-inspired-ansible"> <div class="section" id="what-inspired-ansible">
<h2>What inspired Ansible?<a class="headerlink" href="#what-inspired-ansible" title="Permalink to this headline"></a></h2> <h2><a class="toc-backref" href="#contents">What inspired Ansible?</a><a class="headerlink" href="#what-inspired-ansible" title="Permalink to this headline"></a></h2>
<p>Back when I worked for Red Hat and working on <a class="reference external" href="http://cobbler.github.com/">Cobbler</a>, several of us identified a gap between <p>Back when I worked for Red Hat and working on <a class="reference external" href="http://cobbler.github.com/">Cobbler</a>, several of us identified a gap between
provisioning (Cobbler) and configuration management solutions (cfengine, Puppet, etc). provisioning (Cobbler) and configuration management solutions (cfengine, Puppet, etc).
There was a need for a way to do ad-hoc tasks efficiently, and various parallel There was a need for a way to do ad-hoc tasks efficiently, and various parallel
...@@ -232,9 +256,9 @@ best&#8217;, and distills all of the ideas behind all of these other tools to th ...@@ -232,9 +256,9 @@ best&#8217;, and distills all of the ideas behind all of these other tools to th
<p>I&#8217;d like to know what you think of it. Hop by the mailing list and say hi.</p> <p>I&#8217;d like to know what you think of it. Hop by the mailing list and say hi.</p>
</div> </div>
<div class="section" id="comparisons"> <div class="section" id="comparisons">
<h2>Comparisons<a class="headerlink" href="#comparisons" title="Permalink to this headline"></a></h2> <h2><a class="toc-backref" href="#contents">Comparisons</a><a class="headerlink" href="#comparisons" title="Permalink to this headline"></a></h2>
<div class="section" id="vs-func"> <div class="section" id="vs-func">
<h3>vs Func?<a class="headerlink" href="#vs-func" title="Permalink to this headline"></a></h3> <h3><a class="toc-backref" href="#contents">vs Func?</a><a class="headerlink" href="#vs-func" title="Permalink to this headline"></a></h3>
<p>Ansible uses SSH by default instead of SSL and custom daemons, and requires <p>Ansible uses SSH by default instead of SSL and custom daemons, and requires
no extra software to run on managed machines. You can also write modules no extra software to run on managed machines. You can also write modules
in any language as long as they return JSON. Ansible&#8217;s API, of course, is in any language as long as they return JSON. Ansible&#8217;s API, of course, is
...@@ -243,7 +267,7 @@ a configuration management and multinode orchestration layer (<a class="referenc ...@@ -243,7 +267,7 @@ a configuration management and multinode orchestration layer (<a class="referenc
that Func didn&#8217;t have.</p> that Func didn&#8217;t have.</p>
</div> </div>
<div class="section" id="vs-puppet"> <div class="section" id="vs-puppet">
<h3>vs Puppet?<a class="headerlink" href="#vs-puppet" title="Permalink to this headline"></a></h3> <h3><a class="toc-backref" href="#contents">vs Puppet?</a><a class="headerlink" href="#vs-puppet" title="Permalink to this headline"></a></h3>
<p>First off, Ansible wouldn&#8217;t have happened without Puppet. Puppet took configuration <p>First off, Ansible wouldn&#8217;t have happened without Puppet. Puppet took configuration
management ideas from cfengine and made them sane. However, I still think they can management ideas from cfengine and made them sane. However, I still think they can
be much simpler.</p> be much simpler.</p>
...@@ -271,7 +295,7 @@ in jinja2 in a way just like Puppet does with erb. Ansible also has it&#8217;s ...@@ -271,7 +295,7 @@ in jinja2 in a way just like Puppet does with erb. Ansible also has it&#8217;s
so usage of facter is not required to get variables about the system.</p> so usage of facter is not required to get variables about the system.</p>
</div> </div>
<div class="section" id="vs-chef"> <div class="section" id="vs-chef">
<h3>vs Chef?<a class="headerlink" href="#vs-chef" title="Permalink to this headline"></a></h3> <h3><a class="toc-backref" href="#contents">vs Chef?</a><a class="headerlink" href="#vs-chef" title="Permalink to this headline"></a></h3>
<p>Much in the ways Ansible is different from Puppet. Chef is notoriously hard <p>Much in the ways Ansible is different from Puppet. Chef is notoriously hard
to set up on the server, and requires that you know how to program in Ruby to to set up on the server, and requires that you know how to program in Ruby to
use the language. As such, it seems to have a pretty good following mainly use the language. As such, it seems to have a pretty good following mainly
...@@ -292,7 +316,7 @@ submit a patch or module.</p> ...@@ -292,7 +316,7 @@ submit a patch or module.</p>
has it&#8217;s own facts so you do not need to use ohai unless you want to.</p> has it&#8217;s own facts so you do not need to use ohai unless you want to.</p>
</div> </div>
<div class="section" id="vs-capistrano-fabric"> <div class="section" id="vs-capistrano-fabric">
<h3>vs Capistrano/Fabric?<a class="headerlink" href="#vs-capistrano-fabric" title="Permalink to this headline"></a></h3> <h3><a class="toc-backref" href="#contents">vs Capistrano/Fabric?</a><a class="headerlink" href="#vs-capistrano-fabric" title="Permalink to this headline"></a></h3>
<p>These tools aren&#8217;t really well suited to doing idempotent configuration and are <p>These tools aren&#8217;t really well suited to doing idempotent configuration and are
typically about pushing software out for web deployment and automating steps.</p> typically about pushing software out for web deployment and automating steps.</p>
<p>Meanwhile Ansible is designed for other types of configuration management, and contains some <p>Meanwhile Ansible is designed for other types of configuration management, and contains some
...@@ -303,9 +327,9 @@ useful for sysadmins (not just web developers), and can also be used for firing ...@@ -303,9 +327,9 @@ useful for sysadmins (not just web developers), and can also be used for firing
</div> </div>
</div> </div>
<div class="section" id="other-questions"> <div class="section" id="other-questions">
<h2>Other Questions<a class="headerlink" href="#other-questions" title="Permalink to this headline"></a></h2> <h2><a class="toc-backref" href="#contents">Other Questions</a><a class="headerlink" href="#other-questions" title="Permalink to this headline"></a></h2>
<div class="section" id="what-is-ansible-s-approach-to-security"> <div class="section" id="what-is-ansible-s-approach-to-security">
<h3>What is Ansible&#8217;s approach to security?<a class="headerlink" href="#what-is-ansible-s-approach-to-security" title="Permalink to this headline"></a></h3> <h3><a class="toc-backref" href="#contents">What is Ansible&#8217;s approach to security?</a><a class="headerlink" href="#what-is-ansible-s-approach-to-security" title="Permalink to this headline"></a></h3>
<p>Ansible aims to not develop custom daemon or PKI code but rely heavily on OpenSSH, which is extremely well <p>Ansible aims to not develop custom daemon or PKI code but rely heavily on OpenSSH, which is extremely well
peer reviewed and the most widely used security subsystem in the industry. As a result, Ansible peer reviewed and the most widely used security subsystem in the industry. As a result, Ansible
has a lower attack surface than any configuration management tool featuring daemons that run has a lower attack surface than any configuration management tool featuring daemons that run
...@@ -320,7 +344,7 @@ free RAM and compute resources, which should be relevant to users wanting to max ...@@ -320,7 +344,7 @@ free RAM and compute resources, which should be relevant to users wanting to max
computing investments.</p> computing investments.</p>
</div> </div>
<div class="section" id="how-does-ansible-scale"> <div class="section" id="how-does-ansible-scale">
<h3>How does Ansible scale?<a class="headerlink" href="#how-does-ansible-scale" title="Permalink to this headline"></a></h3> <h3><a class="toc-backref" href="#contents">How does Ansible scale?</a><a class="headerlink" href="#how-does-ansible-scale" title="Permalink to this headline"></a></h3>
<p>Whether in single-execution mode or using ansible playbooks, ansible can <p>Whether in single-execution mode or using ansible playbooks, ansible can
run multiple commands in seperate parallel forks, thanks to the magic behind run multiple commands in seperate parallel forks, thanks to the magic behind
Python&#8217;s multiprocessing module.</p> Python&#8217;s multiprocessing module.</p>
...@@ -345,7 +369,7 @@ model.</p> ...@@ -345,7 +369,7 @@ model.</p>
<p>If you&#8217;d like to discuss scaling strategies further, please hop on the mailing list.</p> <p>If you&#8217;d like to discuss scaling strategies further, please hop on the mailing list.</p>
</div> </div>
<div class="section" id="are-transports-other-than-ssh-supported"> <div class="section" id="are-transports-other-than-ssh-supported">
<h3>Are transports other than SSH supported?<a class="headerlink" href="#are-transports-other-than-ssh-supported" title="Permalink to this headline"></a></h3> <h3><a class="toc-backref" href="#contents">Are transports other than SSH supported?</a><a class="headerlink" href="#are-transports-other-than-ssh-supported" title="Permalink to this headline"></a></h3>
<p>Currently SSH (you can choose between paramiko or the openssh binaries) <p>Currently SSH (you can choose between paramiko or the openssh binaries)
and local connections are supported. The interface is actually pluggable so a and local connections are supported. The interface is actually pluggable so a
small patch could bring transport over message bus or XMPP as an option.</p> small patch could bring transport over message bus or XMPP as an option.</p>
...@@ -353,7 +377,7 @@ small patch could bring transport over message bus or XMPP as an option.</p> ...@@ -353,7 +377,7 @@ small patch could bring transport over message bus or XMPP as an option.</p>
are all abstracted away from the core implementation so it is very easy to extend.</p> are all abstracted away from the core implementation so it is very easy to extend.</p>
</div> </div>
<div class="section" id="what-are-some-ideal-uses-for-ansible"> <div class="section" id="what-are-some-ideal-uses-for-ansible">
<h3>What are some ideal uses for Ansible?<a class="headerlink" href="#what-are-some-ideal-uses-for-ansible" title="Permalink to this headline"></a></h3> <h3><a class="toc-backref" href="#contents">What are some ideal uses for Ansible?</a><a class="headerlink" href="#what-are-some-ideal-uses-for-ansible" title="Permalink to this headline"></a></h3>
<p>One of the best use cases? Complex multi-node cloud deployments using playbooks. Another good <p>One of the best use cases? Complex multi-node cloud deployments using playbooks. Another good
example is for configuration management where you example is for configuration management where you
are starting from a clean OS with no extra software installed, adopting systems are starting from a clean OS with no extra software installed, adopting systems
......
...@@ -189,9 +189,22 @@ s.parentNode.insertBefore(ga, s); ...@@ -189,9 +189,22 @@ s.parentNode.insertBefore(ga, s);
<br/> <br/>
<div class="section" id="getting-started"> <div class="section" id="getting-started">
<h1>Getting Started<a class="headerlink" href="#getting-started" title="Permalink to this headline"></a></h1> <h1><a class="toc-backref" href="#contents">Getting Started</a><a class="headerlink" href="#getting-started" title="Permalink to this headline"></a></h1>
<div class="contents topic" id="contents">
<p class="topic-title first">Contents</p>
<ul class="simple">
<li><a class="reference internal" href="#getting-started" id="id1">Getting Started</a><ul>
<li><a class="reference internal" href="#requirements" id="id2">Requirements</a></li>
<li><a class="reference internal" href="#python-2-6-epel-instructions-for-rhel-and-centos-5" id="id3">Python 2.6 EPEL instructions for RHEL and CentOS 5</a></li>
<li><a class="reference internal" href="#getting-ansible" id="id4">Getting Ansible</a></li>
<li><a class="reference internal" href="#choosing-between-paramiko-and-native-ssh" id="id5">Choosing Between Paramiko and Native SSH</a></li>
<li><a class="reference internal" href="#your-first-commands" id="id6">Your first commands</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="requirements"> <div class="section" id="requirements">
<h2>Requirements<a class="headerlink" href="#requirements" title="Permalink to this headline"></a></h2> <h2><a class="toc-backref" href="#contents">Requirements</a><a class="headerlink" href="#requirements" title="Permalink to this headline"></a></h2>
<p>Requirements for Ansible are extremely minimal.</p> <p>Requirements for Ansible are extremely minimal.</p>
<p>Ansible is written for Python 2.6. If you are running Python 2.5 on an &#8220;Enterprise Linux&#8221; variant, <p>Ansible is written for Python 2.6. If you are running Python 2.5 on an &#8220;Enterprise Linux&#8221; variant,
your distribution can easily install 2.6 (see instructions in the next section). Newer versions your distribution can easily install 2.6 (see instructions in the next section). Newer versions
...@@ -218,7 +231,7 @@ though.)</p> ...@@ -218,7 +231,7 @@ though.)</p>
</div> </div>
</div> </div>
<div class="section" id="python-2-6-epel-instructions-for-rhel-and-centos-5"> <div class="section" id="python-2-6-epel-instructions-for-rhel-and-centos-5">
<h2>Python 2.6 EPEL instructions for RHEL and CentOS 5<a class="headerlink" href="#python-2-6-epel-instructions-for-rhel-and-centos-5" title="Permalink to this headline"></a></h2> <h2><a class="toc-backref" href="#contents">Python 2.6 EPEL instructions for RHEL and CentOS 5</a><a class="headerlink" href="#python-2-6-epel-instructions-for-rhel-and-centos-5" title="Permalink to this headline"></a></h2>
<p>These distributions don&#8217;t have Python 2.6 by default, but it is easily <p>These distributions don&#8217;t have Python 2.6 by default, but it is easily
installable. If you have not already done so, <a class="reference external" href="http://fedoraproject.org/wiki/EPEL">configure EPEL</a></p> installable. If you have not already done so, <a class="reference external" href="http://fedoraproject.org/wiki/EPEL">configure EPEL</a></p>
<div class="highlight-bash"><div class="highlight"><pre><span class="nv">$ </span>yum install python26 python26-PyYAML python26-paramiko python26-jinja2 <div class="highlight-bash"><div class="highlight"><pre><span class="nv">$ </span>yum install python26 python26-PyYAML python26-paramiko python26-jinja2
...@@ -226,7 +239,7 @@ installable. If you have not already done so, <a class="reference external" href ...@@ -226,7 +239,7 @@ installable. If you have not already done so, <a class="reference external" href
</div> </div>
</div> </div>
<div class="section" id="getting-ansible"> <div class="section" id="getting-ansible">
<h2>Getting Ansible<a class="headerlink" href="#getting-ansible" title="Permalink to this headline"></a></h2> <h2><a class="toc-backref" href="#contents">Getting Ansible</a><a class="headerlink" href="#getting-ansible" title="Permalink to this headline"></a></h2>
<p>If you are interested in using all the latest features, you may wish to keep up to date <p>If you are interested in using all the latest features, you may wish to keep up to date
with the development branch of the git checkout. This also makes it easiest to contribute with the development branch of the git checkout. This also makes it easiest to contribute
back to the project.</p> back to the project.</p>
...@@ -310,7 +323,7 @@ project page:</p> ...@@ -310,7 +323,7 @@ project page:</p>
</div> </div>
</div> </div>
<div class="section" id="choosing-between-paramiko-and-native-ssh"> <div class="section" id="choosing-between-paramiko-and-native-ssh">
<h2>Choosing Between Paramiko and Native SSH<a class="headerlink" href="#choosing-between-paramiko-and-native-ssh" title="Permalink to this headline"></a></h2> <h2><a class="toc-backref" href="#contents">Choosing Between Paramiko and Native SSH</a><a class="headerlink" href="#choosing-between-paramiko-and-native-ssh" title="Permalink to this headline"></a></h2>
<p>By default, ansible uses paramiko to talk to managed nodes over SSH. Paramiko is fast, works <p>By default, ansible uses paramiko to talk to managed nodes over SSH. Paramiko is fast, works
very transparently, requires no configuration, and is a good choice for most users. very transparently, requires no configuration, and is a good choice for most users.
However, it does not support some advanced SSH features that folks will want to use.</p> However, it does not support some advanced SSH features that folks will want to use.</p>
...@@ -327,7 +340,7 @@ are roughly the same speed. Without CM, the binary ssh transport is signficantl ...@@ -327,7 +340,7 @@ are roughly the same speed. Without CM, the binary ssh transport is signficantl
<p>If none of this makes sense to you, the default paramiko option is probably fine.</p> <p>If none of this makes sense to you, the default paramiko option is probably fine.</p>
</div> </div>
<div class="section" id="your-first-commands"> <div class="section" id="your-first-commands">
<h2>Your first commands<a class="headerlink" href="#your-first-commands" title="Permalink to this headline"></a></h2> <h2><a class="toc-backref" href="#contents">Your first commands</a><a class="headerlink" href="#your-first-commands" title="Permalink to this headline"></a></h2>
<p>Now that you&#8217;ve installed Ansible, it&#8217;s time to test it.</p> <p>Now that you&#8217;ve installed Ansible, it&#8217;s time to test it.</p>
<p>Edit (or create) /etc/ansible/hosts and put one or more remote systems in it, for <p>Edit (or create) /etc/ansible/hosts and put one or more remote systems in it, for
which you have your SSH key in <tt class="docutils literal"><span class="pre">authorized_keys</span></tt>:</p> which you have your SSH key in <tt class="docutils literal"><span class="pre">authorized_keys</span></tt>:</p>
......
...@@ -187,13 +187,31 @@ s.parentNode.insertBefore(ga, s); ...@@ -187,13 +187,31 @@ s.parentNode.insertBefore(ga, s);
<br/> <br/>
<div class="section" id="module-development"> <div class="section" id="module-development">
<h1>Module Development<a class="headerlink" href="#module-development" title="Permalink to this headline"></a></h1> <h1><a class="toc-backref" href="#contents">Module Development</a><a class="headerlink" href="#module-development" title="Permalink to this headline"></a></h1>
<p>Ansible modules are reusable units of magic that can be used by the Ansible API, <p>Ansible modules are reusable units of magic that can be used by the Ansible API,
or by the <cite>ansible</cite> or <cite>ansible-playbook</cite> programs.</p> or by the <cite>ansible</cite> or <cite>ansible-playbook</cite> programs.</p>
<p>Modules can be written in any language and are found in the path specified <p>Modules can be written in any language and are found in the path specified
by <cite>ANSIBLE_LIBRARY_PATH</cite> or the <tt class="docutils literal"><span class="pre">--module-path</span></tt> command line option.</p> by <cite>ANSIBLE_LIBRARY_PATH</cite> or the <tt class="docutils literal"><span class="pre">--module-path</span></tt> command line option.</p>
<div class="contents topic" id="contents">
<p class="topic-title first">Contents</p>
<ul class="simple">
<li><a class="reference internal" href="#module-development" id="id2">Module Development</a><ul>
<li><a class="reference internal" href="#tutorial" id="id3">Tutorial</a></li>
<li><a class="reference internal" href="#testing-modules" id="id4">Testing Modules</a></li>
<li><a class="reference internal" href="#reading-input" id="id5">Reading Input</a></li>
<li><a class="reference internal" href="#module-provided-facts" id="id6">Module Provided &#8216;Facts&#8217;</a></li>
<li><a class="reference internal" href="#common-module-boilerplate" id="id7">Common Module Boilerplate</a></li>
<li><a class="reference internal" href="#common-pitfalls" id="id8">Common Pitfalls</a></li>
<li><a class="reference internal" href="#conventions-recomendations" id="id9">Conventions/Recomendations</a></li>
<li><a class="reference internal" href="#shorthand-vs-json" id="id10">Shorthand Vs JSON</a></li>
<li><a class="reference internal" href="#sharing-your-module" id="id11">Sharing Your Module</a></li>
<li><a class="reference internal" href="#getting-your-module-into-core" id="id12">Getting Your Module Into Core</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="tutorial"> <div class="section" id="tutorial">
<h2>Tutorial<a class="headerlink" href="#tutorial" title="Permalink to this headline"></a></h2> <h2><a class="toc-backref" href="#contents">Tutorial</a><a class="headerlink" href="#tutorial" title="Permalink to this headline"></a></h2>
<p>Let&#8217;s build a module to get and set the system time. For starters, let&#8217;s build <p>Let&#8217;s build a module to get and set the system time. For starters, let&#8217;s build
a module that just outputs the current time.</p> a module that just outputs the current time.</p>
<p>We are going to use Python here but any language is possible. Only File I/O and outputing to standard <p>We are going to use Python here but any language is possible. Only File I/O and outputing to standard
...@@ -223,7 +241,7 @@ you&#8217;ll turn to stone. Nobody ever executes async_wrapper directly.</p> ...@@ -223,7 +241,7 @@ you&#8217;ll turn to stone. Nobody ever executes async_wrapper directly.</p>
</div> </div>
</div> </div>
<div class="section" id="testing-modules"> <div class="section" id="testing-modules">
<h2>Testing Modules<a class="headerlink" href="#testing-modules" title="Permalink to this headline"></a></h2> <h2><a class="toc-backref" href="#contents">Testing Modules</a><a class="headerlink" href="#testing-modules" title="Permalink to this headline"></a></h2>
<p>There&#8217;s a useful test script in the source checkout for ansible:</p> <p>There&#8217;s a useful test script in the source checkout for ansible:</p>
<div class="highlight-python"><pre>git clone git@github.com:ansible/ansible.git <div class="highlight-python"><pre>git clone git@github.com:ansible/ansible.git
chmod +x ansible/hacking/test-module</pre> chmod +x ansible/hacking/test-module</pre>
...@@ -238,7 +256,7 @@ chmod +x ansible/hacking/test-module</pre> ...@@ -238,7 +256,7 @@ chmod +x ansible/hacking/test-module</pre>
<p>If you did not, you might have a typo in your module, so recheck it and try again.</p> <p>If you did not, you might have a typo in your module, so recheck it and try again.</p>
</div> </div>
<div class="section" id="reading-input"> <div class="section" id="reading-input">
<h2>Reading Input<a class="headerlink" href="#reading-input" title="Permalink to this headline"></a></h2> <h2><a class="toc-backref" href="#contents">Reading Input</a><a class="headerlink" href="#reading-input" title="Permalink to this headline"></a></h2>
<p>Let&#8217;s modify the module to allow setting the current time. We&#8217;ll do this by seeing <p>Let&#8217;s modify the module to allow setting the current time. We&#8217;ll do this by seeing
if a key value pair in the form <cite>time=&lt;string&gt;</cite> is passed in to the module.</p> if a key value pair in the form <cite>time=&lt;string&gt;</cite> is passed in to the module.</p>
<p>Ansible internally saves arguments to an arguments file. So we must read the file <p>Ansible internally saves arguments to an arguments file. So we must read the file
...@@ -342,7 +360,7 @@ a lot shorter than this:</p> ...@@ -342,7 +360,7 @@ a lot shorter than this:</p>
</div> </div>
</div> </div>
<div class="section" id="module-provided-facts"> <div class="section" id="module-provided-facts">
<h2>Module Provided &#8216;Facts&#8217;<a class="headerlink" href="#module-provided-facts" title="Permalink to this headline"></a></h2> <h2><a class="toc-backref" href="#contents">Module Provided &#8216;Facts&#8217;</a><a class="headerlink" href="#module-provided-facts" title="Permalink to this headline"></a></h2>
<p>The &#8216;setup&#8217; module that ships with Ansible provides many variables about a system that can be used in playbooks <p>The &#8216;setup&#8217; module that ships with Ansible provides many variables about a system that can be used in playbooks
and templates. However, it&#8217;s possible to also add your own facts without modifying the system module. To do and templates. However, it&#8217;s possible to also add your own facts without modifying the system module. To do
this, just have the module return a <cite>ansible_facts</cite> key, like so, along with other return data:</p> this, just have the module return a <cite>ansible_facts</cite> key, like so, along with other return data:</p>
...@@ -363,7 +381,7 @@ A good idea might be make a module called &#8216;site_facts&#8217; and always ca ...@@ -363,7 +381,7 @@ A good idea might be make a module called &#8216;site_facts&#8217; and always ca
we&#8217;re always open to improving the selection of core facts in Ansible as well.</p> we&#8217;re always open to improving the selection of core facts in Ansible as well.</p>
</div> </div>
<div class="section" id="common-module-boilerplate"> <div class="section" id="common-module-boilerplate">
<h2>Common Module Boilerplate<a class="headerlink" href="#common-module-boilerplate" title="Permalink to this headline"></a></h2> <h2><a class="toc-backref" href="#contents">Common Module Boilerplate</a><a class="headerlink" href="#common-module-boilerplate" title="Permalink to this headline"></a></h2>
<p>As mentioned, if you are writing a module in Python, there are some very powerful shortcuts you can use. <p>As mentioned, if you are writing a module in Python, there are some very powerful shortcuts you can use.
Modules are still transferred as one file, but an arguments file is no longer needed, so these are not Modules are still transferred as one file, but an arguments file is no longer needed, so these are not
only shorter in terms of code, they are actually FASTER in terms of execution time.</p> only shorter in terms of code, they are actually FASTER in terms of execution time.</p>
...@@ -405,7 +423,7 @@ can function outside of Ansible.</p> ...@@ -405,7 +423,7 @@ can function outside of Ansible.</p>
class is required.</p> class is required.</p>
</div> </div>
<div class="section" id="common-pitfalls"> <div class="section" id="common-pitfalls">
<h2>Common Pitfalls<a class="headerlink" href="#common-pitfalls" title="Permalink to this headline"></a></h2> <h2><a class="toc-backref" href="#contents">Common Pitfalls</a><a class="headerlink" href="#common-pitfalls" title="Permalink to this headline"></a></h2>
<p>You should also never do this in a module:</p> <p>You should also never do this in a module:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="k">print</span> <span class="s">&quot;some status message&quot;</span> <div class="highlight-python"><div class="highlight"><pre><span class="k">print</span> <span class="s">&quot;some status message&quot;</span>
</pre></div> </pre></div>
...@@ -422,7 +440,7 @@ will still be shown in Ansible, but the command will not succeed.</p> ...@@ -422,7 +440,7 @@ will still be shown in Ansible, but the command will not succeed.</p>
you about these kind of things.</p> you about these kind of things.</p>
</div> </div>
<div class="section" id="conventions-recomendations"> <div class="section" id="conventions-recomendations">
<h2>Conventions/Recomendations<a class="headerlink" href="#conventions-recomendations" title="Permalink to this headline"></a></h2> <h2><a class="toc-backref" href="#contents">Conventions/Recomendations</a><a class="headerlink" href="#conventions-recomendations" title="Permalink to this headline"></a></h2>
<p>As a reminder from the example code above, here are some basic conventions <p>As a reminder from the example code above, here are some basic conventions
and guidelines:</p> and guidelines:</p>
<ul class="simple"> <ul class="simple">
...@@ -439,7 +457,7 @@ and guidelines:</p> ...@@ -439,7 +457,7 @@ and guidelines:</p>
</ul> </ul>
</div> </div>
<div class="section" id="shorthand-vs-json"> <div class="section" id="shorthand-vs-json">
<h2>Shorthand Vs JSON<a class="headerlink" href="#shorthand-vs-json" title="Permalink to this headline"></a></h2> <h2><a class="toc-backref" href="#contents">Shorthand Vs JSON</a><a class="headerlink" href="#shorthand-vs-json" title="Permalink to this headline"></a></h2>
<p>To make it easier to write modules in bash and in cases where a JSON <p>To make it easier to write modules in bash and in cases where a JSON
module might not be available, it is acceptable for a module to return module might not be available, it is acceptable for a module to return
key=value output all on one line, like this. The Ansible parser key=value output all on one line, like this. The Ansible parser
...@@ -450,7 +468,7 @@ will know what to do:</p> ...@@ -450,7 +468,7 @@ will know what to do:</p>
JSON is probably the simplest way to go.</p> JSON is probably the simplest way to go.</p>
</div> </div>
<div class="section" id="sharing-your-module"> <div class="section" id="sharing-your-module">
<h2>Sharing Your Module<a class="headerlink" href="#sharing-your-module" title="Permalink to this headline"></a></h2> <h2><a class="toc-backref" href="#contents">Sharing Your Module</a><a class="headerlink" href="#sharing-your-module" title="Permalink to this headline"></a></h2>
<p>If you think your module is generally useful to others, a good place to share it <p>If you think your module is generally useful to others, a good place to share it
is in <a class="reference external" href="https://github.com/ansible/ansible-resources">Ansible Resources</a>. This is maintained is in <a class="reference external" href="https://github.com/ansible/ansible-resources">Ansible Resources</a>. This is maintained
as a simple repo with pointers to other github projects.</p> as a simple repo with pointers to other github projects.</p>
...@@ -459,7 +477,7 @@ We would like to build up as many of these as possible in as many languages as p ...@@ -459,7 +477,7 @@ We would like to build up as many of these as possible in as many languages as p
<p><a class="reference external" href="http://groups.google.com/group/ansible-project">Ansible Mailing List</a></p> <p><a class="reference external" href="http://groups.google.com/group/ansible-project">Ansible Mailing List</a></p>
</div> </div>
<div class="section" id="getting-your-module-into-core"> <div class="section" id="getting-your-module-into-core">
<h2>Getting Your Module Into Core<a class="headerlink" href="#getting-your-module-into-core" title="Permalink to this headline"></a></h2> <h2><a class="toc-backref" href="#contents">Getting Your Module Into Core</a><a class="headerlink" href="#getting-your-module-into-core" title="Permalink to this headline"></a></h2>
<p>High-quality modules with minimal dependencies <p>High-quality modules with minimal dependencies
can be included in the core, but core modules (just due to the programming can be included in the core, but core modules (just due to the programming
preferences of the developers) will need to be implemented in Python and use preferences of the developers) will need to be implemented in Python and use
......
...@@ -184,12 +184,27 @@ s.parentNode.insertBefore(ga, s); ...@@ -184,12 +184,27 @@ s.parentNode.insertBefore(ga, s);
<br/> <br/>
<div class="section" id="inventory-patterns"> <div class="section" id="inventory-patterns">
<span id="patterns"></span><h1>Inventory &amp; Patterns<a class="headerlink" href="#inventory-patterns" title="Permalink to this headline"></a></h1> <span id="patterns"></span><h1><a class="toc-backref" href="#table-of-contents">Inventory &amp; Patterns</a><a class="headerlink" href="#inventory-patterns" title="Permalink to this headline"></a></h1>
<p>Ansible works against multiple systems in your infrastructure at the <p>Ansible works against multiple systems in your infrastructure at the
same time. It does this by selecting portions of systems listed in same time. It does this by selecting portions of systems listed in
Ansible&#8217;s inventory file, which defaults to /etc/ansible/hosts.</p> Ansible&#8217;s inventory file, which defaults to /etc/ansible/hosts.</p>
<div class="contents topic" id="table-of-contents">
<p class="topic-title first"><cite>Table of contents</cite></p>
<ul class="simple">
<li><a class="reference internal" href="#inventory-patterns" id="id1">Inventory &amp; Patterns</a><ul>
<li><a class="reference internal" href="#hosts-and-groups" id="id2">Hosts and Groups</a></li>
<li><a class="reference internal" href="#selecting-targets" id="id3">Selecting Targets</a></li>
<li><a class="reference internal" href="#host-variables" id="id4">Host Variables</a></li>
<li><a class="reference internal" href="#group-variables" id="id5">Group Variables</a></li>
<li><a class="reference internal" href="#groups-of-groups-and-group-variables" id="id6">Groups of Groups, and Group Variables</a></li>
<li><a class="reference internal" href="#splitting-out-host-and-group-specific-data" id="id7">Splitting Out Host and Group Specific Data</a></li>
<li><a class="reference internal" href="#yaml-inventory" id="id8">YAML Inventory</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="hosts-and-groups"> <div class="section" id="hosts-and-groups">
<span id="inventoryformat"></span><h2>Hosts and Groups<a class="headerlink" href="#hosts-and-groups" title="Permalink to this headline"></a></h2> <span id="inventoryformat"></span><h2><a class="toc-backref" href="#table-of-contents">Hosts and Groups</a><a class="headerlink" href="#hosts-and-groups" title="Permalink to this headline"></a></h2>
<p>The format for /etc/ansible/hosts is an INI format and looks like this:</p> <p>The format for /etc/ansible/hosts is an INI format and looks like this:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">mail</span><span class="o">.</span><span class="n">example</span><span class="o">.</span><span class="n">com</span> <div class="highlight-python"><div class="highlight"><pre><span class="n">mail</span><span class="o">.</span><span class="n">example</span><span class="o">.</span><span class="n">com</span>
...@@ -217,7 +232,7 @@ after the hostname with a colon.</p> ...@@ -217,7 +232,7 @@ after the hostname with a colon.</p>
<p>Leading zeros can be included or removed, as desired, and the ranges are inclusive.</p> <p>Leading zeros can be included or removed, as desired, and the ranges are inclusive.</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><a class="toc-backref" href="#table-of-contents">Selecting Targets</a><a class="headerlink" href="#selecting-targets" title="Permalink to this headline"></a></h2>
<p>We&#8217;ll go over how to use the command line in <a class="reference internal" href="examples.html"><em>Command Line Examples And Next Steps</em></a> section, however, basically it looks like this:</p> <p>We&#8217;ll go over how to use the command line in <a class="reference internal" href="examples.html"><em>Command Line Examples And Next Steps</em></a> section, however, basically it looks like this:</p>
<div class="highlight-python"><pre>ansible &lt;pattern_goes_here&gt; -m &lt;module_name&gt; -a &lt;arguments&gt;</pre> <div class="highlight-python"><pre>ansible &lt;pattern_goes_here&gt; -m &lt;module_name&gt; -a &lt;arguments&gt;</pre>
</div> </div>
...@@ -256,7 +271,7 @@ wildcards:</p> ...@@ -256,7 +271,7 @@ wildcards:</p>
<p>Easy enough. See <a class="reference internal" href="examples.html"><em>Command Line Examples And Next Steps</em></a> and then <a class="reference internal" href="playbooks.html"><em>Playbooks</em></a> for how to do things to selected hosts.</p> <p>Easy enough. See <a class="reference internal" href="examples.html"><em>Command Line Examples And Next Steps</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 class="section" id="host-variables"> <div class="section" id="host-variables">
<h2>Host Variables<a class="headerlink" href="#host-variables" title="Permalink to this headline"></a></h2> <h2><a class="toc-backref" href="#table-of-contents">Host Variables</a><a class="headerlink" href="#host-variables" title="Permalink to this headline"></a></h2>
<p>It is easy to assign variables to hosts that will be used later in playbooks:</p> <p>It is easy to assign variables to hosts that will be used later in playbooks:</p>
<div class="highlight-python"><pre>[atlanta] <div class="highlight-python"><pre>[atlanta]
host1 http_port=80 maxRequestsPerChild=808 host1 http_port=80 maxRequestsPerChild=808
...@@ -264,7 +279,7 @@ host2 http_port=303 maxRequestsPerChild=909</pre> ...@@ -264,7 +279,7 @@ host2 http_port=303 maxRequestsPerChild=909</pre>
</div> </div>
</div> </div>
<div class="section" id="group-variables"> <div class="section" id="group-variables">
<h2>Group Variables<a class="headerlink" href="#group-variables" title="Permalink to this headline"></a></h2> <h2><a class="toc-backref" href="#table-of-contents">Group Variables</a><a class="headerlink" href="#group-variables" title="Permalink to this headline"></a></h2>
<p>Variables can also be applied to an entire group at once:</p> <p>Variables can also be applied to an entire group at once:</p>
<div class="highlight-python"><pre>[atlanta] <div class="highlight-python"><pre>[atlanta]
host1 host1
...@@ -276,7 +291,7 @@ proxy=proxy.atlanta.example.com</pre> ...@@ -276,7 +291,7 @@ proxy=proxy.atlanta.example.com</pre>
</div> </div>
</div> </div>
<div class="section" id="groups-of-groups-and-group-variables"> <div class="section" id="groups-of-groups-and-group-variables">
<h2>Groups of Groups, and Group Variables<a class="headerlink" href="#groups-of-groups-and-group-variables" title="Permalink to this headline"></a></h2> <h2><a class="toc-backref" href="#table-of-contents">Groups of Groups, and Group Variables</a><a class="headerlink" href="#groups-of-groups-and-group-variables" title="Permalink to this headline"></a></h2>
<p>It is also possible to make groups of groups and assign <p>It is also possible to make groups of groups and assign
variables to groups. These variables can be used by /usr/bin/ansible-playbook, but not variables to groups. These variables can be used by /usr/bin/ansible-playbook, but not
/usr/bin/ansible:</p> /usr/bin/ansible:</p>
...@@ -308,7 +323,7 @@ southeast</pre> ...@@ -308,7 +323,7 @@ southeast</pre>
seperate from the inventory file, see the next section.</p> seperate from the inventory file, see the next section.</p>
</div> </div>
<div class="section" id="splitting-out-host-and-group-specific-data"> <div class="section" id="splitting-out-host-and-group-specific-data">
<h2>Splitting Out Host and Group Specific Data<a class="headerlink" href="#splitting-out-host-and-group-specific-data" title="Permalink to this headline"></a></h2> <h2><a class="toc-backref" href="#table-of-contents">Splitting Out Host and Group Specific Data</a><a class="headerlink" href="#splitting-out-host-and-group-specific-data" title="Permalink to this headline"></a></h2>
<p class="versionadded"> <p class="versionadded">
<span class="versionmodified">New in version 0.6.</span></p> <span class="versionmodified">New in version 0.6.</span></p>
<p>In addition to the storing variables directly in the INI file, host <p>In addition to the storing variables directly in the INI file, host
...@@ -339,7 +354,7 @@ variable called &#8216;ansible_python_interpreter&#8217; to the Python ...@@ -339,7 +354,7 @@ variable called &#8216;ansible_python_interpreter&#8217; to the Python
interpreter path you would like to use.</p> interpreter path you would like to use.</p>
</div> </div>
<div class="section" id="yaml-inventory"> <div class="section" id="yaml-inventory">
<h2>YAML Inventory<a class="headerlink" href="#yaml-inventory" title="Permalink to this headline"></a></h2> <h2><a class="toc-backref" href="#table-of-contents">YAML Inventory</a><a class="headerlink" href="#yaml-inventory" title="Permalink to this headline"></a></h2>
<p class="deprecated"> <p class="deprecated">
<span class="versionmodified">Deprecated since version 0.7.</span></p> <span class="versionmodified">Deprecated since version 0.7.</span></p>
<p>Ansible&#8217;s YAML inventory format is deprecated and will be removed in <p>Ansible&#8217;s YAML inventory format is deprecated and will be removed in
......
...@@ -149,6 +149,7 @@ s.parentNode.insertBefore(ga, s); ...@@ -149,6 +149,7 @@ s.parentNode.insertBefore(ga, s);
class="dropdown-toggle">Page</a> class="dropdown-toggle">Page</a>
<span class="localtoc"><ul> <span class="localtoc"><ul>
<li><a class="reference internal" href="#">Playbooks</a><ul> <li><a class="reference internal" href="#">Playbooks</a><ul>
<li><a class="reference internal" href="#introduction">Introduction</a></li>
<li><a class="reference internal" href="#playbook-language-example">Playbook Language Example</a></li> <li><a class="reference internal" href="#playbook-language-example">Playbook Language Example</a></li>
<li><a class="reference internal" href="#basics">Basics</a><ul> <li><a class="reference internal" href="#basics">Basics</a><ul>
<li><a class="reference internal" href="#hosts-and-users">Hosts and Users</a></li> <li><a class="reference internal" href="#hosts-and-users">Hosts and Users</a></li>
...@@ -188,7 +189,24 @@ s.parentNode.insertBefore(ga, s); ...@@ -188,7 +189,24 @@ s.parentNode.insertBefore(ga, s);
<br/> <br/>
<div class="section" id="playbooks"> <div class="section" id="playbooks">
<h1>Playbooks<a class="headerlink" href="#playbooks" title="Permalink to this headline"></a></h1> <h1><a class="toc-backref" href="#contents">Playbooks</a><a class="headerlink" href="#playbooks" title="Permalink to this headline"></a></h1>
<div class="contents topic" id="contents">
<p class="topic-title first">Contents</p>
<ul class="simple">
<li><a class="reference internal" href="#playbooks" id="id2">Playbooks</a><ul>
<li><a class="reference internal" href="#introduction" id="id3">Introduction</a></li>
<li><a class="reference internal" href="#playbook-language-example" id="id4">Playbook Language Example</a></li>
<li><a class="reference internal" href="#basics" id="id5">Basics</a></li>
<li><a class="reference internal" href="#running-operations-on-change" id="id6">Running Operations On Change</a></li>
<li><a class="reference internal" href="#include-files-and-encouraging-reuse" id="id7">Include Files And Encouraging Reuse</a></li>
<li><a class="reference internal" href="#executing-a-playbook" id="id8">Executing A Playbook</a></li>
<li><a class="reference internal" href="#tips-and-tricks" id="id9">Tips and Tricks</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="introduction">
<h2><a class="toc-backref" href="#contents">Introduction</a><a class="headerlink" href="#introduction" title="Permalink to this headline"></a></h2>
<p>Playbooks are a completely different way to use ansible than in task execution mode, and are <p>Playbooks are a completely different way to use ansible than in task execution mode, and are
particularly powerful. Simply put, playbooks are the basis for a really simple particularly powerful. Simply put, playbooks are the basis for a really simple
configuration management and multi-machine deployment system, configuration management and multi-machine deployment system,
...@@ -204,8 +222,9 @@ remote systems are in spec.</p> ...@@ -204,8 +222,9 @@ remote systems are in spec.</p>
<p>Let&#8217;s dive in and see how they work. As you go, you may wish to open <p>Let&#8217;s dive in and see how they work. As you go, you may wish to open
the <a class="reference external" href="https://github.com/ansible/ansible/tree/devel/examples/playbooks">github examples directory</a> in the <a class="reference external" href="https://github.com/ansible/ansible/tree/devel/examples/playbooks">github examples directory</a> in
another tab, so you can apply the theory to what things look like in practice.</p> another tab, so you can apply the theory to what things look like in practice.</p>
</div>
<div class="section" id="playbook-language-example"> <div class="section" id="playbook-language-example">
<h2>Playbook Language Example<a class="headerlink" href="#playbook-language-example" title="Permalink to this headline"></a></h2> <h2><a class="toc-backref" href="#contents">Playbook Language Example</a><a class="headerlink" href="#playbook-language-example" title="Permalink to this headline"></a></h2>
<p>Playbooks are expressed in YAML format and have a minimum of syntax. <p>Playbooks are expressed in YAML format and have a minimum of syntax.
Each playbook is composed of one or more &#8216;plays&#8217; in a list.</p> Each playbook is composed of one or more &#8216;plays&#8217; in a list.</p>
<p>The goal of a play is map a group of hosts to some well defined roles, represented by <p>The goal of a play is map a group of hosts to some well defined roles, represented by
...@@ -238,7 +257,7 @@ server group, then more commands back on the webservers group, etc.</p> ...@@ -238,7 +257,7 @@ server group, then more commands back on the webservers group, etc.</p>
<p>Below, we&#8217;ll break down what the various features of the playbook language are.</p> <p>Below, we&#8217;ll break down what the various features of the playbook language are.</p>
</div> </div>
<div class="section" id="basics"> <div class="section" id="basics">
<h2>Basics<a class="headerlink" href="#basics" title="Permalink to this headline"></a></h2> <h2><a class="toc-backref" href="#contents">Basics</a><a class="headerlink" href="#basics" title="Permalink to this headline"></a></h2>
<div class="section" id="hosts-and-users"> <div class="section" id="hosts-and-users">
<h3>Hosts and Users<a class="headerlink" href="#hosts-and-users" title="Permalink to this headline"></a></h3> <h3>Hosts and Users<a class="headerlink" href="#hosts-and-users" title="Permalink to this headline"></a></h3>
<p>For each play in a playbook, you get to choose which machines in your infrastructure <p>For each play in a playbook, you get to choose which machines in your infrastructure
...@@ -378,7 +397,7 @@ make more sense to break up tasks using the &#8216;include:&#8217; directive. W ...@@ -378,7 +397,7 @@ make more sense to break up tasks using the &#8216;include:&#8217; directive. W
</div> </div>
</div> </div>
<div class="section" id="running-operations-on-change"> <div class="section" id="running-operations-on-change">
<h2>Running Operations On Change<a class="headerlink" href="#running-operations-on-change" title="Permalink to this headline"></a></h2> <h2><a class="toc-backref" href="#contents">Running Operations On Change</a><a class="headerlink" href="#running-operations-on-change" title="Permalink to this headline"></a></h2>
<p>As we&#8217;ve mentioned, modules are written to be &#8216;idempotent&#8217; and can relay when <p>As we&#8217;ve mentioned, modules are written to be &#8216;idempotent&#8217; and can relay when
they have made a change on the remote system. Playbooks recognize this and they have made a change on the remote system. Playbooks recognize this and
have a basic event system that can be used to respond to change.</p> have a basic event system that can be used to respond to change.</p>
...@@ -415,7 +434,7 @@ won&#8217;t need them for much else.</p> ...@@ -415,7 +434,7 @@ won&#8217;t need them for much else.</p>
</div> </div>
</div> </div>
<div class="section" id="include-files-and-encouraging-reuse"> <div class="section" id="include-files-and-encouraging-reuse">
<h2>Include Files And Encouraging Reuse<a class="headerlink" href="#include-files-and-encouraging-reuse" title="Permalink to this headline"></a></h2> <h2><a class="toc-backref" href="#contents">Include Files And Encouraging Reuse</a><a class="headerlink" href="#include-files-and-encouraging-reuse" title="Permalink to this headline"></a></h2>
<p>Suppose you want to reuse lists of tasks between plays or playbooks. You can use <p>Suppose you want to reuse lists of tasks between plays or playbooks. You can use
include files to do this. Use of included task lists is a great way to define a role include files to do this. Use of included task lists is a great way to define a role
that system is going to fulfill. Remember, the goal of a play in a playbook is to map that system is going to fulfill. Remember, the goal of a play in a playbook is to map
...@@ -477,14 +496,14 @@ ability for hosts to conditionally skip tasks).</p> ...@@ -477,14 +496,14 @@ ability for hosts to conditionally skip tasks).</p>
</div> </div>
</div> </div>
<div class="section" id="executing-a-playbook"> <div class="section" id="executing-a-playbook">
<h2>Executing A Playbook<a class="headerlink" href="#executing-a-playbook" title="Permalink to this headline"></a></h2> <h2><a class="toc-backref" href="#contents">Executing A Playbook</a><a class="headerlink" href="#executing-a-playbook" title="Permalink to this headline"></a></h2>
<p>Now that you&#8217;ve learned playbook syntax, how do you run a playbook? It&#8217;s simple. <p>Now that you&#8217;ve learned playbook syntax, how do you run a playbook? It&#8217;s simple.
Let&#8217;s run a playbook using a parallelism level of 10:</p> Let&#8217;s run a playbook using a parallelism level of 10:</p>
<div class="highlight-python"><pre>ansible-playbook playbook.yml -f 10</pre> <div class="highlight-python"><pre>ansible-playbook playbook.yml -f 10</pre>
</div> </div>
</div> </div>
<div class="section" id="tips-and-tricks"> <div class="section" id="tips-and-tricks">
<h2>Tips and Tricks<a class="headerlink" href="#tips-and-tricks" title="Permalink to this headline"></a></h2> <h2><a class="toc-backref" href="#contents">Tips and Tricks</a><a class="headerlink" href="#tips-and-tricks" title="Permalink to this headline"></a></h2>
<p>Look at the bottom of the playbook execution for a summary of the nodes that were executed <p>Look at the bottom of the playbook execution for a summary of the nodes that were executed
and how they performed. General failures and fatal &#8220;unreachable&#8221; communication attempts are and how they performed. General failures and fatal &#8220;unreachable&#8221; communication attempts are
kept seperate in the counts.</p> kept seperate in the counts.</p>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment