1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Docs build + attempt to add image to website

This commit is contained in:
Michael DeHaan 2012-03-09 18:29:01 -05:00
parent 2fb25f1fe8
commit fae963a6d2
20 changed files with 255 additions and 160 deletions

View file

@ -158,7 +158,7 @@ represent all the options you can use to write an <cite>ansible</cite> file. In
addition, all YAML files (regardless of their association with
<cite>ansible</cite> or not) should start with <tt class="docutils literal"><span class="pre">---</span></tt>.</p>
<p>In YAML a list can be represented in two ways. In one way all members
of a list are lines beginning at the same indenta`tion level starting
of a list are lines beginning at the same indentation level starting
with a <tt class="docutils literal"><span class="pre">-</span></tt> character:</p>
<div class="highlight-python"><pre>---
# A list of tasty fruits
@ -229,7 +229,7 @@ languages:
<p>
&copy; Copyright 2012 Michael DeHaan.<br/>
Last updated on Mar 09, 2012.<br/>
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.7.<br/>
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.8.<br/>
</p>
</div>
</footer>

View file

@ -79,6 +79,14 @@ div.sphinxsidebar input {
font-size: 1em;
}
div.sphinxsidebar input[type="text"] {
width: 170px;
}
div.sphinxsidebar input[type="submit"] {
width: 30px;
}
img {
border: 0;
}
@ -236,7 +244,6 @@ img.align-center, .figure.align-center, object.align-center {
}
.align-center {
clear: both;
text-align: center;
}

View file

@ -363,10 +363,13 @@ var Search = {
var fullname = (prefix ? prefix + '.' : '') + name;
if (fullname.toLowerCase().indexOf(object) > -1) {
match = objects[prefix][name];
descr = objnames[match[1]] + _(', in ') + titles[match[0]];
// XXX the generated anchors are not generally correct
// XXX there may be custom prefixes
result = [filenames[match[0]], fullname, '#'+fullname, descr];
descr = objnames[match[1]][2] + _(', in ') + titles[match[0]];
anchor = match[3];
if (anchor == '')
anchor = fullname;
else if (anchor == '-')
anchor = objnames[match[1]][1] + '-' + fullname;
result = [filenames[match[0]], fullname, '#'+anchor, descr];
switch (match[2]) {
case 1: objectResults.push(result); break;
case 0: importantResults.push(result); break;
@ -489,7 +492,7 @@ var Search = {
listItem.slideDown(5, function() {
displayNextItem();
});
});
}, "text");
} else {
// no source available, just display title
Search.output.append(listItem);

View file

@ -222,7 +222,7 @@ command line tools <tt class="docutils literal"><span class="pre">ansible</span>
<p>
&copy; Copyright 2012 Michael DeHaan.<br/>
Last updated on Mar 09, 2012.<br/>
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.7.<br/>
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.8.<br/>
</p>
</div>
</footer>

View file

@ -172,28 +172,44 @@ ssh-add ~/.ssh/id_rsa.pub
ansible atlanta -a "/sbin/reboot" -f 10</pre>
</div>
<p>The -f 10 specifies the usage of 10 simultaneous processes.</p>
<p>Note that other than the command module, ansible modules do not work like simple scripts. They make the remote system look like you state, and run the commands neccessary to get it there. This is commonly refered to
as &#8216;idempotency&#8217;.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">Note that other than the <a class="reference internal" href="modules.html#command"><em>command</em></a> module, ansible modules do
not work like simple scripts. They make the remote system look like
you state, and run the commands necessary to get it there. This
is commonly referred to as &#8216;idempotent&#8217;.</p>
</div>
</div>
<div class="section" id="file-transfer-templating">
<h2>File Transfer &amp; Templating<a class="headerlink" href="#file-transfer-templating" title="Permalink to this headline"></a></h2>
<p>Ansible can SCP lots of files to multiple machines in parallel, and optionally use them as template sources.</p>
<p>Ansible can SCP lots of files to multiple machines in parallel, and
optionally use them as template sources.</p>
<p>To just transfer a file directly to many different servers:</p>
<div class="highlight-python"><pre>ansible atlanta copy -a "/etc/hosts /tmp/hosts"</pre>
</div>
<p>To use templating, first run the setup module to put the template variables you would like to use on the remote host. Then use the template module to write the files using the templates. Templates are written in Jinja2 format. Playbooks (covered elsewhere in the documentation) will run the setup module for you, making this even simpler.:</p>
<p>To use templating, first run the setup module to put the template
variables you would like to use on the remote host. Then use the
template module to write the files using the templates. Templates are
written in Jinja2 format. Playbooks (covered elsewhere in the
documentation) will run the setup module for you, making this even
simpler.:</p>
<div class="highlight-python"><pre>ansible webservers -m setup -a "favcolor=red ntp_server=192.168.1.1"
ansible webservers -m template -a "src=/srv/motd.j2 dest=/etc/motd"
ansible webservers -m template -a "src=/srv/ntp.j2 dest=/etc/ntp.conf"</pre>
</div>
<p>Need something like the fqdn in a template? If facter or ohai are installed, data from these projects will also be made available to the template engine, using &#8216;facter&#8217; and &#8216;ohai&#8217; prefixes for each.</p>
<p>Need something like the fqdn in a template? If facter or ohai are
installed, data from these projects will also be made available to the
template engine, using &#8216;facter&#8217; and &#8216;ohai&#8217; prefixes for each.</p>
</div>
<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>
<p>Deploy your webapp straight from git:</p>
<div class="highlight-python"><pre>ansible webservers -m git -a "repo=git://foo dest=/srv/myapp version=HEAD"</pre>
</div>
<p>Since ansible modules can notify change handlers (see &#8216;Playbooks&#8217;) it is possible to tell ansible to run specific tasks when the code is updated, such as deploying Perl/Python/PHP/Ruby directly from git and then restarting apache.</p>
<p>Since ansible modules can notify change handlers (see
<a class="reference internal" href="playbooks.html"><em>Playbooks</em></a>) it is possible to tell ansible to run specific tasks
when the code is updated, such as deploying Perl/Python/PHP/Ruby
directly from git and then restarting apache.</p>
</div>
<div class="section" id="managing-services">
<h2>Managing Services<a class="headerlink" href="#managing-services" title="Permalink to this headline"></a></h2>
@ -206,13 +222,18 @@ ansible webservers -m template -a "src=/srv/ntp.j2 dest=/etc/ntp.conf"</pre>
</div>
<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>
<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 hosts, so you won&#8217;t lose track. Polling support is pending in the command line.:</p>
<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
hosts, so you won&#8217;t lose track. Polling support is pending in the
command line.:</p>
<div class="highlight-python"><pre>ansible all -B 3600 -a "/usr/bin/long_running_operation --do-stuff"
ansible all -n job_status -a jid=123456789</pre>
</div>
<p>Any module other than &#8216;copy&#8217; or &#8216;template&#8217; can be backgrounded. Typically you&#8217;ll be backgrounding shell
commands or software upgrades only.</p>
<p>After the time limit (in seconds) runs out (-B), the process on the remote nodes will be killed.</p>
<p>Any module other than <a class="reference internal" href="modules.html#copy"><em>copy</em></a> or <a class="reference internal" href="modules.html#template"><em>template</em></a> can be
backgrounded. Typically you&#8217;ll be backgrounding shell commands or
software upgrades only.</p>
<p>After the time limit (in seconds) runs out (<tt class="docutils literal"><span class="pre">-B</span></tt>), the process on
the remote nodes will be killed.</p>
</div>
</div>
@ -224,7 +245,7 @@ commands or software upgrades only.</p>
<p>
&copy; Copyright 2012 Michael DeHaan.<br/>
Last updated on Mar 09, 2012.<br/>
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.7.<br/>
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.8.<br/>
</p>
</div>
</footer>

View file

@ -151,7 +151,7 @@
<p>
&copy; Copyright 2012 Michael DeHaan.<br/>
Last updated on Mar 09, 2012.<br/>
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.7.<br/>
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.8.<br/>
</p>
</div>
</footer>

View file

@ -27,7 +27,7 @@
<script type="text/javascript" src="_static/bootstrap-scrollspy.js"></script>
<link rel="top" title="Ansible v0.0.1 documentation" href="index.html" />
<link rel="next" title="The Inventory File, Patterns, and Groups" href="patterns.html" />
<link rel="prev" title="Ansible" href="index.html" />
<link rel="prev" title="Introducing Ansible" href="index.html" />
<script type="text/javascript">
(function () {
/**
@ -128,7 +128,7 @@
<li><a href="index.html"
title="previous chapter">&laquo; Ansible</a></li>
title="previous chapter">&laquo; Introducing Ansible</a></li>
<li><a href="patterns.html"
title="next chapter">The Inventory File, Patterns, and Groups &raquo;</a></li>
@ -167,7 +167,8 @@
<div class="section" id="requirements">
<h2>Requirements<a class="headerlink" href="#requirements" title="Permalink to this headline"></a></h2>
<p>Requirements for Ansible are extremely minimal.</p>
<p>If you are running python 2.6 on the <strong>overlord</strong> machine (the machine that you&#8217;ll be talking to the other machines from), you will need:</p>
<p>If you are running python 2.6 on the <strong>overlord</strong> machine (the machine
that you&#8217;ll be talking to the other machines from), you will need:</p>
<ul class="simple">
<li><tt class="docutils literal"><span class="pre">paramiko</span></tt></li>
<li><tt class="docutils literal"><span class="pre">PyYAML</span></tt></li>
@ -213,8 +214,8 @@ $ sudo make install</pre>
</div>
<div class="section" id="via-rpm">
<h3>Via RPM<a class="headerlink" href="#via-rpm" title="Permalink to this headline"></a></h3>
<p>In the near future, pre-built RPMs will be available through your distribution. Until that time you
can use the <tt class="docutils literal"><span class="pre">make</span> <span class="pre">rpm</span></tt> command:</p>
<p>In the near future, pre-built RPMs will be available through your
distribution. Until that time you can use the <tt class="docutils literal"><span class="pre">make</span> <span class="pre">rpm</span></tt> command:</p>
<div class="highlight-python"><pre>$ git clone git://github.com/ansible/ansible.git
$ cd ./ansible
$ make rpm
@ -224,8 +225,8 @@ $ sudo rpm -Uvh ~/rpmbuild/RPMS/noarch/ansible-1.0-1.noarch.rpm</pre>
</div>
<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>
<p>Edit /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>
<p>Edit /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>
<div class="highlight-python"><pre>192.168.1.50
aserver.example.org
bserver.example.org</pre>
@ -240,10 +241,18 @@ ssh-add ~/.ssh/id_rsa</pre>
<p>Now run a live command on all of your nodes:</p>
<div class="highlight-python"><pre>ansible all /bin/echo hello</pre>
</div>
<p>Congratulations. You&#8217;ve just contacted your nodes with Ansible. It&#8217;s now time to read some
of the more real-world examples, and explore what you can do with different modules, as well
as the Ansible playbooks language. Ansible is not just about running commands, but you already
have a working infrastructure!</p>
<p>Congratulations. You&#8217;ve just contacted your nodes with Ansible. It&#8217;s
now time to read some of the more real-world examples, and explore
what you can do with different modules, as well as the Ansible
playbooks language. Ansible is not just about running commands, but
you already have a working infrastructure!</p>
<div class="admonition-see-also admonition seealso">
<p class="first admonition-title">See also</p>
<dl class="last docutils">
<dt><a class="reference internal" href="patterns.html#inventoryformat"><em>Inventory</em></a></dt>
<dd>Complete documentation on the inventory file format</dd>
</dl>
</div>
</div>
</div>
@ -255,7 +264,7 @@ have a working infrastructure!</p>
<p>
&copy; Copyright 2012 Michael DeHaan.<br/>
Last updated on Mar 09, 2012.<br/>
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.7.<br/>
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.8.<br/>
</p>
</div>
</footer>

View file

@ -6,7 +6,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Ansible &mdash; Ansible v0.0.1 documentation</title>
<title>Introducing Ansible &mdash; Ansible v0.0.1 documentation</title>
<link rel="stylesheet" href="_static/default.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/bootstrap.css" type="text/css" />
@ -109,7 +109,7 @@
<a href="#"
class="dropdown-toggle">Page</a>
<span class="localtoc"><ul>
<li><a class="reference internal" href="#">Ansible</a><ul>
<li><a class="reference internal" href="#">Introducing Ansible</a><ul>
<li><a class="reference internal" href="#design-goals">Design Goals</a></li>
<li><a class="reference internal" href="#communicate-and-get-involved">Communicate and Get Involved</a></li>
</ul>
@ -147,22 +147,31 @@
<div class="container">
<div class="section" id="ansible">
<h1>Ansible<a class="headerlink" href="#ansible" title="Permalink to this headline"></a></h1>
<p>Ansible is a radically simple deployment, configuration, and command execution framework.
Other tools in this space have been too complicated for too long, require too much bootstrapping,
and have too much learning curve. Ansible is dead simple and painless to extend. For comparison, Puppet and Chef have about 60k lines of code. Ansible&#8217;s core is a little over 1000 lines.</p>
<p>Ansible isn&#8217;t just for configuration &#8211; it&#8217;s also great for Ad-Hoc tasks,
quickly firing off commands against nodes. Where Ansible excels though, is expressing complex multi-node deployment processes, executing complex sequences of commands on different hosts through &#8220;playbooks&#8221;.</p>
<p>Extending ansible does not require programming in any particular language &#8211; you can write modules
as scripts or programs that return simple JSON. It&#8217;s also trivially easy to just execute
useful shell commands.</p>
<p>Why use Ansible versus something else? (Puppet, Chef, Fabric, Capistrano,
mCollective, Func, SaltStack, etc?) Ansible will have far less code, it
will be (by extension) more correct, and it will be the easiest thing to hack on and
use you&#8217;ll ever see &#8211; regardless of your favorite language of choice.</p>
<p>Systems management doesn&#8217;t have to be complicated. Ansible&#8217;s docs will remain
short &amp; simple, and the source will be blindingly obvious.</p>
<a class="reference external image-reference" href="http://photos.michaeldehaan.net/infrared/h3d850bdf#h3d850bdf"><img alt="http://mpdehaan.zenfolio.com" src="http://ansible.github.com/html/mpd_rings.jpg" style="width: 400px; height: 300px;" /></a>
<div class="section" id="introducing-ansible">
<h1>Introducing Ansible<a class="headerlink" href="#introducing-ansible" title="Permalink to this headline"></a></h1>
<p>Ansible is a radically simple deployment, configuration, and command
execution framework. Other tools in this space have been too
complicated for too long, require too much bootstrapping, and have too
much learning curve. Ansible is dead simple and painless to extend.
For comparison, Puppet and Chef have about 60k lines of code.
Ansible&#8217;s core is a little over 1000 lines.</p>
<p>Ansible isn&#8217;t just for configuration &#8211; it&#8217;s also great for Ad-Hoc
tasks, quickly firing off commands against nodes. Where Ansible
excels though, is expressing complex multi-node deployment processes,
executing complex sequences of commands on different hosts through
<a class="reference internal" href="playbooks.html"><em>Playbooks</em></a>.</p>
<p>Extending ansible does not require programming in any particular
language &#8211; you can write modules as scripts or programs that return
simple JSON. It&#8217;s also trivially easy to just execute useful shell
commands.</p>
<p>Why use Ansible versus something else? (Puppet, Chef, Fabric,
Capistrano, mCollective, Func, SaltStack, etc?) Ansible will have far
less code, it will be (by extension) more correct, and it will be the
easiest thing to hack on and use you&#8217;ll ever see &#8211; regardless of your
favorite language of choice.</p>
<p>Systems management doesn&#8217;t have to be complicated. Ansible&#8217;s docs
will remain short &amp; simple, and the source will be blindingly obvious.</p>
<div class="section" id="design-goals">
<h2>Design Goals<a class="headerlink" href="#design-goals" title="Permalink to this headline"></a></h2>
<ul class="simple">
@ -178,7 +187,8 @@ short &amp; simple, and the source will be blindingly obvious.</p>
</div>
<div class="section" id="communicate-and-get-involved">
<h2>Communicate and Get Involved<a class="headerlink" href="#communicate-and-get-involved" title="Permalink to this headline"></a></h2>
<p>Your ideas and contributions are welcome. We&#8217;re also happy to help you with questions about Ansible.</p>
<p>Your ideas and contributions are welcome. We&#8217;re also happy to help
you with questions about Ansible.</p>
<ul class="simple">
<li>Join the <a class="reference external" href="http://groups.google.com/group/ansible-project">ansible-project mailing list</a> on Google Groups</li>
<li>Join <a class="reference external" href="irc://irc.freenode.net/#ansible">#ansible</a> on the <a class="reference external" href="http://freenode.net/">freenode IRC network</a></li>
@ -260,13 +270,16 @@ short &amp; simple, and the source will be blindingly obvious.</p>
</div>
<div class="section" id="about-the-author">
<h2>About the Author<a class="headerlink" href="#about-the-author" title="Permalink to this headline"></a></h2>
<p>Ansible was originally developed by Michael DeHaan, a Raleigh, NC based software developer and architect.
He created other popular DevOps programs such as Cobbler, the popular Linux install server.
Cobbler is used to deploy mission critical systems all over the planet, in industries
ranging from massively multiplayer gaming, core internet infrastructure, finance,
chip design, and more. Michael also helped co-author of Func, a precursor to Ansible, which is used
to orchestrate systems in lots of diverse places. He&#8217;s worked on systems software for
IBM, Motorola, Red Hat&#8217;s Emerging Technologies Group, Puppet Labs, and rPath.</p>
<p>Ansible was originally developed by Michael DeHaan, a Raleigh, NC
based software developer and architect. He created other popular
DevOps programs such as Cobbler, the popular Linux install server.
Cobbler is used to deploy mission critical systems all over the
planet, in industries ranging from massively multiplayer gaming, core
internet infrastructure, finance, chip design, and more. Michael also
helped co-author of Func, a precursor to Ansible, which is used to
orchestrate systems in lots of diverse places. He&#8217;s worked on systems
software for IBM, Motorola, Red Hat&#8217;s Emerging Technologies Group,
Puppet Labs, and rPath.</p>
</div>
</div>
@ -278,7 +291,7 @@ IBM, Motorola, Red Hat&#8217;s Emerging Technologies Group, Puppet Labs, and rPa
<p>
&copy; Copyright 2012 Michael DeHaan.<br/>
Last updated on Mar 09, 2012.<br/>
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.7.<br/>
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.8.<br/>
</p>
</div>
</footer>

View file

@ -161,7 +161,7 @@
<p>
&copy; Copyright 2012 Michael DeHaan.<br/>
Last updated on Mar 09, 2012.<br/>
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.7.<br/>
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.8.<br/>
</p>
</div>
</footer>

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>ansible-modules</title><link rel="stylesheet" type="text/css" href="./docbook-xsl.css" /><meta name="generator" content="DocBook XSL Stylesheets V1.76.1" /></head><body><div xml:lang="en" class="refentry" title="ansible-modules" lang="en"><a id="id475130"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>ansible-modules — stock modules shipped with ansible</p></div><div class="refsect1" title="DESCRIPTION"><a id="_description"></a><h2>DESCRIPTION</h2><p>Ansible ships with a number of modules that can be executed directly on remote hosts or through
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>ansible-modules</title><link rel="stylesheet" href="./docbook-xsl.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.75.2" /></head><body><div xml:lang="en" class="refentry" title="ansible-modules" lang="en"><a id="id510561"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>ansible-modules — stock modules shipped with ansible</p></div><div class="refsect1" title="DESCRIPTION"><a id="_description"></a><h2>DESCRIPTION</h2><p>Ansible ships with a number of modules that can be executed directly on remote hosts or through
ansible playbooks.</p></div><div class="refsect1" title="IDEMPOTENCE"><a id="_idempotence"></a><h2>IDEMPOTENCE</h2><p>Most modules other than command are idempotent, meaning they will seek to avoid changes
unless a change needs to be made. When using ansible playbooks, these modules can
trigger change events, as described in <span class="strong"><strong>ansible-playbooks</strong></span>(5).</p><p>Unless otherwise noted, all modules support change hooks.</p></div><div class="refsect1" title="command"><a id="_command"></a><h2>command</h2><p>The command module takes the command name followed by a list of arguments, space delimited.

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>ansible-modules</title><link rel="stylesheet" type="text/css" href="./docbook-xsl.css" /><meta name="generator" content="DocBook XSL Stylesheets V1.76.1" /></head><body><div xml:lang="en" class="refentry" title="ansible-modules" lang="en"><a id="id507830"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>ansible-playbook — format and function of an ansible playbook file</p></div><div class="refsect1" title="DESCRIPTION"><a id="_description"></a><h2>DESCRIPTION</h2><p>Ansible ships with <span class="emphasis"><em>ansible-playbook</em></span>, a tool for running playbooks.
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>ansible-modules</title><link rel="stylesheet" href="./docbook-xsl.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.75.2" /></head><body><div xml:lang="en" class="refentry" title="ansible-modules" lang="en"><a id="id395532"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>ansible-playbook — format and function of an ansible playbook file</p></div><div class="refsect1" title="DESCRIPTION"><a id="_description"></a><h2>DESCRIPTION</h2><p>Ansible ships with <span class="emphasis"><em>ansible-playbook</em></span>, a tool for running playbooks.
Playbooks can represent frequent tasks, desired system configurations,
or deployment processes.</p></div><div class="refsect1" title="FORMAT"><a id="_format"></a><h2>FORMAT</h2><p>Playbooks are written in YAML.</p></div><div class="refsect1" title="EXAMPLE"><a id="_example"></a><h2>EXAMPLE</h2><p>See:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
<a class="ulink" href="https://github.com/mpdehaan/ansible/blob/master/examples/playbook.yml" target="_top">https://github.com/mpdehaan/ansible/blob/master/examples/playbook.yml</a>

View file

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

View file

@ -156,8 +156,8 @@
<div class="section" id="ansible-modules">
<h1>Ansible Modules<a class="headerlink" href="#ansible-modules" title="Permalink to this headline"></a></h1>
<p>Ansible ships with a number of modules that can be executed directly on remote hosts or through
ansible playbooks.</p>
<p>Ansible ships with a number of modules that can be executed directly
on remote hosts or through ansible playbooks.</p>
<div class="admonition-see-also admonition seealso">
<p class="first admonition-title">See also</p>
<dl class="last docutils">
@ -169,131 +169,165 @@ ansible playbooks.</p>
<dd>Examples of using modules with the Python API</dd>
</dl>
</div>
<p>Nearly all modules take key=value parameters. Some modules take no parameters, and the command
module just takes arguments for the command you want to run.</p>
<p>All modules return JSON format data, thoug if you are using the command line or playbooks, you
don&#8217;t really need to know much about that.</p>
<p>Most modules other than command are idempotent, meaning they will seek to avoid changes
unless a change needs to be made. When using ansible playbooks, these modules can
trigger change events. Unless otherwise noted, all modules support change hooks.</p>
<p>Nearly all modules take <tt class="docutils literal"><span class="pre">key=value</span></tt> parameters. Some modules take
no parameters, and the command module just takes arguments for the
command you want to run.</p>
<p>All modules return JSON format data, though if you are using the
command line or playbooks, you don&#8217;t really need to know much about
that.</p>
<p>Most modules other than command are idempotent, meaning they will seek
to avoid changes unless a change needs to be made. When using ansible
playbooks, these modules can trigger change events. Unless otherwise
noted, all modules support change hooks.</p>
<p>Stock modules:</p>
<div class="section" id="command">
<h2>command<a class="headerlink" href="#command" title="Permalink to this headline"></a></h2>
<p>The command module takes the command name followed by a list of arguments, space delimited.
This is the only module that does not use key=value style parameters.</p>
<span id="id1"></span><h2>command<a class="headerlink" href="#command" title="Permalink to this headline"></a></h2>
<p>The command module takes the command name followed by a list of
arguments, space delimited. This is the only module that does not use
<tt class="docutils literal"><span class="pre">key=value</span></tt> style parameters.</p>
<p>Example usage:</p>
<div class="highlight-python"><pre>/sbin/shutdown -t now</pre>
</div>
<p>The given shell command will be executed on all selected nodes.</p>
<p>This module does not support change hooks and returns the return code from the program as well as timing information about how long the command was running for.</p>
<p>This module does not support change hooks and returns the return code
from the program as well as timing information about how long the
command was running for.</p>
</div>
<div class="section" id="copy">
<h2>copy<a class="headerlink" href="#copy" title="Permalink to this headline"></a></h2>
<span id="id2"></span><h2>copy<a class="headerlink" href="#copy" title="Permalink to this headline"></a></h2>
<p>The copy module moves a file on the local box to remote locations.</p>
<p><em>src</em>:</p>
<p>Local path to a file to copy to the remote server. This can be an absolute or relative path.</p>
<ul class="simple">
<li>Local path to a file to copy to the remote server. This can be an
absolute or relative path.</li>
</ul>
<p><em>dest</em>:</p>
<p>Remote absolute path where the file should end up.</p>
<ul class="simple">
<li>Remote absolute path where the file should end up.</li>
</ul>
<p>This module also returns md5sum information about the resultant file.</p>
</div>
<div class="section" id="facter">
<h2>facter<a class="headerlink" href="#facter" title="Permalink to this headline"></a></h2>
<span id="id3"></span><h2>facter<a class="headerlink" href="#facter" title="Permalink to this headline"></a></h2>
<p>Runs the discovery program &#8216;facter&#8217; on the remote system, returning
JSON data that can be useful for inventory purposes.</p>
<p>Requires that &#8216;facter&#8217; and &#8216;ruby-json&#8217; be installed on the remote end.</p>
<p>This module is informative only - it takes no parameters &amp; does not support change hooks,
nor does it make any changes on the system. Playbooks do not actually use
this module, they use the &#8216;setup&#8217; module behind the scenes.</p>
<p>This module is informative only - it takes no parameters &amp; does not
support change hooks, nor does it make any changes on the system.
Playbooks do not actually use this module, they use the <a class="reference internal" href="#setup"><em>setup</em></a>
module behind the scenes.</p>
</div>
<div class="section" id="git">
<h2>git<a class="headerlink" href="#git" title="Permalink to this headline"></a></h2>
<p>Deploys software (or files) from git checkouts.</p>
<p><em>repo</em>:</p>
<p>git or http protocol address of the repo to checkout</p>
<ul class="simple">
<li>git or http protocol address of the repo to checkout.</li>
</ul>
<p><em>dest</em>:</p>
<p>where to check it out, an absolute directory path</p>
<ul class="simple">
<li>Where to check it out, an absolute directory path.</li>
</ul>
<p><em>version</em>:</p>
<p>what version to check out &#8211; either the git SHA, the literal string &#8216;HEAD&#8217;, or a tag name</p>
<ul class="simple">
<li>What version to check out &#8211; either the git SHA, the literal string
<tt class="docutils literal"><span class="pre">HEAD</span></tt>, or a tag name.</li>
</ul>
</div>
<div class="section" id="ohai">
<h2>ohai<a class="headerlink" href="#ohai" title="Permalink to this headline"></a></h2>
<p>Similar to the facter module, this returns JSON inventory data. Ohai
data is a bit more verbose and nested than facter.</p>
<p>Similar to the <a class="reference internal" href="#facter"><em>facter</em></a> module, this returns JSON inventory data.
Ohai data is a bit more verbose and nested than facter.</p>
<p>Requires that &#8216;ohai&#8217; be installed on the remote end.</p>
<p>This module is information only - it takes no parameters &amp; does not
support change hooks, nor does it make any changes on the system.</p>
<p>Playbooks should not call the ohai module, playbooks call the &#8216;setup&#8217;
module behind the scenes instead.</p>
<p>Playbooks should not call the ohai module, playbooks call the
<a class="reference internal" href="#setup"><em>setup</em></a> module behind the scenes instead.</p>
</div>
<div class="section" id="ping">
<h2>ping<a class="headerlink" href="#ping" title="Permalink to this headline"></a></h2>
<p>A trivial test module, this module always returns the integer &#8216;1&#8217; on
<p>A trivial test module, this module always returns the integer <tt class="docutils literal"><span class="pre">1</span></tt> on
successful contact.</p>
<p>This module does not support change hooks and is informative only - it takes no parameters &amp; does not
support change hooks, nor does it make any changes on the system.</p>
<p>This module does not support change hooks and is informative only - it
takes no parameters &amp; does not support change hooks, nor does it make
any changes on the system.</p>
</div>
<div class="section" id="service">
<h2>service<a class="headerlink" href="#service" title="Permalink to this headline"></a></h2>
<p>Controls services on remote machines.</p>
<p><em>state</em></p>
<p>Values are &#8216;started&#8217;, &#8216;stopped&#8217;, or &#8216;restarted&#8217;. Started/stopped
are idempotent actions that will not run commands unless neccessary.
&#8216;restarted&#8217; will always bounce the service</p>
<p><em>name</em></p>
<p>The name of the service</p>
<p><em>state</em>:</p>
<ul class="simple">
<li>Values are <tt class="docutils literal"><span class="pre">started</span></tt>, <tt class="docutils literal"><span class="pre">stopped</span></tt>, or <tt class="docutils literal"><span class="pre">restarted</span></tt>.
Started/stopped are idempotent actions that will not run commands
unless necessary. <tt class="docutils literal"><span class="pre">restarted</span></tt> will always bounce the service.</li>
</ul>
<p><em>name</em>:</p>
<ul class="simple">
<li>The name of the service.</li>
</ul>
</div>
<div class="section" id="setup">
<h2>setup<a class="headerlink" href="#setup" title="Permalink to this headline"></a></h2>
<span id="id4"></span><h2>setup<a class="headerlink" href="#setup" title="Permalink to this headline"></a></h2>
<p>Writes a JSON file containing key/value data, for use in templating.
Call this once before using the template modules. Playbooks will
execute this module automatically as the first step in each play using
the variables section, so it is unneccessary to make explicit calls to
setup within a playbook.</p>
<p>If facter or ohai are installed, variables from these programs will also
be snapshotted into the JSON file for usage in templating. These variables
are prefixed with &#8216;<a class="reference internal" href="#facter">facter</a>&#8216; and &#8216;<a class="reference internal" href="#ohai">ohai</a>&#8221; so it&#8217;s easy to tell their source.
All variables are then bubbled up to the caller.</p>
<p><em>anything</em></p>
<p>any other parameters can be named basically anything, and set a key=value
pair in the JSON file for use in templating.</p>
Call this once before using the <a class="reference internal" href="#template"><em>template</em></a> module. Playbooks
will execute this module automatically as the first step in each play
using the variables section, so it is unnecessary to make explicit
calls to setup within a playbook.</p>
<p>If facter or ohai are installed, variables from these programs will
also be snapshotted into the JSON file for usage in templating. These
variables are prefixed with <tt class="docutils literal"><span class="pre">facter_</span></tt> and <tt class="docutils literal"><span class="pre">ohai_</span></tt> so it&#8217;s easy to
tell their source. All variables are then bubbled up to the caller.</p>
<p><em>anything</em>:</p>
<blockquote>
<div><ul class="simple">
<li>Any other parameters can be named basically anything, and set a
<tt class="docutils literal"><span class="pre">key=value</span></tt> pair in the JSON file for use in templating.</li>
</ul>
</div></blockquote>
</div>
<div class="section" id="template">
<h2>template<a class="headerlink" href="#template" title="Permalink to this headline"></a></h2>
<p>Templates a file out to a remote server. Call the setup module prior to usage.</p>
<p><em>src</em></p>
<p>path of a Jinja2 formatted template on the local server. This can be a relative
or absolute path.</p>
<p><em>dest</em></p>
<p>location to render the template on the remote server</p>
<span id="id5"></span><h2>template<a class="headerlink" href="#template" title="Permalink to this headline"></a></h2>
<p>Templates a file out to a remote server. Call the <a class="reference internal" href="#setup"><em>setup</em></a> module
prior to usage.</p>
<p><em>src</em>:</p>
<ul class="simple">
<li>Path of a Jinja2 formatted template on the local server. This can
be a relative or absolute path.</li>
</ul>
<p><em>dest</em>:</p>
<ul class="simple">
<li>Location to render the template on the remote server.</li>
</ul>
<p>This module also returns md5sum information about the resultant file.</p>
</div>
<div class="section" id="writing-your-own-modules">
<h2>Writing your own modules<a class="headerlink" href="#writing-your-own-modules" title="Permalink to this headline"></a></h2>
<p>To write your own modules, simply follow the convention of those already available in
/usr/share/ansible. Modules must return JSON but can be written in any language.
Modules should return hashes, but hashes can be nested.</p>
<p>To support change hooks, modules should return hashes with a changed: True/False
element at the top level:</p>
<p>To write your own modules, simply follow the convention of those
already available in /usr/share/ansible. Modules must return JSON but
can be written in any language. Modules should return hashes, but
hashes can be nested.</p>
<p>To support change hooks, modules should return hashes with a changed:
True/False element at the top level:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="p">{</span>
<span class="s">&#39;changed&#39;</span> <span class="p">:</span> <span class="bp">True</span><span class="p">,</span>
<span class="s">&#39;something&#39;</span> <span class="p">:</span> <span class="mi">42</span>
<span class="p">}</span>
</pre></div>
</div>
<p>Modules can also choose to indicate a failure scenario by returning a top level &#8216;failure&#8217;
element with a True value, and a &#8216;msg&#8217; element describing the nature of the failure.
Other return values are up to the module.</p>
<blockquote>
<div><dl class="docutils">
<dt>{</dt>
<dd>&#8216;failure&#8217; : True,
&#8216;msg&#8217; : &#8220;here is what happened...&#8221;</dd>
</dl>
<p>}</p>
</div></blockquote>
<p>When shipping modules, drop them in /usr/share/ansible, or specify the module path to the
command line tool or API. It is easy to test modules by running them directly on
the command line, passing them arguments just like they would be passed with ansible.</p>
<p>Modules can also choose to indicate a failure scenario by returning a
top level <tt class="docutils literal"><span class="pre">failure</span></tt> element with a True value, and a <tt class="docutils literal"><span class="pre">msg</span></tt> element
describing the nature of the failure. Other return values are up to
the module:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="p">{</span>
<span class="s">&#39;failure&#39;</span> <span class="p">:</span> <span class="bp">True</span><span class="p">,</span>
<span class="s">&#39;msg&#39;</span> <span class="p">:</span> <span class="s">&quot;here is what happened...&quot;</span>
<span class="p">}</span>
</pre></div>
</div>
<p>When shipping modules, drop them in /usr/share/ansible, or specify the
module path to the command line tool or API. It is easy to test
modules by running them directly on the command line, passing them
arguments just like they would be passed with ansible.</p>
</div>
</div>
@ -305,7 +339,7 @@ the command line, passing them arguments just like they would be passed with ans
<p>
&copy; Copyright 2012 Michael DeHaan.<br/>
Last updated on Mar 09, 2012.<br/>
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.7.<br/>
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.8.<br/>
</p>
</div>
</footer>

BIN
html/mpd_rings.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

View file

@ -159,10 +159,11 @@
</dl>
</div>
<div class="section" id="inventory-file-format">
<h2>Inventory File Format<a class="headerlink" href="#inventory-file-format" title="Permalink to this headline"></a></h2>
<span id="inventoryformat"></span><h2>Inventory File Format<a class="headerlink" href="#inventory-file-format" title="Permalink to this headline"></a></h2>
<p>Ansible works against multiple systems in your infrastructure at the
same time. It does this by selecting portions of systems listed in Ansible&#8217;s inventory file,
which defaults to /etc/ansible/hosts, and looks like this:</p>
same time. It does this by selecting portions of systems listed in
Ansible&#8217;s inventory file, which defaults to /etc/ansible/hosts, 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>
<span class="p">[</span><span class="n">webservers</span><span class="p">]</span>
@ -199,7 +200,10 @@ wildcards:</p>
<p>It&#8217;s also ok to mix wildcard patterns and groups at the same time:</p>
<div class="highlight-python"><pre>one*.com:dbservers</pre>
</div>
<p>NOTE: It is not possible to target a host not in the inventory file.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">It is not possible to target a host not in the inventory file.</p>
</div>
</div>
</div>
@ -211,7 +215,7 @@ wildcards:</p>
<p>
&copy; Copyright 2012 Michael DeHaan.<br/>
Last updated on Mar 09, 2012.<br/>
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.7.<br/>
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.8.<br/>
</p>
</div>
</footer>

View file

@ -206,7 +206,7 @@ server group, then more commands back on the webservers group, etc:</p>
<div class="section" id="hosts-line">
<h2>Hosts line<a class="headerlink" href="#hosts-line" title="Permalink to this headline"></a></h2>
<p>The hosts line is a list of one or more groups or host patterns,
seperated by colons, as described in the <a class="reference internal" href="patterns.html#patterns"><em>The Inventory File, Patterns, and Groups</em></a>
separated by colons, as described in the <a class="reference internal" href="patterns.html#patterns"><em>The Inventory File, Patterns, and Groups</em></a>
documentation. This is just like the first parameter to
<cite>/usr/bin/ansible</cite>.</p>
</div>
@ -215,8 +215,7 @@ documentation. This is just like the first parameter to
<p>A list of variables and values that can be used in the plays. These
can be used in templates or &#8216;action&#8217; lines and are dereferenced using
<cite>jinja2</cite> syntax like this:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="p">{{</span> <span class="n">varname</span> <span class="p">}}</span>
</pre></div>
<div class="highlight-python"><pre>{{ varname }}</pre>
</div>
<p>Further, if there are discovered variables about the system (say, if
facter or ohai were installed) these variables bubble up back into the
@ -235,7 +234,7 @@ to write the hostname into the /etc/motd file, I could say:</p>
<div class="section" id="tasks-list">
<h2>Tasks list<a class="headerlink" href="#tasks-list" title="Permalink to this headline"></a></h2>
<p>Each play contains a list of tasks. Tasks are executed in order, one
at a time, against all machines matched by the play&#8217;s host pattern,
at a time, against all machines matched by the playbooks host pattern,
before moving on to the next task.</p>
<p>Hosts with failed tasks are taken out of the rotation for the entire
playbook. If things fail, simply correct the playbook file and rerun.</p>
@ -285,8 +284,7 @@ of the tasks complete in a particular play.</p>
file can contain a list of tasks (in YAML) as well, optionally passing
extra variables into the file. Variables passed in can be deferenced
like this (assume a variable named &#8216;user&#8217;):</p>
<div class="highlight-python"><div class="highlight"><pre><span class="p">{{</span> <span class="n">user</span> <span class="p">}}</span>
</pre></div>
<div class="highlight-python"><pre>{{ user }}</pre>
</div>
<p>For instance, if deploying multiple wordpress instances, I could
contain all of my tasks in a wordpress.yml file, and use it like so:</p>
@ -312,8 +310,12 @@ like:</p>
do in the main file. Including a variable in the name of a task is a
contrived example, you could also pass them to the action command line
or use them inside a template file.</p>
<p>Note that include statements are only usable from the top level
playbook file. At this time, includes can not include other includes.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">Note that include statements are only usable from the top level
playbook file. At this time, includes can not include other
includes.</p>
</div>
</div>
<div class="section" id="using-includes-to-assign-classes-of-systems">
<h2>Using Includes To Assign Classes of Systems<a class="headerlink" href="#using-includes-to-assign-classes-of-systems" title="Permalink to this headline"></a></h2>
@ -367,7 +369,7 @@ from the configuration file to generate machine specific variables.</p>
<p>
&copy; Copyright 2012 Michael DeHaan.<br/>
Last updated on Mar 09, 2012.<br/>
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.7.<br/>
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.8.<br/>
</p>
</div>
</footer>

View file

@ -165,7 +165,7 @@
<p>
&copy; Copyright 2012 Michael DeHaan.<br/>
Last updated on Mar 09, 2012.<br/>
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.7.<br/>
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.8.<br/>
</p>
</div>
</footer>

File diff suppressed because one or more lines are too long

View file

@ -1,9 +1,11 @@
.. Director documentation master file, created by sphinx-quickstart on Sat Sep 27 13:23:22 2008.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
.. image:: http://ansible.github.com/html/mpd_rings.jpg
:height: 300
:width: 400
:alt: http://mpdehaan.zenfolio.com
:target: http://photos.michaeldehaan.net/infrared/h3d850bdf#h3d850bdf
Ansible
=======
Introducing Ansible
===================
Ansible is a radically simple deployment, configuration, and command
execution framework. Other tools in this space have been too