Commit d3fa1c36 by Michael DeHaan

docs build + formatting fix on the modules page

parent 6eb53ad5
...@@ -275,7 +275,7 @@ languages: ...@@ -275,7 +275,7 @@ languages:
</p> </p>
<p> <p>
&copy; Copyright 2012 Michael DeHaan.<br/> &copy; Copyright 2012 Michael DeHaan.<br/>
Last updated on Jun 19, 2012.<br/> Last updated on Jul 04, 2012.<br/>
</p> </p>
</div> </div>
</footer> </footer>
......
...@@ -359,7 +359,7 @@ a conf.d file appropriately or something similar. Who knows?</p> ...@@ -359,7 +359,7 @@ a conf.d file appropriately or something similar. Who knows?</p>
</p> </p>
<p> <p>
&copy; Copyright 2012 Michael DeHaan.<br/> &copy; Copyright 2012 Michael DeHaan.<br/>
Last updated on Jun 19, 2012.<br/> Last updated on Jul 04, 2012.<br/>
</p> </p>
</div> </div>
</footer> </footer>
......
...@@ -150,6 +150,7 @@ s.parentNode.insertBefore(ga, s); ...@@ -150,6 +150,7 @@ s.parentNode.insertBefore(ga, s);
<li><a class="reference internal" href="#">Best Practices</a><ul> <li><a class="reference internal" href="#">Best Practices</a><ul>
<li><a class="reference internal" href="#group-by-roles">Group By Roles</a></li> <li><a class="reference internal" href="#group-by-roles">Group By Roles</a></li>
<li><a class="reference internal" href="#directory-organization">Directory Organization</a></li> <li><a class="reference internal" href="#directory-organization">Directory Organization</a></li>
<li><a class="reference internal" href="#bundling-ansible-modules-with-playbooks">Bundling Ansible Modules With Playbooks</a></li>
<li><a class="reference internal" href="#miscellaneous-tips">Miscellaneous Tips</a></li> <li><a class="reference internal" href="#miscellaneous-tips">Miscellaneous Tips</a></li>
</ul> </ul>
</li> </li>
...@@ -193,6 +194,7 @@ using the group variable system.</p> ...@@ -193,6 +194,7 @@ using the group variable system.</p>
<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)
global_vars.yml # variables for all playbooks
acme/ # each playbook has a directory acme/ # each playbook has a directory
setup.yml # playbook to manage the service setup.yml # playbook to manage the service
...@@ -206,7 +208,7 @@ using the group variable system.</p> ...@@ -206,7 +208,7 @@ using the group variable system.</p>
etc_other_conf_other.conf etc_other_conf_other.conf
vars/ vars/
main.yml main.yml # variables specific to this playbook
handlers/ handlers/
main.yml main.yml
...@@ -224,6 +226,7 @@ will require <cite>handlers</cite>, <cite>tasks</cite>, and <cite>templates</cit ...@@ -224,6 +226,7 @@ will require <cite>handlers</cite>, <cite>tasks</cite>, and <cite>templates</cit
user: root user: root
vars_files vars_files
- ../global_vars.yml
- vars/main.yml - vars/main.yml
tasks: tasks:
- include: tasks/setup.yml - include: tasks/setup.yml
...@@ -239,6 +242,11 @@ when things change, and these are described in <a class="reference internal" hre ...@@ -239,6 +242,11 @@ when things change, and these are described in <a class="reference internal" hre
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 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> 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">
<h2>Bundling Ansible Modules With Playbooks<a class="headerlink" href="#bundling-ansible-modules-with-playbooks" title="Permalink to this headline"></a></h2>
<p>In version 0.5 and later, if a playbook has a &#8221;./library&#8221; directory relative to it&#8217;s YAML file, this directory can be used to add ansible modules that will automatically be in the ansible module path. This is a great way to keep modules that
go with a playbook together.</p>
</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>Miscellaneous Tips<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 to use every feature of Ansible together, all <p>When you can do something simply, do something simply. Do not reach to use every feature of Ansible together, all
...@@ -289,7 +297,7 @@ This way you have an audit trail describing when and why you changed the rules a ...@@ -289,7 +297,7 @@ This way you have an audit trail describing when and why you changed the rules a
</p> </p>
<p> <p>
&copy; Copyright 2012 Michael DeHaan.<br/> &copy; Copyright 2012 Michael DeHaan.<br/>
Last updated on Jun 19, 2012.<br/> Last updated on Jul 04, 2012.<br/>
</p> </p>
</div> </div>
</footer> </footer>
......
...@@ -382,7 +382,7 @@ a simplified syntax for this.</p> ...@@ -382,7 +382,7 @@ a simplified syntax for this.</p>
</p> </p>
<p> <p>
&copy; Copyright 2012 Michael DeHaan.<br/> &copy; Copyright 2012 Michael DeHaan.<br/>
Last updated on Jun 19, 2012.<br/> Last updated on Jul 04, 2012.<br/>
</p> </p>
</div> </div>
</footer> </footer>
......
...@@ -230,8 +230,7 @@ best&#8217;, and distills all of the ideas behind all of these other tools to th ...@@ -230,8 +230,7 @@ best&#8217;, and distills all of the ideas behind all of these other tools to th
<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
heavily inspired by Func. Some features, like delegation hierarchies, are heavily inspired by Func. Ansible also adds
not supported, but Ansible does have an async mode. Ansible also adds
a configuration management and multinode orchestration layer (<a class="reference internal" href="playbooks.html"><em>Playbooks</em></a>) a configuration management and multinode orchestration layer (<a class="reference internal" href="playbooks.html"><em>Playbooks</em></a>)
that Func didn&#8217;t have.</p> that Func didn&#8217;t have.</p>
</div> </div>
...@@ -247,7 +246,7 @@ notification events (like Puppet). This is kind of a &#8216;best of both worlds ...@@ -247,7 +246,7 @@ notification events (like Puppet). This is kind of a &#8216;best of both worlds
also designed with multi-node deployment in mind from day-one &#8211; something that is difficult also designed with multi-node deployment in mind from day-one &#8211; something that is difficult
for Puppet because of the pull architecture. Ansible is push based, for Puppet because of the pull architecture. Ansible is push based,
so you can do things in an ordered fashion, addressing batches of servers so you can do things in an ordered fashion, addressing batches of servers
at one time, and you do not have to contend with the DAG. It&#8217;s also extensible in any language at one time, and you do not have to contend with the dependency graph. It&#8217;s also extensible in any language
and the source is designed so that you don&#8217;t have to be an expert programmer to submit a patch.</p> and the source is designed so that you don&#8217;t have to be an expert programmer to submit a patch.</p>
<p>Ansible&#8217;s resources are heavily inspired by Puppet, with the &#8220;state&#8221; keyword being a more or less <p>Ansible&#8217;s resources are heavily inspired by Puppet, with the &#8220;state&#8221; keyword being a more or less
direct port of &#8220;ensure&#8221; from Puppet. Unlike Puppet, Ansible can be extended in any language, direct port of &#8220;ensure&#8221; from Puppet. Unlike Puppet, Ansible can be extended in any language,
...@@ -324,9 +323,12 @@ to go.</p> ...@@ -324,9 +323,12 @@ to go.</p>
Ansible, it is not consuming any resources, and you don&#8217;t have to contend Ansible, it is not consuming any resources, and you don&#8217;t have to contend
with a herd of machines all knocking at the door of your management server with a herd of machines all knocking at the door of your management server
all at once.</p> all at once.</p>
<p>The SSH connection type (paramiko is the default, binary openssh is an option)
can also make use of &#8220;ControlMaster&#8221; features in SSH, which reuses network
connections.</p>
<p>If you have 10,000 systems, running a single ansible playbook against all of <p>If you have 10,000 systems, running a single ansible playbook against all of
them probably isn&#8217;t appropriate, which is why ansible-pull exists.</p> them probably isn&#8217;t appropriate, which is why ansible-pull exists. This tool
<p>This tool is designed for running out of git and cron, and can scale to any is designed for running out of git and cron, and can scale to any
number of hosts. Ansible-pull uses local connections versus SSH, but can be number of hosts. Ansible-pull uses local connections versus SSH, but can be
easily bootstrapped or reconfigured just using SSH. There is more information easily bootstrapped or reconfigured just using SSH. There is more information
available about this in the <a class="reference internal" href="playbooks2.html"><em>Advanced Playbooks</em></a> section. The self-bootstrapping available about this in the <a class="reference internal" href="playbooks2.html"><em>Advanced Playbooks</em></a> section. The self-bootstrapping
...@@ -336,8 +338,8 @@ model.</p> ...@@ -336,8 +338,8 @@ model.</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>Are transports other than SSH supported?<a class="headerlink" href="#are-transports-other-than-ssh-supported" title="Permalink to this headline"></a></h3>
<p>Currently SSH and local connections are supported. In 0.5, we&#8217;ll also be including <p>Currently SSH (you can choose between paramiko or the openssh binaries)
a faster SSH transport. 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>
<p>Stop by the mailing list if you have ideas. The connection-specific parts of Ansible <p>Stop by the mailing list if you have ideas. The connection-specific parts of Ansible
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>
...@@ -386,7 +388,7 @@ tasks &#8211; whether for a QA sytem, build system, or anything you can think of ...@@ -386,7 +388,7 @@ tasks &#8211; whether for a QA sytem, build system, or anything you can think of
</p> </p>
<p> <p>
&copy; Copyright 2012 Michael DeHaan.<br/> &copy; Copyright 2012 Michael DeHaan.<br/>
Last updated on Jun 19, 2012.<br/> Last updated on Jul 04, 2012.<br/>
</p> </p>
</div> </div>
</footer> </footer>
......
...@@ -190,7 +190,7 @@ s.parentNode.insertBefore(ga, s); ...@@ -190,7 +190,7 @@ s.parentNode.insertBefore(ga, s);
</p> </p>
<p> <p>
&copy; Copyright 2012 Michael DeHaan.<br/> &copy; Copyright 2012 Michael DeHaan.<br/>
Last updated on Jun 19, 2012.<br/> Last updated on Jul 04, 2012.<br/>
</p> </p>
</div> </div>
</footer> </footer>
......
...@@ -158,6 +158,7 @@ s.parentNode.insertBefore(ga, s); ...@@ -158,6 +158,7 @@ s.parentNode.insertBefore(ga, s);
<li><a class="reference internal" href="#tagged-releases">Tagged Releases</a></li> <li><a class="reference internal" href="#tagged-releases">Tagged Releases</a></li>
</ul> </ul>
</li> </li>
<li><a class="reference internal" href="#choosing-between-paramiko-and-native-ssh">Choosing Between Paramiko and Native SSH</a></li>
<li><a class="reference internal" href="#your-first-commands">Your first commands</a></li> <li><a class="reference internal" href="#your-first-commands">Your first commands</a></li>
</ul> </ul>
</li> </li>
...@@ -205,7 +206,7 @@ also need:</p> ...@@ -205,7 +206,7 @@ also need:</p>
<ul class="simple"> <ul class="simple">
<li><tt class="docutils literal"><span class="pre">python-simplejson</span></tt></li> <li><tt class="docutils literal"><span class="pre">python-simplejson</span></tt></li>
</ul> </ul>
<p>NOTE: Ansible 0.4 will have ways to remote bootstrap this, using Ansible itself. Stay tuned.</p> <p>(Note that even that&#8217;s not quite true. Ansible&#8217;s &#8220;raw&#8221; module (for executing commands in a quick and dirty way) and the copy module &#8211; some of the most basic features in ansible don&#8217;t even need that. So technically, you can use Ansible to install python-simplejson using the raw module, which then allows you to use everything else. That&#8217;s jumping ahead though.)</p>
</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>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>
...@@ -293,6 +294,21 @@ project page:</p> ...@@ -293,6 +294,21 @@ project page:</p>
</ul> </ul>
</div> </div>
</div> </div>
<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>
<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.
However, it does not support some advanced SSH features that folks will want to use.</p>
<p>Starting in version 0.5, if you want to leverage more advanced SSH features (such as Kerberized SSH or jump hosts),
pass the flag &#8220;&#8211;connection=ssh&#8221; to any ansible command, or set the
ANSIBLE_TRANSPORT environment variable to &#8216;ssh&#8217;. This will cause Ansible to use openssh
tools instead.</p>
<p>If ANSIBLE_SSH_ARGS are not set, ansible will try to use some sensible ControlMaster options
by default. You are free to override this environment variable, but should still pass ControlMaster
options to ensure performance of this transport. With ControlMaster in use, both transports
are roughly the same speed. Without CM, the binary ssh transport is signficantly slower.</p>
<p>If none of this makes sense to you, the default paramiko option is probably fine.</p>
</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>Your first commands<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>
...@@ -306,9 +322,21 @@ bserver.example.org</pre> ...@@ -306,9 +322,21 @@ bserver.example.org</pre>
<div class="highlight-python"><pre>ssh-agent bash <div class="highlight-python"><pre>ssh-agent bash
ssh-add ~/.ssh/id_rsa</pre> ssh-add ~/.ssh/id_rsa</pre>
</div> </div>
<p>(Depending on your setup, you may wish to ansible&#8217;s &#8211;private-key-file option to specify a pem file instead)</p>
<p>Now ping all your nodes:</p> <p>Now ping all your nodes:</p>
<div class="highlight-python"><pre>ansible all -m ping</pre> <div class="highlight-python"><pre>ansible all -m ping</pre>
</div> </div>
<p>If you want to access machines remotely as a different user than root, you will want to
specify the &#8216;-u&#8217; option to ansible. If you would like to access sudo mode, there are also flags to do that:</p>
<div class="highlight-python"><pre># as bruce
ansible all -m ping -u bruce
# as bruce, sudoing to root
ansible all -m ping -u bruce --sudo
# as bruce, sudoing to batman
ansible all -m ping -u bruce --sudo --sudo-user batman</pre>
</div>
<p>Now run a live command on all of your nodes:</p> <p>Now run a live command on all of your nodes:</p>
<div class="highlight-python"><pre>ansible all -a "/bin/echo hello"</pre> <div class="highlight-python"><pre>ansible all -a "/bin/echo hello"</pre>
</div> </div>
...@@ -349,7 +377,7 @@ explore, but you already have a fully working infrastructure!</p> ...@@ -349,7 +377,7 @@ explore, but you already have a fully working infrastructure!</p>
</p> </p>
<p> <p>
&copy; Copyright 2012 Michael DeHaan.<br/> &copy; Copyright 2012 Michael DeHaan.<br/>
Last updated on Jun 19, 2012.<br/> Last updated on Jul 04, 2012.<br/>
</p> </p>
</div> </div>
</footer> </footer>
......
...@@ -190,7 +190,7 @@ and command execution framework. Other tools in this space have been too ...@@ -190,7 +190,7 @@ and command execution framework. Other tools in this space have been too
complicated for too long, require too much bootstrapping, and have too complicated for too long, require too much bootstrapping, and have too
much learning curve. Ansible is dead simple and painless to extend. much learning curve. Ansible is dead simple and painless to extend.
For comparison, Puppet and Chef have about 60k lines of code. For comparison, Puppet and Chef have about 60k lines of code.
Ansible&#8217;s core is a little over 1000 lines.</p> Ansible&#8217;s core is a little over 2000 lines..</p>
<p>Ansible isn&#8217;t just for idempotent configuration &#8211; it&#8217;s also great for ad-hoc <p>Ansible isn&#8217;t just for idempotent configuration &#8211; it&#8217;s also great for ad-hoc
tasks, quickly firing off commands against nodes. See <a class="reference internal" href="examples.html"><em>Command Line</em></a>.</p> tasks, quickly firing off commands against nodes. See <a class="reference internal" href="examples.html"><em>Command Line</em></a>.</p>
</div> </div>
...@@ -237,6 +237,7 @@ hosts.</p> ...@@ -237,6 +237,7 @@ hosts.</p>
<li>Dead simple setup</li> <li>Dead simple setup</li>
<li>Super fast &amp; parallel by default</li> <li>Super fast &amp; parallel by default</li>
<li>No server or client daemons; use existing SSHd out of the box</li> <li>No server or client daemons; use existing SSHd out of the box</li>
<li>Supports Kerberized SSH, jump hosts, forwarding, etc</li>
<li>No additional software required on client boxes</li> <li>No additional software required on client boxes</li>
<li>Can be easily run from a checkout, no installation required</li> <li>Can be easily run from a checkout, no installation required</li>
<li>Modules are idempotent, but you can also easily use shell commands</li> <li>Modules are idempotent, but you can also easily use shell commands</li>
...@@ -290,6 +291,7 @@ Email: <input type=text name=email>&nbsp;&nbsp;<input type=submit name="sub" val ...@@ -290,6 +291,7 @@ Email: <input type=text name=email>&nbsp;&nbsp;<input type=submit name="sub" val
<li class="toctree-l3"><a class="reference internal" href="gettingstarted.html#tagged-releases">Tagged Releases</a></li> <li class="toctree-l3"><a class="reference internal" href="gettingstarted.html#tagged-releases">Tagged Releases</a></li>
</ul> </ul>
</li> </li>
<li class="toctree-l2"><a class="reference internal" href="gettingstarted.html#choosing-between-paramiko-and-native-ssh">Choosing Between Paramiko and Native SSH</a></li>
<li class="toctree-l2"><a class="reference internal" href="gettingstarted.html#your-first-commands">Your first commands</a></li> <li class="toctree-l2"><a class="reference internal" href="gettingstarted.html#your-first-commands">Your first commands</a></li>
</ul> </ul>
</li> </li>
...@@ -314,6 +316,8 @@ Email: <input type=text name=email>&nbsp;&nbsp;<input type=submit name="sub" val ...@@ -314,6 +316,8 @@ Email: <input type=text name=email>&nbsp;&nbsp;<input type=submit name="sub" val
</li> </li>
<li class="toctree-l1"><a class="reference internal" href="modules.html">Ansible Modules</a><ul> <li class="toctree-l1"><a class="reference internal" href="modules.html">Ansible Modules</a><ul>
<li class="toctree-l2"><a class="reference internal" href="modules.html#apt">apt</a></li> <li class="toctree-l2"><a class="reference internal" href="modules.html#apt">apt</a></li>
<li class="toctree-l2"><a class="reference internal" href="modules.html#assemble">assemble</a></li>
<li class="toctree-l2"><a class="reference internal" href="modules.html#authorized-key">authorized_key</a></li>
<li class="toctree-l2"><a class="reference internal" href="modules.html#command">command</a></li> <li class="toctree-l2"><a class="reference internal" href="modules.html#command">command</a></li>
<li class="toctree-l2"><a class="reference internal" href="modules.html#copy">copy</a></li> <li class="toctree-l2"><a class="reference internal" href="modules.html#copy">copy</a></li>
<li class="toctree-l2"><a class="reference internal" href="modules.html#facter">facter</a></li> <li class="toctree-l2"><a class="reference internal" href="modules.html#facter">facter</a></li>
...@@ -324,7 +328,7 @@ Email: <input type=text name=email>&nbsp;&nbsp;<input type=submit name="sub" val ...@@ -324,7 +328,7 @@ Email: <input type=text name=email>&nbsp;&nbsp;<input type=submit name="sub" val
<li class="toctree-l2"><a class="reference internal" href="modules.html#ohai">ohai</a></li> <li class="toctree-l2"><a class="reference internal" href="modules.html#ohai">ohai</a></li>
<li class="toctree-l2"><a class="reference internal" href="modules.html#ping">ping</a></li> <li class="toctree-l2"><a class="reference internal" href="modules.html#ping">ping</a></li>
<li class="toctree-l2"><a class="reference internal" href="modules.html#raw">raw</a></li> <li class="toctree-l2"><a class="reference internal" href="modules.html#raw">raw</a></li>
<li class="toctree-l2"><a class="reference internal" href="modules.html#id9">service</a></li> <li class="toctree-l2"><a class="reference internal" href="modules.html#id11">service</a></li>
<li class="toctree-l2"><a class="reference internal" href="modules.html#setup">setup</a></li> <li class="toctree-l2"><a class="reference internal" href="modules.html#setup">setup</a></li>
<li class="toctree-l2"><a class="reference internal" href="modules.html#shell">shell</a></li> <li class="toctree-l2"><a class="reference internal" href="modules.html#shell">shell</a></li>
<li class="toctree-l2"><a class="reference internal" href="modules.html#template">template</a></li> <li class="toctree-l2"><a class="reference internal" href="modules.html#template">template</a></li>
...@@ -349,6 +353,7 @@ Email: <input type=text name=email>&nbsp;&nbsp;<input type=submit name="sub" val ...@@ -349,6 +353,7 @@ Email: <input type=text name=email>&nbsp;&nbsp;<input type=submit name="sub" val
<li class="toctree-l2"><a class="reference internal" href="playbooks.html#running-operations-on-change">Running Operations On Change</a></li> <li class="toctree-l2"><a class="reference internal" href="playbooks.html#running-operations-on-change">Running Operations On Change</a></li>
<li class="toctree-l2"><a class="reference internal" href="playbooks.html#include-files-and-reuse">Include Files And Reuse</a></li> <li class="toctree-l2"><a class="reference internal" href="playbooks.html#include-files-and-reuse">Include Files And Reuse</a></li>
<li class="toctree-l2"><a class="reference internal" href="playbooks.html#executing-a-playbook">Executing A Playbook</a></li> <li class="toctree-l2"><a class="reference internal" href="playbooks.html#executing-a-playbook">Executing A Playbook</a></li>
<li class="toctree-l2"><a class="reference internal" href="playbooks.html#tips-and-tricks">Tips and Tricks</a></li>
</ul> </ul>
</li> </li>
<li class="toctree-l1"><a class="reference internal" href="playbooks2.html">Advanced Playbooks</a><ul> <li class="toctree-l1"><a class="reference internal" href="playbooks2.html">Advanced Playbooks</a><ul>
...@@ -370,6 +375,7 @@ Email: <input type=text name=email>&nbsp;&nbsp;<input type=submit name="sub" val ...@@ -370,6 +375,7 @@ Email: <input type=text name=email>&nbsp;&nbsp;<input type=submit name="sub" val
<li class="toctree-l1"><a class="reference internal" href="bestpractices.html">Best Practices</a><ul> <li class="toctree-l1"><a class="reference internal" href="bestpractices.html">Best Practices</a><ul>
<li class="toctree-l2"><a class="reference internal" href="bestpractices.html#group-by-roles">Group By Roles</a></li> <li class="toctree-l2"><a class="reference internal" href="bestpractices.html#group-by-roles">Group By Roles</a></li>
<li class="toctree-l2"><a class="reference internal" href="bestpractices.html#directory-organization">Directory Organization</a></li> <li class="toctree-l2"><a class="reference internal" href="bestpractices.html#directory-organization">Directory Organization</a></li>
<li class="toctree-l2"><a class="reference internal" href="bestpractices.html#bundling-ansible-modules-with-playbooks">Bundling Ansible Modules With Playbooks</a></li>
<li class="toctree-l2"><a class="reference internal" href="bestpractices.html#miscellaneous-tips">Miscellaneous Tips</a></li> <li class="toctree-l2"><a class="reference internal" href="bestpractices.html#miscellaneous-tips">Miscellaneous Tips</a></li>
</ul> </ul>
</li> </li>
...@@ -447,7 +453,7 @@ Puppet Labs, and is now with <a class="reference external" href="http://rpath.co ...@@ -447,7 +453,7 @@ Puppet Labs, and is now with <a class="reference external" href="http://rpath.co
</p> </p>
<p> <p>
&copy; Copyright 2012 Michael DeHaan.<br/> &copy; Copyright 2012 Michael DeHaan.<br/>
Last updated on Jun 19, 2012.<br/> Last updated on Jul 04, 2012.<br/>
</p> </p>
</div> </div>
</footer> </footer>
......
...@@ -455,7 +455,7 @@ Stop by the mailing list to inquire about requirements.</p> ...@@ -455,7 +455,7 @@ Stop by the mailing list to inquire about requirements.</p>
</p> </p>
<p> <p>
&copy; Copyright 2012 Michael DeHaan.<br/> &copy; Copyright 2012 Michael DeHaan.<br/>
Last updated on Jun 19, 2012.<br/> Last updated on Jul 04, 2012.<br/>
</p> </p>
</div> </div>
</footer> </footer>
......
...@@ -234,6 +234,9 @@ with the aforementioned bracket headers in the inventory file:</p> ...@@ -234,6 +234,9 @@ 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>In 0.5 and later, you can exclude groups as well, for instance, all webservers not in Phoenix:</p>
<div class="highlight-python"><pre>webservers:!phoenix</pre>
</div>
<p>Individual host names (or IPs), 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
...@@ -246,8 +249,7 @@ wildcards:</p> ...@@ -246,8 +249,7 @@ wildcards:</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>Host Variables<a class="headerlink" href="#host-variables" title="Permalink to this headline"></a></h2>
<p>Using the 0.4 branch of Ansible, it is easy to assign variables to hosts that will be used <p>It is easy to assign variables to hosts that will be used later in playbooks:</p>
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
host2 http_port=303 maxRequestsPerChild=909</pre> host2 http_port=303 maxRequestsPerChild=909</pre>
...@@ -255,7 +257,7 @@ host2 http_port=303 maxRequestsPerChild=909</pre> ...@@ -255,7 +257,7 @@ host2 http_port=303 maxRequestsPerChild=909</pre>
</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>Group Variables<a class="headerlink" href="#group-variables" title="Permalink to this headline"></a></h2>
<p>Using the 0.4 branch of Ansible, 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
host2 host2
...@@ -297,7 +299,7 @@ southeast</pre> ...@@ -297,7 +299,7 @@ southeast</pre>
</div> </div>
<div class="section" id="yaml-inventory-format"> <div class="section" id="yaml-inventory-format">
<h2>YAML Inventory Format<a class="headerlink" href="#yaml-inventory-format" title="Permalink to this headline"></a></h2> <h2>YAML Inventory Format<a class="headerlink" href="#yaml-inventory-format" title="Permalink to this headline"></a></h2>
<p>For people using 0.3, or those that prefer to use it, the inventory file can also be expressed in <p>For that prefer to use it, the inventory file can also be expressed in
YAML:</p> YAML:</p>
<div class="highlight-python"><pre>--- <div class="highlight-python"><pre>---
...@@ -334,6 +336,8 @@ YAML:</p> ...@@ -334,6 +336,8 @@ YAML:</p>
vars: vars:
- asdf: 1234</pre> - asdf: 1234</pre>
</div> </div>
<p>Tip: If you ever have two python interpreters on a system, set a variable called &#8216;ansible_python_interpreter&#8217; to
the Python interpreter path you would like to use. (This is available in version 0.5 and later)</p>
<p>Tip: Be sure to start your YAML file with the YAML record designator <tt class="docutils literal"><span class="pre">---</span></tt>.</p> <p>Tip: Be sure to start your YAML file with the YAML record designator <tt class="docutils literal"><span class="pre">---</span></tt>.</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>
...@@ -366,7 +370,7 @@ YAML:</p> ...@@ -366,7 +370,7 @@ YAML:</p>
</p> </p>
<p> <p>
&copy; Copyright 2012 Michael DeHaan.<br/> &copy; Copyright 2012 Michael DeHaan.<br/>
Last updated on Jun 19, 2012.<br/> Last updated on Jul 04, 2012.<br/>
</p> </p>
</div> </div>
</footer> </footer>
......
...@@ -158,6 +158,7 @@ s.parentNode.insertBefore(ga, s); ...@@ -158,6 +158,7 @@ s.parentNode.insertBefore(ga, s);
<li><a class="reference internal" href="#running-operations-on-change">Running Operations On Change</a></li> <li><a class="reference internal" href="#running-operations-on-change">Running Operations On Change</a></li>
<li><a class="reference internal" href="#include-files-and-reuse">Include Files And Reuse</a></li> <li><a class="reference internal" href="#include-files-and-reuse">Include Files And Reuse</a></li>
<li><a class="reference internal" href="#executing-a-playbook">Executing A Playbook</a></li> <li><a class="reference internal" href="#executing-a-playbook">Executing A Playbook</a></li>
<li><a class="reference internal" href="#tips-and-tricks">Tips and Tricks</a></li>
</ul> </ul>
</li> </li>
</ul> </ul>
...@@ -271,7 +272,7 @@ Just <cite>Control-C</cite> to kill it and run it again with <cite>-K</cite>.</p ...@@ -271,7 +272,7 @@ Just <cite>Control-C</cite> to kill it and run it again with <cite>-K</cite>.</p
<div class="highlight-python"><pre>$varname or ${varname}</pre> <div class="highlight-python"><pre>$varname or ${varname}</pre>
</div> </div>
<p>The later is useful in the event you need to do something like ${other}_concatenated_value.</p> <p>The later is useful in the event you need to do something like ${other}_concatenated_value.</p>
<p>In templates, the full power of the Jinja2 templating language is also available, which looks like this:</p> <p>The full power of the Jinja2 templating language is also available (note: in 0.4, this is only true inside of templates), which looks like this:</p>
<div class="highlight-python"><pre>{{ varname }}</pre> <div class="highlight-python"><pre>{{ varname }}</pre>
</div> </div>
<p>The Jinja2 documentation provides information about how to construct loops and conditionals for those <p>The Jinja2 documentation provides information about how to construct loops and conditionals for those
...@@ -431,6 +432,16 @@ restructure your playbook to be more class/role oriented.</p> ...@@ -431,6 +432,16 @@ restructure your playbook to be more class/role oriented.</p>
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 class="section" id="tips-and-tricks">
<h2>Tips and Tricks<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
and how they performed. General failures and fatal &#8220;unreachable&#8221; communication attempts are
kept seperate in the counts.</p>
<p>If you ever want to see detailed output from successful modules as well as unsuccessful ones,
use the &#8216;&#8211;verbose&#8217; flag. This is available in Ansible 0.5 and later.</p>
<p>Also, in version 0.5 and later, Ansible playbook output is vastly upgraded if the cowsay
package is installed. Try it!</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">
...@@ -472,7 +483,7 @@ Let&#8217;s run a playbook using a parallelism level of 10:</p> ...@@ -472,7 +483,7 @@ Let&#8217;s run a playbook using a parallelism level of 10:</p>
</p> </p>
<p> <p>
&copy; Copyright 2012 Michael DeHaan.<br/> &copy; Copyright 2012 Michael DeHaan.<br/>
Last updated on Jun 19, 2012.<br/> Last updated on Jul 04, 2012.<br/>
</p> </p>
</div> </div>
</footer> </footer>
......
...@@ -222,13 +222,20 @@ want to reference data from must be included in either the current play or any p ...@@ -222,13 +222,20 @@ want to reference data from must be included in either the current play or any p
<div class="section" id="magic-variables"> <div class="section" id="magic-variables">
<h2>Magic Variables<a class="headerlink" href="#magic-variables" title="Permalink to this headline"></a></h2> <h2>Magic Variables<a class="headerlink" href="#magic-variables" title="Permalink to this headline"></a></h2>
<p>Some variables made available to hosts don&#8217;t come from definitions in a playbook, the inventory file, or discovery from the system. There are only two of these, and are used in special cases that many users won&#8217;t need.</p> <p>Some variables made available to hosts don&#8217;t come from definitions in a playbook, the inventory file, or discovery from the system. There are only two of these, and are used in special cases that many users won&#8217;t need.</p>
<p><cite>groups</cite> is a list (array) of all the groups the current host is in. This can be used in templates using Jinja2 <p><em>group_names</em> is a list (array) of all the groups the current host is in. This can be used in templates using Jinja2
syntax to make template source files that vary based on the group membership (or role) of the host:</p> syntax to make template source files that vary based on the group membership (or role) of the host:</p>
<div class="highlight-python"><pre>{% if 'webserver' in groups %} <div class="highlight-python"><pre>{% if 'webserver' in group_names %}
# some part of a configuration file that only applies to webservers # some part of a configuration file that only applies to webservers
{% endif %}</pre> {% endif %}</pre>
</div> </div>
<p><cite>inventory_hostname</cite> is the name of the hostname as configured in Ansible&#8217;s inventory host file. This can <p><em>groups</em> is a list of all the groups (and hosts) in the inventory. This can be used to enumerate all hosts within a group.
For example:</p>
<div class="highlight-python"><pre>{% for host in groups['app_servers'] %}
# something that applies to all app servers.
{% endfor %}</pre>
</div>
<p>Use cases include pointing a frontend proxy server to all of the app servers, setting up the correct firewall rules between servers, etc.</p>
<p><em>inventory_hostname</em> is the name of the hostname as configured in Ansible&#8217;s inventory host file. This can
be useful for when you don&#8217;t want to rely on the discovered hostname <cite>ansible_hostname</cite> or for other mysterious be useful for when you don&#8217;t want to rely on the discovered hostname <cite>ansible_hostname</cite> or for other mysterious
reasons. Don&#8217;t worry about it unless you think you need it.</p> reasons. Don&#8217;t worry about it unless you think you need it.</p>
</div> </div>
...@@ -501,7 +508,7 @@ logs from ansible-pull runs would be an excellent way to gather and analyze remo ...@@ -501,7 +508,7 @@ logs from ansible-pull runs would be an excellent way to gather and analyze remo
</p> </p>
<p> <p>
&copy; Copyright 2012 Michael DeHaan.<br/> &copy; Copyright 2012 Michael DeHaan.<br/>
Last updated on Jun 19, 2012.<br/> Last updated on Jul 04, 2012.<br/>
</p> </p>
</div> </div>
</footer> </footer>
......
...@@ -73,7 +73,7 @@ Example action from Ansible :doc:`playbooks`:: ...@@ -73,7 +73,7 @@ Example action from Ansible :doc:`playbooks`::
apt pkg=foo=1.00 state=installed apt pkg=foo=1.00 state=installed
apt pkg=nginx state=latest default-release=squeeze-backports update-cache=yes apt pkg=nginx state=latest default-release=squeeze-backports update-cache=yes
. _assemble: .. _assemble:
assemble assemble
```````` ````````
...@@ -97,7 +97,7 @@ Example action from Ansible :doc:`playbooks`:: ...@@ -97,7 +97,7 @@ Example action from Ansible :doc:`playbooks`::
assemble src=/etc/someapp/fragments dest=/etc/someapp/someapp.conf assemble src=/etc/someapp/fragments dest=/etc/someapp/someapp.conf
_authorized_key: .. _authorized_key:
authorized_key authorized_key
`````````````` ``````````````
......
...@@ -207,7 +207,7 @@ s.parentNode.insertBefore(ga, s); ...@@ -207,7 +207,7 @@ s.parentNode.insertBefore(ga, s);
</p> </p>
<p> <p>
&copy; Copyright 2012 Michael DeHaan.<br/> &copy; Copyright 2012 Michael DeHaan.<br/>
Last updated on Jun 19, 2012.<br/> Last updated on Jul 04, 2012.<br/>
</p> </p>
</div> </div>
</footer> </footer>
......
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