Fix patterns typo, rebuild

pull/1256/head
Michael DeHaan 12 years ago
parent 8fa2070074
commit 826c71fcb1

@ -268,7 +268,7 @@ languages:
<p>
<p>
&copy; Copyright 2012 Michael DeHaan.<br/>
Last updated on Sep 28, 2012.<br/>
Last updated on Oct 03, 2012.<br/>
</p>
</div>
</footer>

@ -483,7 +483,7 @@ directory.</p>
<p>
<p>
&copy; Copyright 2012 Michael DeHaan.<br/>
Last updated on Sep 28, 2012.<br/>
Last updated on Oct 03, 2012.<br/>
</p>
</div>
</footer>

@ -327,7 +327,7 @@ different variables to different geographies.</p>
<p>
<p>
&copy; Copyright 2012 Michael DeHaan.<br/>
Last updated on Sep 28, 2012.<br/>
Last updated on Oct 03, 2012.<br/>
</p>
</div>
</footer>

@ -446,7 +446,7 @@ the first config file it finds present:</p>
<p>
<p>
&copy; Copyright 2012 Michael DeHaan.<br/>
Last updated on Sep 28, 2012.<br/>
Last updated on Oct 03, 2012.<br/>
</p>
</div>
</footer>

@ -185,7 +185,7 @@ s.parentNode.insertBefore(ga, s);
<p>
<p>
&copy; Copyright 2012 Michael DeHaan.<br/>
Last updated on Sep 28, 2012.<br/>
Last updated on Oct 03, 2012.<br/>
</p>
</div>
</footer>

@ -403,7 +403,7 @@ explore, but you already have a fully working infrastructure!</p>
<p>
<p>
&copy; Copyright 2012 Michael DeHaan.<br/>
Last updated on Sep 28, 2012.<br/>
Last updated on Oct 03, 2012.<br/>
</p>
</div>
</footer>

@ -200,7 +200,7 @@ s.parentNode.insertBefore(ga, s);
<p>
<p>
&copy; Copyright 2012 Michael DeHaan.<br/>
Last updated on Sep 28, 2012.<br/>
Last updated on Oct 03, 2012.<br/>
</p>
</div>
</footer>

@ -507,7 +507,7 @@ the program. Stop by the mailing list to inquire about requirements.</p>
<p>
<p>
&copy; Copyright 2012 Michael DeHaan.<br/>
Last updated on Sep 28, 2012.<br/>
Last updated on Oct 03, 2012.<br/>
</p>
</div>
</footer>

File diff suppressed because it is too large Load Diff

@ -223,9 +223,9 @@ but they are useful.</p>
after the hostname with a colon.</p>
<blockquote>
<div>four.example.com:5309</div></blockquote>
<p>In 0.6 and later, if you have a lot of hosts following similar patterns you can do this:</p>
<p>In 0.6 and later, if you have a lot of hosts following similar patterns you can do this rather than listing each hostname:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="p">[</span><span class="n">webservers</span><span class="p">]</span>
<span class="n">www</span><span class="p">[</span><span class="mo">01</span><span class="o">-</span><span class="mi">50</span><span class="p">]</span><span class="o">.</span><span class="n">example</span><span class="o">.</span><span class="n">com</span>
<span class="n">www</span><span class="p">[</span><span class="mo">01</span><span class="p">:</span><span class="mi">50</span><span class="p">]</span><span class="o">.</span><span class="n">example</span><span class="o">.</span><span class="n">com</span>
</pre></div>
</div>
<p>Leading zeros can be included or removed, as desired, and the ranges are inclusive.</p>
@ -386,7 +386,7 @@ Ansible 0.7. Ansible 0.6 includes a <a class="reference external" href="https:/
<p>
<p>
&copy; Copyright 2012 Michael DeHaan.<br/>
Last updated on Sep 28, 2012.<br/>
Last updated on Oct 03, 2012.<br/>
</p>
</div>
</footer>

@ -559,7 +559,7 @@ can do this:</p>
<p>
<p>
&copy; Copyright 2012 Michael DeHaan.<br/>
Last updated on Sep 28, 2012.<br/>
Last updated on Oct 03, 2012.<br/>
</p>
</div>
</footer>

@ -733,7 +733,7 @@ place to set such a default is in a group variable.</p>
<p>
<p>
&copy; Copyright 2012 Michael DeHaan.<br/>
Last updated on Sep 28, 2012.<br/>
Last updated on Oct 03, 2012.<br/>
</p>
</div>
</footer>

@ -1,36 +1,92 @@
.. _apt:
apt
```
Manages apt-packages (such as for Debian/Ubuntu).
+--------------------+----------+---------+----------------------------------------------------------------------------+
| parameter | required | default | comments |
+====================+==========+=========+============================================================================+
| name | no | | A package name or package specifier with version, like `foo` or `foo=1.0` |
+--------------------+----------+---------+----------------------------------------------------------------------------+
| state | no | present | 'absent', 'present', or 'latest'. |
+--------------------+----------+---------+----------------------------------------------------------------------------+
| update_cache | no | no | Run the equivalent of apt-get update before the operation. |
| | | | Can be run as part of the package installation or a seperate step |
+--------------------+----------+---------+----------------------------------------------------------------------------+
| purge | no | no | Will forge purge of configuration files if state is set to 'absent'. |
+--------------------+----------+---------+----------------------------------------------------------------------------+
| default_release | no | | Corresponds to the -t option for apt and sets pin priorities |
+--------------------+----------+---------+----------------------------------------------------------------------------+
| install_recommends | no | yes | Corresponds to the --no-install-recommends option for apt, default |
| | | | behavior works as apt's default behavior, 'no' does not install |
| | | | recommended packages. Suggested packages are never installed. |
+--------------------+----------+---------+----------------------------------------------------------------------------+
| force | no | no | If 'yes', force installs/removes. |
+--------------------+----------+---------+----------------------------------------------------------------------------+
Example action from Ansible :doc:`playbooks`::
``````````````````````````````
.. versionadded:: 0.0.2
Manages apt-packages (such as for Debian/Ubuntu).
.. raw:: html
<table>
<tr>
<th class="head">parameter</th>
<th class="head">required</th>
<th class="head">default</th>
<th class="head">choices</th>
<th class="head">comments</th>
</tr>
<tr>
<td>purge</td>
<td>no</td>
<td>no</td>
<td><ul><li>yes</li><li>no</li></ul></td>
<td>Will force purging of configuration files if the module state is set to <code>absent</code>.</td>
</tr>
<tr>
<td>state</td>
<td>no</td>
<td>present</td>
<td><ul><li>installed</li><li>latest</li><li>remove</li><li>absent</li><li>present</li></ul></td>
<td>Indicates the desired package state</td>
</tr>
<tr>
<td>force</td>
<td>no</td>
<td>no</td>
<td><ul><li>yes</li><li>no</li></ul></td>
<td>If <code>yes</code>, force installs/removes.</td>
</tr>
<tr>
<td>pkg</td>
<td>yes</td>
<td></td>
<td><ul></ul></td>
<td>A package name or package specifier with version, like <code>foo</code> or <code>foo=1.0</code></td>
</tr>
<tr>
<td>update_cache</td>
<td>no</td>
<td>no</td>
<td><ul><li>yes</li><li>no</li></ul></td>
<td>Run the equivalent of <code>apt-get update</code> before the operation. Can be run as part of the package installation or as a seperate step</td>
</tr>
<tr>
<td>default_release</td>
<td>no</td>
<td></td>
<td><ul></ul></td>
<td>Corresponds to the <code>-t</code> option for <em>apt</em> and sets pin priorities</td>
</tr>
<tr>
<td>install_recommends</td>
<td>no</td>
<td>no</td>
<td><ul><li>yes</li><li>no</li></ul></td>
<td>Corresponds to the <code>--no-install-recommends</code> option for <em>apt</em>, default behavior works as apt's default behavior, <code>no</code> does not install recommended packages. Suggested packages are never installed.</td>
</tr>
</table>
.. raw:: html
<p>Update repositories cache and install <code>foo</code> package</p> <p><pre>
apt pkg=foo update-cache=yes
</pre></p>
<p>Remove <code>foo</code> package</p> <p><pre>
apt pkg=foo state=removed
</pre></p>
<p>Install the the package <code>foo</code></p> <p><pre>
apt pkg=foo state=installed
</pre></p>
<p>Install the version '1.00' of package <code>foo</code></p> <p><pre>
apt pkg=foo=1.00 state=installed
</pre></p>
<p>Update the repository cache and update package <code>ngnix</code> to latest version using default release <code>squeeze-backport</code></p> <p><pre>
apt pkg=nginx state=latest default-release=squeeze-backports update-cache=yes
</pre></p>
<p>Install latest version of <code>openjdk-6-jdk</code> ignoring <code>install-recomands</code></p> <p><pre>
apt pkg=openjdk-6-jdk state=latest install-recommends=no
</pre></p>
<br/>

@ -1,21 +1,51 @@
.. _apt_repository:
apt_repository
``````````````
``````````````````````````````
.. versionadded:: 0.7
Manages apt repositores
Manages apt repositores (such as for Debian/Ubuntu).
+--------------------+----------+---------+----------------------------------------------------------------------------+
| parameter | required | default | comments |
+====================+==========+=========+============================================================================+
| repo | yes | | The repository name/value |
+--------------------+----------+---------+----------------------------------------------------------------------------+
| state | no | present | 'absent' or 'present' |
+--------------------+----------+---------+----------------------------------------------------------------------------+
.. raw:: html
Example action from Ansible :doc:`playbooks`::
<table>
<tr>
<th class="head">parameter</th>
<th class="head">required</th>
<th class="head">default</th>
<th class="head">choices</th>
<th class="head">comments</th>
</tr>
<tr>
<td>repo</td>
<td>yes</td>
<td></td>
<td><ul></ul></td>
<td>The repository name/value</td>
</tr>
<tr>
<td>state</td>
<td>no</td>
<td>present</td>
<td><ul><li>present</li><li>absent</li></ul></td>
<td>The repository state</td>
</tr>
</table>
apt_repository repo=ppa:nginx/stable
.. raw:: html
<p>Add nginx stable repository from PPA</p> <p><pre>
apt_repository repo=ppa://nginx/stable
</pre></p>
<p>Add specified repository into sources.</p> <p><pre>
apt_repository repo='deb http://archive.canonical.com/ubuntu hardy partner'
</pre></p>
<br/>
.. raw:: html
<h4>Notes</h4>
<p>This module works on Debian and Ubuntu only and requires <code>apt-add-repository</code> be available on destination server. To ensure this package is available use the <code>apt</code> module and install the <code>python-software-properties</code> package before using this module.</p>
<p>A bug in <code>apt-add-repository</code> always adds <code>deb</code> and <code>deb-src</code> types for repositories (see the issue on Launchpad <a href='https://bugs.launchpad.net/ubuntu/+source/software-properties/+bug/987264'>https://bugs.launchpad.net/ubuntu/+source/software-properties/+bug/987264</a>), if a repo doesn't have source information (eg MongoDB repo from 10gen) the system will fail while updating repositories.</p>

@ -1,31 +1,56 @@
.. _assemble:
assemble
````````
``````````````````````````````
.. versionadded:: 0.5
Assembles a configuration file from fragments. Often a particular
program will take a single configuration file and does not support a
conf.d style structure where it is easy to build up the configuration
from multiple sources. Assemble will take a directory of files that
have already been transferred to the system, and concatenate them
together to produce a destination file. Files are assembled in string
sorting order. Puppet calls this idea "fragments".
+--------------------+----------+---------+----------------------------------------------------------------------------+
| parameter | required | default | comments |
+====================+==========+=========+============================================================================+
| src | yes | | An already existing directory full of source files |
+--------------------+----------+---------+----------------------------------------------------------------------------+
| dest | yes | | A file to create using the concatenation of all of the source files |
+--------------------+----------+---------+----------------------------------------------------------------------------+
| backup | no | no | Create a backup file including the timestamp information so you can |
| | | | get the original file back if you somehow clobbered it incorrectly. |
+--------------------+----------+---------+----------------------------------------------------------------------------+
| OTHERS | | | All arguments that the file module takes may also be used |
+--------------------+----------+---------+----------------------------------------------------------------------------+
Example action from Ansible :doc:`playbooks`::
Assembles a configuration file from fragments. Often a particular program will take a single configuration file and does not support a ``conf.d`` style structure where it is easy to build up the configuration from multiple sources. Assemble will take a directory of files that have already been transferred to the system, and concatenate them together to produce a destination file. Files are assembled in string sorting order. Puppet calls this idea *fragments*.
.. raw:: html
<table>
<tr>
<th class="head">parameter</th>
<th class="head">required</th>
<th class="head">default</th>
<th class="head">choices</th>
<th class="head">comments</th>
</tr>
<tr>
<td>dest</td>
<td>yes</td>
<td></td>
<td><ul></ul></td>
<td>A file to create using the concatenation of all of the source files.</td>
</tr>
<tr>
<td>src</td>
<td>yes</td>
<td></td>
<td><ul></ul></td>
<td>An already existing directory full of source files.</td>
</tr>
<tr>
<td>backup</td>
<td>no</td>
<td>no</td>
<td><ul><li>yes</li><li>no</li></ul></td>
<td>Create a backup file (if <code>yes</code>), including the timestamp information so you can get the original file back if you somehow clobbered it incorrectly.</td>
</tr>
<tr>
<td>others</td>
<td>no</td>
<td></td>
<td><ul></ul></td>
<td>all arguments accepted by the <span class='module'>file</span> module also work here</td>
</tr>
</table>
.. raw:: html
<p>Example from Ansible Playbooks</p> <p><pre>
assemble src=/etc/someapp/fragments dest=/etc/someapp/someapp.conf
</pre></p>
<br/>

@ -0,0 +1,44 @@
.. _async_status:
async_status
``````````````````````````````
.. versionadded:: 0.5
This module gets the status of an asynchronous task. See: http://ansible.cc/docs/playbooks2.html#asynchronous-actions-and-polling
.. raw:: html
<table>
<tr>
<th class="head">parameter</th>
<th class="head">required</th>
<th class="head">default</th>
<th class="head">choices</th>
<th class="head">comments</th>
</tr>
<tr>
<td>jid</td>
<td>yes</td>
<td></td>
<td><ul></ul></td>
<td>Job or task identifier</td>
</tr>
<tr>
<td>mode</td>
<td>no</td>
<td>status</td>
<td><ul><li>status</li><li>cleanup</li></ul></td>
<td>if <code>status</code>, obtain the status; if <code>cleanup</code>, clean up the async job cache located in <code>~/.ansible_async/</code> for the specified job <em>jid</em>.</td>
</tr>
</table>
.. raw:: html
<br/>
.. raw:: html
<h4>Notes</h4>
<p>See <a href='http://ansible.cc/docs/playbooks2.html#asynchronous-actions-and-polling'>http://ansible.cc/docs/playbooks2.html#asynchronous-actions-and-polling</a></p>

@ -1,22 +1,52 @@
.. _authorized_key:
authorized_key
``````````````
``````````````````````````````
.. versionadded:: 0.5
Adds or removes an authorized key for a user from a remote host.
Adds or removes an SSH authorized key for a user from a remote host.
+--------------------+----------+---------+----------------------------------------------------------------------------+
| parameter | required | default | comments |
+====================+==========+=========+============================================================================+
| user | yes | | Name of the user who should have access to the remote host |
+--------------------+----------+---------+----------------------------------------------------------------------------+
| key | yes | | the SSH public key, as a string |
+--------------------+----------+---------+----------------------------------------------------------------------------+
| state | no | present | whether the given key should or should not be in the file |
+--------------------+----------+---------+----------------------------------------------------------------------------+
.. raw:: html
Example action from Ansible :doc:`playbooks`::
<table>
<tr>
<th class="head">parameter</th>
<th class="head">required</th>
<th class="head">default</th>
<th class="head">choices</th>
<th class="head">comments</th>
</tr>
<tr>
<td>state</td>
<td>no</td>
<td>present</td>
<td><ul><li>present</li><li>absent</li></ul></td>
<td>whether the given key should or should not be in the file</td>
</tr>
<tr>
<td>user</td>
<td>yes</td>
<td></td>
<td><ul></ul></td>
<td>Name of the user who should have access to the remote host</td>
</tr>
<tr>
<td>key</td>
<td>yes</td>
<td></td>
<td><ul></ul></td>
<td>the SSH public key, as a string</td>
</tr>
</table>
.. raw:: html
<p>Example from Ansible Playbooks</p> <p><pre>
authorized_key user=charlie key="ssh-dss ASDF1234L+8BTwaRYr/rycsBF1D8e5pTxEsXHQs4iq+mZdyWqlW++L6pMiam1A8yweP+rKtgjK2httVS6GigVsuWWfOd7/sdWippefq74nppVUELHPKkaIOjJNN1zUHFoL/YMwAAAEBALnAsQN10TNGsRDe5arBsW8cTOjqLyYBcIqgPYTZW8zENErFxt7ij3fW3Jh/sCpnmy8rkS7FyK8ULX0PEy/2yDx8/5rXgMIICbRH/XaBy9Ud5bRBFVkEDu/r+rXP33wFPHjWjwvHAtfci1NRBAudQI/98DbcGQw5HmE89CjgZRo5ktkC5yu/8agEPocVjdHyZr7PaHfxZGUDGKtGRL2QzRYukCmWo1cZbMBHcI5FzImvTHS9/8B3SATjXMPgbfBuEeBwuBK5EjL+CtHY5bWs9kmYjmeo0KfUMH8hY4MAXDoKhQ7DhBPIrcjS5jPtoGxIREZjba67r6/P2XKXaCZH6Fc= charlie@example.org 2011-01-17"
</pre></p>
<p>Shorthand available in Ansible 0.8 and later</p> <p><pre>
authorized_key user=charlie key=$FILE(/home/charlie/.ssh/id_rsa.pub)
</pre></p>
<br/>

@ -1,39 +1,64 @@
.. _command:
command
```````
The command module takes the command name followed by a list of
arguments, space delimited.
+--------------------+----------+---------+----------------------------------------------------------------------------+
| parameter | required | default | comments |
+====================+==========+=========+============================================================================+
| (free form) | N/A | N/A | the command module takes a free form command to run |
+--------------------+----------+---------+----------------------------------------------------------------------------+
| creates | no | | a filename, when it already exists, this step will NOT be run |
+--------------------+----------+---------+----------------------------------------------------------------------------+
| chdir | no | | cd into this directory before running the command (0.6 and later) |
+--------------------+----------+---------+----------------------------------------------------------------------------+
The given command will be executed on all selected nodes. It will not
be processed through the shell, so variables like "$HOME" and
operations like "<", ">", "|", and "&" will not work. As such, all
paths to commands must be fully qualified.
.. note::
If you want to run a command through the shell (say you are using
'<', '>', '|', etc), you actually want the 'shell' module instead.
The 'command' module is much more secure as it's not affected by
the user's environment.
Example action from Ansible :doc:`playbooks`::
``````````````````````````````
command /sbin/shutdown -t now
creates and chdir can be specified after the command. For instance, if you only want to run a command if a certain file does not exist, you can do the following::
The command module takes the command name followed by a list of space-delimited arguments.
The given command will be executed on all selected nodes. It will not be processed through the shell, so variables like ``$HOME`` and operations like ``"<"``, ``">"``, ``"|"``, and ``"&"`` will not work. As such, all paths to commands must be fully qualified
.. raw:: html
<table>
<tr>
<th class="head">parameter</th>
<th class="head">required</th>
<th class="head">default</th>
<th class="head">choices</th>
<th class="head">comments</th>
</tr>
<tr>
<td>creates</td>
<td>no</td>
<td></td>
<td><ul></ul></td>
<td>a filename, when it already exists, this step will <b>not</b> be run.</td>
</tr>
<tr>
<td>free_form</td>
<td>yes</td>
<td></td>
<td><ul></ul></td>
<td>the command module takes a free form command to run</td>
</tr>
<tr>
<td>chdir</td>
<td>no</td>
<td></td>
<td><ul></ul></td>
<td>cd into this directory before running the command (added in Ansible 0.6)</td>
</tr>
<tr>
<td>removes</td>
<td>no</td>
<td></td>
<td><ul></ul></td>
<td>a filename, when it does not exist, this step will <b>not</b> be run. (added in Ansible 0.8)</td>
</tr>
</table>
.. raw:: html
<p>Example from Ansible Playbooks</p> <p><pre>
command /sbin/shutdown -t now
</pre></p>
<p><em>creates</em>, <em>removes</em>, and <em>chdir</em> can be specified after the command. For instance, if you only want to run a command if a certain file does not exist, use this.</p> <p><pre>
command /usr/bin/make_database.sh arg1 arg2 creates=/path/to/database
</pre></p>
<br/>
.. raw:: html
The `creates=` and `chdir` options will not be passed to the actual executable.
<h4>Notes</h4>
<p>If you want to run a command through the shell (say you are using <code><</code>, <code>></code>, <code>|</code>, etc), you actually want the <span class='module'>shell</span> module instead. The <span class='module'>command</span> module is much more secure as it's not affected by the user's environment.</p>

@ -1,30 +1,58 @@
.. _copy:
copy
````
The copy module moves a file on the local box to remote locations. In addition to the options
listed below, the arguments available to the `file` module can also be passed to the copy
module.
+--------------------+----------+---------+----------------------------------------------------------------------------+
| parameter | required | default | comments |
+====================+==========+=========+============================================================================+
| src | yes | | Local path to a file to copy to the remote server, can be absolute or |
| | | | relative. |
+--------------------+----------+---------+----------------------------------------------------------------------------+
| dest | yes | | Remote absolute path where the file should end up |
+--------------------+----------+---------+----------------------------------------------------------------------------+
| backup | no | no | Create a backup file including the timestamp information so you can |
| | | | get the original file back if you somehow clobbered it incorrectly. |
+--------------------+----------+---------+----------------------------------------------------------------------------+
| OTHERS | | | All arguments the file module takes are also supported |
+--------------------+----------+---------+----------------------------------------------------------------------------+
Example action from Ansible :doc:`playbooks`::
``````````````````````````````
copy src=/srv/myfiles/foo.conf dest=/etc/foo.conf owner=foo group=foo mode=0644
Copy a new ntp.conf file into place, backing up the original if it differs from the copied version::
The ``copy`` module copies a file on the local box to remote locations.
.. raw:: html
<table>
<tr>
<th class="head">parameter</th>
<th class="head">required</th>
<th class="head">default</th>
<th class="head">choices</th>
<th class="head">comments</th>
</tr>
<tr>
<td>dest</td>
<td>yes</td>
<td></td>
<td><ul></ul></td>
<td>Remote absolute path where the file should be copied to.</td>
</tr>
<tr>
<td>src</td>
<td>yes</td>
<td></td>
<td><ul></ul></td>
<td>Local path to a file to copy to the remote server; can be absolute or relative.</td>
</tr>
<tr>
<td>backup</td>
<td>no</td>
<td>no</td>
<td><ul><li>yes</li><li>no</li></ul></td>
<td>Create a backup file including the timestamp information so you can get the original file back if you somehow clobbered it incorrectly. (added in Ansible 0.7)</td>
</tr>
<tr>
<td>others</td>
<td>no</td>
<td></td>
<td><ul></ul></td>
<td>all arguments accepted by the <span class='module'>file</span> module also work here</td>
</tr>
</table>
.. raw:: html
<p>Example from Ansible Playbooks</p> <p><pre>
copy src=/srv/myfiles/foo.conf dest=/etc/foo.conf owner=foo group=foo mode=0644
</pre></p>
<p>Copy a new <code>ntp.conf</code> file into place, backing up the original if it differs from the copied version</p> <p><pre>
copy src=/mine/ntp.conf dest=/etc/ntp.conf owner=root group=root mode=644 backup=yes
</pre></p>
<br/>
copy src=/srv/myfiles/ntp.conf dest=/etc/ntp.conf owner=root group=root mode=644 backup=yes

@ -1,30 +1,51 @@
.. _easy_install:
easy_install
````````````
``````````````````````````````
.. versionadded:: 0.7
The easy_install module installs Python libraries.
+--------------------+----------+---------+----------------------------------------------------------------------------+
| parameter | required | default | comments |
+====================+==========+=========+============================================================================+
| name | yes | | a Python library name |
+--------------------+----------+---------+----------------------------------------------------------------------------+
| virtualenv | no | | an optional virtualenv directory path to install into, if the virtualenv |
| | | | does not exist it is created automatically |
+--------------------+----------+---------+----------------------------------------------------------------------------+
Please note that the easy_install command can only install Python libraries.
Thus this module is not able to remove libraries. It is generally recommended to
use the :ref:`pip` module which you can first install using easy_install.
Also note that `virtualenv <http://www.virtualenv.org/>`_ must be installed on
the remote host if the `virtualenv` parameter is specified.
Example action from Ansible :doc:`playbooks`::
Installs Python libraries, optionally in a *virtualenv*
.. raw:: html
<table>
<tr>
<th class="head">parameter</th>
<th class="head">required</th>
<th class="head">default</th>
<th class="head">choices</th>
<th class="head">comments</th>
</tr>
<tr>
<td>virtualenv</td>
<td>no</td>
<td></td>
<td><ul></ul></td>
<td>an optional <em>virtualenv</em> directory path to install into. If the <em>virtualenv</em> does not exist, it is created automatically</td>
</tr>
<tr>
<td>name</td>
<td>yes</td>
<td></td>
<td><ul></ul></td>
<td>A Python library name</td>
</tr>
</table>
.. raw:: html
<p>Examples from Ansible Playbooks</p> <p><pre>
easy_install name=pip
easy_install name=flask==0.8
easy_install name=flask virtualenv=/srv/webapps/my_app/venv
</pre></p>
<p>Install <em>Flask</em> (<a href='http://flask.pocoo.org/'>http://flask.pocoo.org/</a>) into the specified <em>virtualenv</em></p> <p><pre>
easy_install name=flask virtualenv=/webapps/myapp/venv
</pre></p>
<br/>
.. raw:: html
<h4>Notes</h4>
<p>Please note that the <span class='module'>easy_install</span> module can only install Python libraries. Thus this module is not able to remove libraries. It is generally recommended to use the <span class='module'>pip</span> module which you can first install using <span class='module'>easy_install</span>.</p>
<p>Also note that <em>virtualenv</em> must be installed on the remote host if the <code>virtualenv</code> parameter is specified.</p>

@ -1,16 +1,17 @@
.. _facter:
facter
``````
``````````````````````````````
Runs the discovery program 'facter' on the remote system, returning
JSON data that can be useful for inventory purposes.
.. versionadded:: 0.2
Requires that 'facter' and 'ruby-json' be installed on the remote end.
Runs the *facter* discovery program (https://github.com/puppetlabs/facter) on the remote system, returning JSON data that can be useful for inventory purposes.
Playbooks do not actually use this module, they use the :ref:`setup`
module behind the scenes.
Example from /usr/bin/ansible::
.. raw:: html
<p>Example command-line invocation</p> <p><pre>
ansible www.example.net -m facter
</pre></p>
<br/>
ansible foo.example.org -m facter

@ -0,0 +1,42 @@
.. _fail:
fail
``````````````````````````````
.. versionadded:: 0.8
This module fails the progress with a custom message. It can be useful for bailing out when a certain condition is met using only_if.
.. raw:: html
<table>
<tr>
<th class="head">parameter</th>
<th class="head">required</th>
<th class="head">default</th>
<th class="head">choices</th>
<th class="head">comments</th>
</tr>
<tr>
<td>msg</td>
<td>no</td>
<td>Failed because only_if condition is true</td>
<td><ul></ul></td>
<td>The customized message used for failing execution. If ommited, fail will simple bail out with a generic message.</td>
</tr>
<tr>
<td>rc</td>
<td>no</td>
<td>1</td>
<td><ul></ul></td>
<td>The return code of the failure. This is currently not used by Ansible, but might be used in the future.</td>
</tr>
</table>
.. raw:: html
<p>Example of how a playbook may fail when a condition is not met</p> <p><pre>
[{'action': 'fail msg="The system may not be provisioned according to the CMDB status."', 'only_if': "'$cmdb_status' != 'to-be-staged'"}]
</pre></p>
<br/>

@ -1,22 +1,42 @@
.. _fetch:
fetch
`````
``````````````````````````````
This module works like 'copy', but in reverse. It is used for fetching files
from remote machines and storing them locally in a file tree, organized by hostname.
.. versionadded:: 0.2
+--------------------+----------+---------+----------------------------------------------------------------------------+
| parameter | required | default | comments |
+====================+==========+=========+============================================================================+
| src | yes | | The file on the remote system to fetch. This needs to be a file, not |
| | | | a directory. Recursive fetching may be supported in a later release. |
+--------------------+----------+---------+----------------------------------------------------------------------------+
| dest | yes | | A directory to save the file into. For example, if the 'dest' directory |
| | | | is '/foo', a src file named '/tmp/bar' on host 'host.example.com', would |
| | | | be saved into '/foo/host.example.com/tmp/bar' |
+--------------------+----------+---------+----------------------------------------------------------------------------+
This module works like ``copy``, but in reverse. It is used for fetching files from remote machines and storing them locally in a file tree, organized by hostname.
Example::
.. raw:: html
<table>
<tr>
<th class="head">parameter</th>
<th class="head">required</th>
<th class="head">default</th>
<th class="head">choices</th>
<th class="head">comments</th>
</tr>
<tr>
<td>dest</td>
<td>yes</td>
<td></td>
<td><ul></ul></td>
<td>A directory to save the file into. For example, if the <em>dest</em> directory is <code>/backup</code> a src file named <code>/etc/profile</code> on host <code>host.example.com</code>, would be saved into <code>/backup/host.example.com/etc/profile</code></td>
</tr>
<tr>
<td>src</td>
<td>yes</td>
<td></td>
<td><ul></ul></td>
<td>The file on the remote system to fetch. This must be a file, not a directory. Recursive fetching may be supported in a later release.</td>
</tr>
</table>
.. raw:: html
<p>Example from Ansible Playbooks</p> <p><pre>
fetch src=/var/log/messages dest=/home/logtree
</pre></p>
<br/>

@ -3,12 +3,9 @@
file
``````````````````````````````
.. versionadded:: 0.1
Sets attributes of files, symlinks, and directories, or removes files/symlinks/directories. Many other modules support the same options as the file module - including ``copy``, ``template``, and ``assmeble``.
.. raw:: html
<table>
@ -19,40 +16,104 @@ Sets attributes of files, symlinks, and directories, or removes files/symlinks/d
<th class="head">choices</th>
<th class="head">comments</th>
</tr>
<tr>
<tr>
<td>src</td>
<td>no</td>
<td></td>
<td><ul></ul></td>
<td>path of the file to link to (applies only to <code>state=link</code>).</td>
</tr>
<tr>
<td>group</td>
<td>no</td>
<td></td>
<td><ul></ul></td>
<td>name of the group that should own the file/directory, as would be fed to <em>chown</em></td>
</tr>
<tr>
<td>dest</td>
<td>True</td>
<td>[]</td>
<td>yes</td>
<td></td>
<td><ul></ul></td>
<td>defines the file being managed, unless when used with <em>state=link</em>, and then sets the destination to create a symbolic link to using <em>src</em></td>
</tr>
<tr>
<tr>
<td>selevel</td>
<td>no</td>
<td>s0</td>
<td><ul></ul></td>
<td>level part of the SELinux file context. This is the MLS/MCS attribute, sometimes known as the <code>range</code>. <code>_default</code> feature works as for <em>seuser</em>.</td>
</tr>
<tr>
<td>seuser</td>
<td>no</td>
<td></td>
<td><ul></ul></td>
<td>user part of SELinux file context. Will default to system policy, if applicable. If set to <code>_default</code>, it will use the <code>user</code> portion of the the policy if available</td>
</tr>
<tr>
<td>state</td>
<td>False</td>
<td>no</td>
<td>file</td>
<td><ul><li>file</li><li>link</li><li>directory</li><li>absent</li></ul></td>
<td>If directory, all immediate subdirectories will be created if they do not exist. If <em>file</em>, the file will NOT be created if it does not exist, see the <span class='module'>copy</span> or <span class='module'>template</span> module if you want that behavior. If <em>link</em>, the symbolic link will be created or changed. If absent, directories will be recursively deleted, and files or symlinks will be unlinked.</td>
<td>If <code>directory</code>, all immediate subdirectories will be created if they do not exist. If <code>file</code>, the file will NOT be created if it does not exist, see the <span class='module'>copy</span> or <span class='module'>template</span> module if you want that behavior. If <code>link</code>, the symbolic link will be created or changed. If <code>absent</code>, directories will be recursively deleted, and files or symlinks will be unlinked.</td>
</tr>
<tr>
<tr>
<td>serole</td>
<td>no</td>
<td></td>
<td><ul></ul></td>
<td>role part of SELinux file context, <code>_default</code> feature works as for <em>seuser</em>.</td>
</tr>
<tr>
<td>mode</td>
<td>False</td>
<td>no</td>
<td></td>
<td><ul></ul></td>
<td>mode the file or directory should be, such as 0644 as would be fed to <em>chmod</em>. English modes like <b>g+x</b> are not yet supported</td>
<td>mode the file or directory should be, such as 0644 as would be fed to</td>
</tr>
</table>
<tr>
<td>context</td>
<td>no</td>
<td></td>
<td><ul><li>default</li></ul></td>
<td>accepts only <code>default</code> as value. This will restore a file's SELinux context in the policy. Does nothing if no default value is available.</td>
</tr>
<tr>
<td>owner</td>
<td>no</td>
<td></td>
<td><ul></ul></td>
<td>name of the user that should own the file/directory, as would be fed to <em>chown</em></td>
</tr>
<tr>
<td>force</td>
<td>no</td>
<td></td>
<td><ul></ul></td>
<td>force is required when changing an existing file to a directory, or a link to a directory, and so on. Use this with caution.</td>
</tr>
<tr>
<td>setype</td>
<td>no</td>
<td></td>
<td><ul></ul></td>
<td>type part of SELinux file context, <code>_default</code> feature works as for <em>seuser</em>.</td>
</tr>
</table>
.. raw:: html
<p>Example from Ansible Playbooks</p>
<p><pre>
file path=/etc/foo.conf owner=foo group=foo mode=0644</pre></p>
<p>Example from Ansible Playbooks</p> <p><pre>
file path=/etc/foo.conf owner=foo group=foo mode=0644
</pre></p>
<p><pre>
file src=/file/to/link/to dest=/path/to/symlink owner=foo group=foo state=link
</pre></p>
<br/>
.. raw:: html
<h4>Notes</h4>
<p>See also <span class='module'>copy</span>, <span class='module'>template</span>, <span class='module'>assemble</span></p>

@ -0,0 +1,61 @@
.. _fireball:
fireball
``````````````````````````````
.. versionadded:: 0.9
This modules launches an ephemeral *fireball* ZeroMQ message bus daemon on the remote node which Ansible can to communicate with nodes at high speed.
The daemon listens on a configurable port for a configurable amount of time.
Starting a new fireball as a given user terminates any existing user fireballs.
Fireball mode is AES encrypted
.. raw:: html
<table>
<tr>
<th class="head">parameter</th>
<th class="head">required</th>
<th class="head">default</th>
<th class="head">choices</th>
<th class="head">comments</th>
</tr>
<tr>
<td>minutes</td>
<td>no</td>
<td>30</td>
<td><ul></ul></td>
<td>The <em>fireball</em> listener daemon is started on nodes and will stay around for this number of minutes before turning itself off.</td>
</tr>
<tr>
<td>port</td>
<td>no</td>
<td>5099</td>
<td><ul></ul></td>
<td>TCP port for ZeroMQ</td>
</tr>
</table>
.. raw:: html
<p>This example playbook has two plays: the first launches <em>fireball</em> mode on all hosts via SSH, and the second actually starts using <em>fireball</em> node for subsequent management over the fireball interface</p> <p><pre>
- hosts: devservers
gather_facts: false
connection: ssh
sudo: yes
tasks:
- action: fireball
- hosts: devservers
connection: fireball
tasks:
- action: command /usr/bin/anything
</pre></p>
<br/>
.. raw:: html
<h4>Notes</h4>
<p>See the advanced playbooks chapter for more about using fireball mode.</p>

@ -5,10 +5,8 @@ get_url
.. versionadded:: 0.6
Downloads files from HTTP, HTTPS, or FTP to the remote server. The remote server must have direct access to the remote resource.
.. raw:: html
<table>
@ -19,48 +17,45 @@ Downloads files from HTTP, HTTPS, or FTP to the remote server. The remote server
<th class="head">choices</th>
<th class="head">comments</th>
</tr>
<tr>
<tr>
<td>url</td>
<td>True</td>
<td>None</td>
<td>yes</td>
<td></td>
<td><ul></ul></td>
<td>HTTP, HTTPS, or FTP URL</td>
</tr>
<tr>
<tr>
<td>dest</td>
<td>True</td>
<td>None</td>
<td>yes</td>
<td></td>
<td><ul></ul></td>
<td>absolute path of where to download the file to.If <em>dest</em> is a directory, the basename of the file on the remote server will be used. If a directory, <em>thirsty=yes</em> must also be set.</td>
</tr>
<tr>
<tr>
<td>thirsty</td>
<td>False</td>
<td>no</td>
<td>no</td>
<td><ul><li>yes</li><li>no</li></ul></td>
<td>if <code>yes</code>, will download the file every time and replace the file if the contents change. if <code>no</code>, the file will only be downloaded if the destination does not exist. Generally should be <code>yes</code> only for small local files. prior to 0.6, acts if <code>yes</code> by default.</td>
<td>if <code>yes</code>, will download the file every time and replace the file if the contents change. if <code>no</code>, the file will only be downloaded if the destination does not exist. Generally should be <code>yes</code> only for small local files. prior to 0.6, acts if <code>yes</code> by default. (added in Ansible 0.7)</td>
</tr>
<tr>
<tr>
<td>others</td>
<td>False</td>
<td>no</td>
<td></td>
<td><ul></ul></td>
<td>all arguments accepted by the <span class='module'>file</span> module also work here</td>
</tr>
</table>
</table>
.. raw:: html
<p>Example from Ansible Playbooks</p>
<p><pre>
get_url url=http://example.com/path/file.conf dest=/etc/foo.conf mode=0440</pre></p>
<p>Example from Ansible Playbooks</p> <p><pre>
get_url url=http://example.com/path/file.conf dest=/etc/foo.conf mode=0440
</pre></p>
<br/>
.. raw:: html
<h4>Notes</h4>
<p>This module doesn't yet support configuration for proxies or passwords.</p>

@ -1,26 +1,63 @@
.. _git:
git
```
Deploys software (or files) from git checkouts.
+--------------------+----------+---------+----------------------------------------------------------------------------+
| parameter | required | default | comments |
+====================+==========+=========+============================================================================+
| repo | yes | | git, ssh, or http protocol address of the git repo |
+--------------------+----------+---------+----------------------------------------------------------------------------+
| dest | yes | | absolute path of where the repo should be checked out to |
+--------------------+----------+---------+----------------------------------------------------------------------------+
| version | no | HEAD | what version to check out -- either the git SHA, the literal string |
| | | | 'HEAD', branch name, or a tag name. |
+--------------------+----------+---------+----------------------------------------------------------------------------+
| remote | no | origin | name of the remote branch |
+--------------------+----------+---------+----------------------------------------------------------------------------+
| force | no | yes | (new in 0.7) If yes, any modified files in the working repository will be |
| | | | discarded. Prior to 0.7, this was always 'yes' and could not be disabled. |
+--------------------+----------+---------+----------------------------------------------------------------------------+
Example action from Ansible :doc:`playbooks`::
``````````````````````````````
.. versionadded:: 0.0.1
Manage git checkouts of repositories to deploy files or software.
.. raw:: html
<table>
<tr>
<th class="head">parameter</th>
<th class="head">required</th>
<th class="head">default</th>
<th class="head">choices</th>
<th class="head">comments</th>
</tr>
<tr>
<td>repo</td>
<td>yes</td>
<td></td>
<td><ul></ul></td>
<td>git, ssh, or http protocol address of the git repository.</td>
</tr>
<tr>
<td>dest</td>
<td>yes</td>
<td></td>
<td><ul></ul></td>
<td>Absolute path of where the repository should be checked out to.</td>
</tr>
<tr>
<td>version</td>
<td>no</td>
<td>HEAD</td>
<td><ul></ul></td>
<td>What version of the repository to check out. This can be the git <em>SHA</em>, the literal string <em>HEAD</em>, branch name, or a tag name.</td>
</tr>
<tr>
<td>force</td>
<td>no</td>
<td>yes</td>
<td><ul><li>True</li><li>False</li></ul></td>
<td>(New in 0.7) If yes, any modified files in the working repository will be discarded. Prior to 0.7, this was always 'yes' and could not be disabled.</td>
</tr>
<tr>
<td>remote</td>
<td>no</td>
<td>origin</td>
<td><ul></ul></td>
<td>Name of the remote branch.</td>
</tr>
</table>
.. raw:: html
<p>Example git checkout from Ansible Playbooks</p> <p><pre>
git repo=git://foosball.example.org/path/to/repo.git dest=/srv/checkout version=release-0.22
</pre></p>
<br/>

@ -1,24 +1,56 @@
.. _group:
group
`````
``````````````````````````````
Adds or removes groups.
.. versionadded:: 0.0.2
+--------------------+----------+---------+----------------------------------------------------------------------------+
| parameter | required | default | comments |
+====================+==========+=========+============================================================================+
| name | yes | | name of the group |
+--------------------+----------+---------+----------------------------------------------------------------------------+
| gid | | | optional git to set for the group |
+--------------------+----------+---------+----------------------------------------------------------------------------+
| state | | present | 'absent' or 'present' |
+--------------------+----------+---------+----------------------------------------------------------------------------+
| system | | no | if 'yes', indicates that the group being created is a system group. |
+--------------------+----------+---------+----------------------------------------------------------------------------+
Manage presence of groups on a host.
To control members of the group, see the users resource.
.. raw:: html
Example action from Ansible :doc:`playbooks`::
<table>
<tr>
<th class="head">parameter</th>
<th class="head">required</th>
<th class="head">default</th>
<th class="head">choices</th>
<th class="head">comments</th>
</tr>
<tr>
<td>state</td>
<td>no</td>
<td>present</td>
<td><ul><li>present</li><li>absent</li></ul></td>
<td>Whether the group should be present or not on the remote host.</td>
</tr>
<tr>
<td>gid</td>
<td>no</td>
<td></td>
<td><ul></ul></td>
<td>Optional <em>GID</em> to set for the group.</td>
</tr>
<tr>
<td>name</td>
<td>yes</td>
<td></td>
<td><ul></ul></td>
<td>Name of the group to manage.</td>
</tr>
<tr>
<td>system</td>
<td>no</td>
<td>no</td>
<td><ul><li>True</li><li>False</li></ul></td>
<td>If <em>yes</em>, indicates that the group created is a system group.</td>
</tr>
</table>
.. raw:: html
<p>Example group command from Ansible Playbooks</p> <p><pre>
group name=somegroup state=present
</pre></p>
<br/>
group name=somegroup state=present

@ -5,10 +5,8 @@ ini_file
.. versionadded:: 0.9
Manage (add, remove, change) individual settings in an INI-style file without having to manage the file as a whole with, say, ``template`` or ``assemble``. Adds missing sections if they don't exist.
.. raw:: html
<table>
@ -19,60 +17,67 @@ Manage (add, remove, change) individual settings in an INI-style file without ha
<th class="head">choices</th>
<th class="head">comments</th>
</tr>
<tr>
<tr>
<td>option</td>
<td>False</td>
<td>None</td>
<td>no</td>
<td></td>
<td><ul></ul></td>
<td>if set (required for changing a <em>value</em>), this is the name of the option.May be omitted if adding/removing a whole <em>section</em>.</td>
</tr>
<tr>
<tr>
<td>others</td>
<td>False</td>
<td>no</td>
<td></td>
<td><ul></ul></td>
<td>all arguments accepted by the <span class='module'>file</span> module also work here</td>
</tr>
<tr>
<tr>
<td>dest</td>
<td>True</td>
<td>None</td>
<td>yes</td>
<td></td>
<td><ul></ul></td>
<td>Path to the INI-style file; this file is created if required</td>
</tr>
<tr>
<tr>
<td>section</td>
<td>True</td>
<td>None</td>
<td>yes</td>
<td></td>
<td><ul></ul></td>
<td>Section name in INI file. This is added if <code>state=present</code> automatically when a single value is being set.</td>
</tr>
<tr>
<tr>
<td>backup</td>
<td>False</td>
<td>False</td>
<td>no</td>
<td></td>
<td><ul><li>yes</li><li>no</li></ul></td>
<td>Create a backup file including the timestamp information so you can get the original file back if you somehow clobbered it incorrectly.</td>
</tr>
<tr>
<tr>
<td>value</td>
<td>False</td>
<td>None</td>
<td>no</td>
<td></td>
<td><ul></ul></td>
<td>the string value to be associated with an <em>option</em>. May be omitted when removing an <em>option</em>.</td>
</tr>
</table>
</table>
.. raw:: html
<p>Ensure <code>fav=lemonade</code> is in section <code>[drinks]</code> in said file</p> <p><pre>
ini_file dest=/etc/conf section=drinks option=fav value=lemonade mode=0600 backup=true
</pre></p>
<p><pre>
ini_file dest=/etc/anotherconf
section=drinks
option=temperature
value=cold
backup=true
</pre></p>
<br/>
.. raw:: html
<h4>Notes</h4>
<p>While it is possible to add an <em>option</em> without specifying a <em>value</em>, this makes no sense.</p>

@ -5,11 +5,9 @@ lineinfile
.. versionadded:: 0.7
This module will search a file for a line, and ensure that it is present or absent.
This is primarily useful when you want to change a single line in a file only. For other cases, see the ``copy`` or ``template`` modules.
.. raw:: html
<table>
@ -20,68 +18,57 @@ This is primarily useful when you want to change a single line in a file only. F
<th class="head">choices</th>
<th class="head">comments</th>
</tr>
<tr>
<tr>
<td>state</td>
<td>False</td>
<td>no</td>
<td>present</td>
<td><ul><li>present</li><li>absent</li></ul></td>
<td>Whether the line should be there or not.</td>
</tr>
<tr>
<tr>
<td>name</td>
<td>True</td>
<td>yes</td>
<td></td>
<td><ul></ul></td>
<td>The file to modify</td>
</tr>
<tr>
<tr>
<td>insertafter</td>
<td>False</td>
<td>no</td>
<td>EOF</td>
<td><ul><li>BOF</li><li>EOF</li></ul></td>
<td>Used with <em>state=present</em>. If specified, the line will be inserted after the specified regular expression. Two special values are available; <code>BOF</code> for inserting the line at the beginning of the file, and <code>EOF</code> for inserting the line at the end of the file.</td>
<td>Used with <code>state=present</code>. If specified, the line will be inserted after the specified regular expression. Two special values are available; <code>BOF</code> for inserting the line at the beginning of the file, and <code>EOF</code> for inserting the line at the end of the file.</td>
</tr>
<tr>
<tr>
<td>regexp</td>
<td>True</td>
<td>yes</td>
<td></td>
<td><ul></ul></td>
<td>The regular expression to look for in the file. For <em>state=present</em>, the pattern to replace. For <em>state=absent</em>, the pattern of the line to remove.</td>
<td>The regular expression to look for in the file. For <code>state=present</code>, the pattern to replace. For <code>state=absent</code>, the pattern of the line to remove.</td>
</tr>
<tr>
<tr>
<td>line</td>
<td>False</td>
<td>no</td>
<td></td>
<td><ul></ul></td>
<td>Required for <em>state=present</em>. The line to insert/replace into the file. Must match the value given to <code>regexp</code>.</td>
<td>Required for <code>state=present</code>. The line to insert/replace into the file. Must match the value given to <code>regexp</code>.</td>
</tr>
<tr>
<tr>
<td>backup</td>
<td>False</td>
<td>False</td>
<td>no</td>
<td></td>
<td><ul></ul></td>
<td>Create a backup file including the timestamp information so you can get the original file back if you somehow clobbered it incorrectly.</td>
</tr>
</table>
</table>
.. raw:: html
<p></p>
<p><pre>
lineinfile name=/etc/selinux/config regexp=^SELINUX= line=SELINUX=disabled</pre></p>
<p></p>
<p><pre>
lineinfile name=/etc/sudoers state=absent regexp="^%wheel"</pre></p>
<p><pre>
lineinfile name=/etc/selinux/config regexp=^SELINUX= line=SELINUX=disabled
</pre></p>
<p><pre>
lineinfile name=/etc/sudoers state=absent regexp="^%wheel"
</pre></p>
<br/>

@ -1,28 +1,77 @@
.. _mount:
mount
`````
``````````````````````````````
.. versionadded:: 0.6
The mount module controls active and configured mount points (fstab).
+--------------------+----------+---------+----------------------------------------------------------------------------+
| parameter | required | default | comments |
+====================+==========+=========+============================================================================+
| name | yes | | path to the mountpoint, ex: /mnt/foo |
+--------------------+----------+---------+----------------------------------------------------------------------------+
| src | yes | | device to be mounted |
+--------------------+----------+---------+----------------------------------------------------------------------------+
| fstype | yes | | fstype |
+--------------------+----------+---------+----------------------------------------------------------------------------+
| opts | no | | mount options (see fstab docs) |
+--------------------+----------+---------+----------------------------------------------------------------------------+
| dump | no | | dump (see fstab docs) |
+--------------------+----------+---------+----------------------------------------------------------------------------+
| passno | no | | passno (see fstab docs) |
+--------------------+----------+---------+----------------------------------------------------------------------------+
| state | yes | | 'present', 'absent', 'mounted', or 'unmounted'. If mounted/unmounted, |
| | | | the device will be actively mounted or unmounted as well as just |
| | | | configured in fstab. 'absent', and 'present' only deal with fstab. |
+--------------------+----------+---------+----------------------------------------------------------------------------+
This module controls active and configured mount points in ``/etc/fstab``.
.. raw:: html
<table>
<tr>
<th class="head">parameter</th>
<th class="head">required</th>
<th class="head">default</th>
<th class="head">choices</th>
<th class="head">comments</th>
</tr>
<tr>
<td>src</td>
<td>yes</td>
<td></td>
<td><ul></ul></td>
<td>device to be mounted on <em>name</em>.</td>
</tr>
<tr>
<td>state</td>
<td>yes</td>
<td></td>
<td><ul><li>present</li><li>absent</li><li>mounted</li><li>unmounted</li></ul></td>
<td>If <code>mounted</code> or <code>unmounted</code>, the device will be actively mounted or unmounted as well as just configured in <em>fstab</em>. <code>absent</code> and <code>present</code> only deal with <em>fstab</em>.</td>
</tr>
<tr>
<td>name</td>
<td>yes</td>
<td></td>
<td><ul></ul></td>
<td>path to the mount point, eg: <code>/mnt/files</code></td>
</tr>
<tr>
<td>dump</td>
<td>no</td>
<td></td>
<td><ul></ul></td>
<td>dump (see fstab(8))</td>
</tr>
<tr>
<td>passno</td>
<td>no</td>
<td></td>
<td><ul></ul></td>
<td>passno (see fstab(8))</td>
</tr>
<tr>
<td>opts</td>
<td>no</td>
<td></td>
<td><ul></ul></td>
<td>mount options (see fstab(8))</td>
</tr>
<tr>
<td>fstype</td>
<td>yes</td>
<td></td>
<td><ul></ul></td>
<td>file-system type</td>
</tr>
</table>
.. raw:: html
<p>Mount DVD read-only</p> <p><pre>
mount name=/mnt/dvd src=/dev/sr0 fstype=iso9660 opts=ro
</pre></p>
<br/>

@ -1,38 +1,83 @@
.. _mysql_db:
mysql_db
````````
``````````````````````````````
.. versionadded:: 0.6
Add or remove MySQL databases from a remote host.
Requires the MySQLdb Python package on the remote host. For Ubuntu, this is as easy as
apt-get install python-mysqldb.
+--------------------+----------+-----------+-----------------------------------------------------------------------------+
| parameter | required | default | comments |
+====================+==========+===========+=============================================================================+
| name | yes | | name of the database to add or remove |
+--------------------+----------+-----------+-----------------------------------------------------------------------------+
| login_user | no | | user name used to authenticate with |
+--------------------+----------+-----------+-----------------------------------------------------------------------------+
| login_password | no | | password used to authenticate with |
+--------------------+----------+-----------+-----------------------------------------------------------------------------+
| login_host | no | localhost | host running the database |
+--------------------+----------+-----------+-----------------------------------------------------------------------------+
| state | no | present | 'absent' or 'present' |
+--------------------+----------+-----------+-----------------------------------------------------------------------------+
| collation | no | | collation mode |
+--------------------+----------+-----------+-----------------------------------------------------------------------------+
| encoding | no | | encoding mode |
+--------------------+----------+-----------+-----------------------------------------------------------------------------+
Both 'login_password' and 'login_username' are required when you are passing credentials.
If none are present, the module will attempt to read the credentials from ~/.my.cnf, and
finally fall back to using the MySQL default login of 'root' with no password.
Example action from Ansible :doc:`playbooks`::
- name: Create database
action: mysql_db db=bobdata state=present
Add or remove MySQL databases from a remote host.
.. raw:: html
<table>
<tr>
<th class="head">parameter</th>
<th class="head">required</th>
<th class="head">default</th>
<th class="head">choices</th>
<th class="head">comments</th>
</tr>
<tr>
<td>state</td>
<td>no</td>
<td>present</td>
<td><ul><li>present</li><li>absent</li></ul></td>
<td>The database state</td>
</tr>
<tr>
<td>name</td>
<td>yes</td>
<td></td>
<td><ul></ul></td>
<td>name of the database to add or remove</td>
</tr>
<tr>
<td>encoding</td>
<td>no</td>
<td></td>
<td><ul></ul></td>
<td>Encoding mode</td>
</tr>
<tr>
<td>collation</td>
<td>no</td>
<td></td>
<td><ul></ul></td>
<td>Collation mode</td>
</tr>
<tr>
<td>login_user</td>
<td>no</td>
<td></td>
<td><ul></ul></td>
<td>The username used to authenticate with</td>
</tr>
<tr>
<td>login_host</td>
<td>no</td>
<td>localhost</td>
<td><ul></ul></td>
<td>Host running the database</td>
</tr>
<tr>
<td>login_password</td>
<td>no</td>
<td></td>
<td><ul></ul></td>
<td>The password used to authenticate with</td>
</tr>
</table>
.. raw:: html
<p>Create a new database with name 'bobdata'</p> <p><pre>
mysql_db db=bobdata state=present
</pre></p>
<br/>
.. raw:: html
<h4>Notes</h4>
<p>Requires the MySQLdb Python package on the remote host. For Ubuntu, this is as easy as apt-get install python-mysqldb.</p>
<p>Both <code>login_password</code> and <code>login_username</code> are required when you are passing credentials. If none are present, the module will attempt to read the credentials from <code>~/.my.cnf</code>, and finally fall back to using the MySQL default login of 'root' with no password.</p>

@ -1,47 +1,96 @@
.. _mysql_user:
mysql_user
``````````
``````````````````````````````
.. versionadded:: 0.6
Adds or removes a user from a MySQL database.
Requires the MySQLdb Python package on the remote host. For Ubuntu, this is as easy as
apt-get install python-mysqldb.
+--------------------+----------+------------+----------------------------------------------------------------------------+
| parameter | required | default | comments |
+====================+==========+============+============================================================================+
| name | yes | | name of the user (role) to add or remove |
+--------------------+----------+------------+----------------------------------------------------------------------------+
| password | no | | set the user's password |
+--------------------+----------+------------+----------------------------------------------------------------------------+
| host | no | localhost | the 'host' part of the MySQL username |
+--------------------+----------+------------+----------------------------------------------------------------------------+
| login_user | no | | user name used to authenticate with |
+--------------------+----------+------------+----------------------------------------------------------------------------+
| login_password | no | | password used to authenticate with |
+--------------------+----------+------------+----------------------------------------------------------------------------+
| login_host | no | localhost | host running MySQL. |
+--------------------+----------+------------+----------------------------------------------------------------------------+
| priv | no | | MySQL privileges string in the format: db.table:priv1,priv2 |
+--------------------+----------+------------+----------------------------------------------------------------------------+
| state | no | present | 'absent' or 'present' |
+--------------------+----------+------------+----------------------------------------------------------------------------+
Both 'login_password' and 'login_username' are required when you are passing credentials.
If none are present, the module will attempt to read the credentials from ~/.my.cnf, and
finally fall back to using the MySQL default login of 'root' with no password.
Example privileges string format:
Adds or removes a user from a MySQL database.
mydb.*:INSERT,UPDATE/anotherdb.*:SELECT/yetanotherdb.*:ALL
.. raw:: html
<table>
<tr>
<th class="head">parameter</th>
<th class="head">required</th>
<th class="head">default</th>
<th class="head">choices</th>
<th class="head">comments</th>
</tr>
<tr>
<td>name</td>
<td>yes</td>
<td></td>
<td><ul></ul></td>
<td>name of the user (role) to add or remove</td>
</tr>
<tr>
<td>login_user</td>
<td>no</td>
<td></td>
<td><ul></ul></td>
<td>The username used to authenticate with</td>
</tr>
<tr>
<td>login_host</td>
<td>no</td>
<td>localhost</td>
<td><ul></ul></td>
<td>Host running the database</td>
</tr>
<tr>
<td>host</td>
<td>no</td>
<td>localhost</td>
<td><ul></ul></td>
<td>the 'host' part of the MySQL username</td>
</tr>
<tr>
<td>state</td>
<td>no</td>
<td>present</td>
<td><ul><li>present</li><li>absent</li></ul></td>
<td>The database state</td>
</tr>
<tr>
<td>login_password</td>
<td>no</td>
<td></td>
<td><ul></ul></td>
<td>The password used to authenticate with</td>
</tr>
<tr>
<td>password</td>
<td>no</td>
<td></td>
<td><ul></ul></td>
<td>set the user's password</td>
</tr>
<tr>
<td>priv</td>
<td>no</td>
<td></td>
<td><ul></ul></td>
<td>MySQL privileges string in the format: <code>db.table:priv1,priv2</code></td>
</tr>
</table>
Example action from Ansible :doc:`playbooks`::
.. raw:: html
<p>Create database user with name 'bob' and password '12345' with all database privileges</p> <p><pre>
mysql_user name=bob password=12345 priv=*.*:ALL state=present
</pre></p>
<p>Ensure no user named 'sally' exists, also passing in the auth credentials.</p> <p><pre>
mysql_user login_user=root login_password=123456 name=sally state=absent
</pre></p>
<p>Example privileges string format</p> <p><pre>
mydb.*:INSERT,UPDATE/anotherdb.*:SELECT/yetanotherdb.*:ALL
</pre></p>
<br/>
- name: Create database user
action: mysql_user name=bob password=12345 priv=*.*:ALL state=present
.. raw:: html
- name: Ensure no user named 'sally' exists, also passing in the auth credentials.
action: mysql_user login_user=root login_password=123456 name=sally state=absent
<h4>Notes</h4>
<p>Requires the MySQLdb Python package on the remote host. For Ubuntu, this is as easy as apt-get install python-mysqldb.</p>
<p>Both <code>login_password</code> and <code>login_username</code> are required when you are passing credentials. If none are present, the module will attempt to read the credentials from <code>~/.my.cnf</code>, and finally fall back to using the MySQL default login of 'root' with no password.</p>

@ -1,124 +1,95 @@
.. _nagios:
nagios
``````
``````````````````````````````
.. versionadded:: 0.7
Perform common tasks in Nagios related to downtime and notifications.
The ``nagios`` module has two basic functions: scheduling downtime and toggling alerts for services or hosts.
All actions require the ``host`` parameter to be given explicitly. In playbooks you can use the ``$inventory_hostname`` variable to refer to the host the playbook is currently running on.
You can specify multiple services at once by separating them with commas, .e.g., ``services=httpd,nfs,puppet``.
When specifying what service to handle there is a special service value, *host*, which will handle alerts/downtime for the *host itself*, e.g., ``service=host``. This keyword may not be given with other services at the same time. *Setting alerts/downtime for a host does not affect alerts/downtime for any of the services running on it.*
When using the ``nagios`` module you will need to specify your nagios server using the ``delegate_to`` parameter.
.. raw:: html
<table>
<tr>
<th class="head">parameter</th>
<th class="head">required</th>
<th class="head">default</th>
<th class="head">choices</th>
<th class="head">comments</th>
</tr>
<tr>
<td>action</td>
<td>yes</td>
<td></td>
<td><ul><li>downtime</li><li>enable_alerts</li><li>disable_alerts</li><li>silence</li><li>unsilence</li></ul></td>
<td>Action to take.</td>
</tr>
<tr>
<td>host</td>
<td>yes</td>
<td></td>
<td><ul></ul></td>
<td>Host to operate on in Nagios.</td>
</tr>
<tr>
<td>author</td>
<td>no</td>
<td>Ansible</td>
<td><ul></ul></td>
<td>Author to leave downtime comments as. - Only useable with the <code>downtime</code> action.</td>
</tr>
<tr>
<td>services</td>
<td>yes</td>
<td></td>
<td><ul></ul></td>
<td>What to manage downtime/alerts for. Separate multiple services with commas.<code>service</code> is an alias for <code>services</code>.<b>Required</b> option when using the <code>downtime</code>, <code>enable_alerts</code>, and <code>disable_alerts</code> actions.</td>
</tr>
<tr>
<td>minutes</td>
<td>no</td>
<td>30</td>
<td><ul></ul></td>
<td>Minutes to schedule downtime for.Only useable with the <code>downtime</code> action.</td>
</tr>
<tr>
<td>cmdfile</td>
<td>no</td>
<td>auto-detected</td>
<td><ul></ul></td>
<td>Path to the nagios <em>command file</em> (FIFO pipe).Only required if auto-detection fails.</td>
</tr>
</table>
.. raw:: html
<p>set 30 minutes of apache downtime</p> <p><pre>
nagios action=downtime minutes=30 service=httpd host=$inventory_hostname
</pre></p>
<p>schedule an hour of HOST downtime</p> <p><pre>
nagios action=downtime minutes=60 service=host host=$inventory_hostname
</pre></p>
<p>schedule downtime for a few services</p> <p><pre>
nagios action=downtime services=frob,foobar,qeuz host=$inventory_hostname
</pre></p>
<p>enable SMART disk alerts</p> <p><pre>
nagios action=enable_alerts service=smart host=$inventory_hostname
</pre></p>
<p>two services at once: disable httpd and nfs alerts</p> <p><pre>
nagios action=disable_alerts service=httpd,nfs host=$inventory_hostname
</pre></p>
<p>disable HOST alerts</p> <p><pre>
nagios action=disable_alerts service=host host=$inventory_hostname
</pre></p>
<p>silence ALL alerts</p> <p><pre>
nagios action=silence host=$inventory_hostname
</pre></p>
<p>unsilence all alerts</p> <p><pre>
nagios action=unsilence host=$inventory_hostname
</pre></p>
<br/>
The Nagios module has two basic functions: scheduling downtime and
toggling alerts for services or hosts.
The following parameters are common to all *actions* in the nagios
module:
+---------------+----------+----------------------------------+------------------------------------------------------------------+
| parameter | required | default | comments |
+===============+==========+==================================+==================================================================+
| action | yes | | one of: 'downtime', 'enable_alerts'/'disable_alerts', or |
| | | | 'silence'/'unsilence' |
+---------------+----------+----------------------------------+------------------------------------------------------------------+
| host | yes | | host to operate on in nagios |
+---------------+----------+----------------------------------+------------------------------------------------------------------+
| cmdfile | no | auto-detected | path to the nagios *command file* (FIFO pipe) |
+---------------+----------+----------------------------------+------------------------------------------------------------------+
The following parameters may be used with the **downtime** action:
+---------------+----------+----------------------------------+------------------------------------------------------------------+
| parameter | required | default | comments |
+===============+==========+==================================+==================================================================+
| author | no | Ansible | author to leave downtime comments as |
+---------------+----------+----------------------------------+------------------------------------------------------------------+
| minutes | no | 30 | minutes to schedule downtime for |
+---------------+----------+----------------------------------+------------------------------------------------------------------+
| services | yes | | what to manage downtime/alerts for. separate multiple services |
| | | | with commas. |
| | | | **service** is an alias for **services** |
+---------------+----------+----------------------------------+------------------------------------------------------------------+
The following parameter must be used with the **enable_alerts** and **disable_alerts** actions:
+---------------+----------+----------------------------------+------------------------------------------------------------------+
| parameter | required | default | comments |
+===============+==========+==================================+==================================================================+
| services | yes | | what to manage downtime/alerts for. separate multiple services |
| | | | with commas. |
| | | | **service** is an alias for **services** |
+---------------+----------+----------------------------------+------------------------------------------------------------------+
.. note::
The **silence** and **unsilence** actions have no additional
parameters that may be used with them.
All actions require the **host** parameter to be given explicitly. In
playbooks you can use the ``$inventory_hostname`` variable to refer to
the host the playbook is currently running on.
You can specify multiple services at once by separating them with
commas, .e.g., ``services=httpd,nfs,puppet``.
When specifying what service to handle there is a special service value,
**host**, which will handle alerts/downtime for the **host itself**,
e.g., ``service=host``. This keyword may *not* be given with other
services at the same time. *Handling alerts/downtime for a host does
not affect alerts/downtime for any of the services running on it.*
Examples from :doc:`playbooks`::
---
- hosts: webservers
user: root
tasks:
- name: set 30 minutes of apache downtime
action: nagios action=downtime minutes=30 service=httpd host=$inventory_hostname
delegate_to: nagios.example.com
- name: schedule an hour of HOST downtime
action: nagios action=downtime minutes=60 service=host host=$inventory_hostname
delegate_to: nagios.example.com
# Use the default of 30 minutes
# Schedule downtime for three services at once
- name: schedule downtime for a few services
action: nagios action=downtime services=frob,foobar,qeuz host=$inventory_hostname
delegate_to: nagios.example.com
- name: enable SMART disk alerts
action: nagios action=enable_alerts service=smart host=$inventory_hostname
delegate_to: nagios.example.com
# you can disable multiple at once
- name: disable httpd alerts
action: nagios action=disable_alerts service=httpd,nfs host=$inventory_hostname
delegate_to: nagios.example.com
# host alerts must be disabled as a seperate action
- name: disable HOST alerts
action: nagios action=disable_alerts service=host host=$inventory_hostname
delegate_to: nagios.example.com
- name: silence ALL alerts
action: nagios action=silence host=$inventory_hostname
delegate_to: nagios.example.com
- name: unsilence all alerts
action: nagios action=unsilence host=$inventory_hostname
delegate_to: nagios.example.com
**Troubleshooting Tips**
The nagios module may not operate for you out of the box. The most
likely problem is with your **cmdfile** permissions/paths. You will
receive this error if that is the case::
{"msg": "unable to write to nagios command file", "failed": true, "cmdfile": "/var/spool/nagios/cmd/nagios.cmd"}
Steps to correct this:
1. Ensure you are running the nagios module as a user who has
**write** permissions to the **cmdfile**.
2. Ensure you have **cmdfile** set correctly.

@ -1,16 +1,17 @@
.. _ohai:
ohai
````
``````````````````````````````
Similar to the :ref:`facter` module, this returns JSON inventory data.
Ohai data is a bit more verbose and nested than facter.
.. versionadded:: 0.6
Requires that 'ohai' be installed on the remote end.
Similar to the ``facter`` module, this runs the *ohai* discovery program (http://wiki.opscode.com/display/chef/Ohai) on the remote host and returns JSON inventory data. *Ohai* data is a bit more verbose and nested than *facter*.
Playbooks should not call the ohai module, playbooks call the
:ref:`setup` module behind the scenes instead.
Example::
.. raw:: html
<p>Retrieve <em>ohai</em> data from all Web servers and store in one-file per host</p> <p><pre>
ansible webservers -m ohai --tree=/tmp/ohaidata
</pre></p>
<br/>
ansible foo.example.org -m ohai

@ -0,0 +1,57 @@
.. _pause:
pause
``````````````````````````````
.. versionadded:: 0.8
Pauses playbook execution for a set amount of time, or until a prompt is acknowledged. All parameters are optional. The default behavior is to pause with a prompt.
You can use ``ctrl+c`` if you wish to advance a pause earlier than it is set to expire or if you need to abort a playbook run entirely. To continue early: press ``ctrl+c`` and then ``c``. To abort a playbook: press ``ctrl+c`` and then ``a``.
The pause module integrates into async/parallelized playbooks without any special considerations (see also: Rolling Updates). When using pauses with the ``serial`` playbook parameter (as in rolling updates) you are only prompted once for the current group of hosts.
.. raw:: html
<table>
<tr>
<th class="head">parameter</th>
<th class="head">required</th>
<th class="head">default</th>
<th class="head">choices</th>
<th class="head">comments</th>
</tr>
<tr>
<td>seconds</td>
<td>no</td>
<td></td>
<td><ul></ul></td>
<td>Number of minutes to pause for.</td>
</tr>
<tr>
<td>minutes</td>
<td>no</td>
<td></td>
<td><ul></ul></td>
<td>Number of minutes to pause for.</td>
</tr>
<tr>
<td>prompt</td>
<td>no</td>
<td></td>
<td><ul></ul></td>
<td>Optional text to use for the prompt message.</td>
</tr>
</table>
.. raw:: html
<p>Pause for 5 minutes to build app cache.</p> <p><pre>
pause minutes=5
</pre></p>
<p>Pause until you can verify updates to an application were successful.</p> <p><pre>
pause
</pre></p>
<p>A helpful reminder of what to look out for post-update.</p> <p><pre>
pause prompt=Make sure org.foo.FooOverload exception is not present
</pre></p>
<br/>

@ -1,10 +1,16 @@
.. _ping:
ping
````
``````````````````````````````
A trivial test module, this module always returns 'pong' on
successful contact. It does not make sense in playbooks, but is useful
from /usr/bin/ansible::
A trivial test module, this module always returns 'pong' on successful contact. It does not make sense in playbooks, but is useful from ``/usr/bin/ansible``
.. raw:: html
<p>Test 'webservers' status</p> <p><pre>
ansible webservers -m ping
</pre></p>
<br/>

@ -1,34 +1,80 @@
.. _pip:
pip
```
``````````````````````````````
.. versionadded:: 0.7
Manages Python library dependencies.
Manage Python library dependencies.
+--------------------+----------+---------+----------------------------------------------------------------------------+
| parameter | required | default | comments |
+====================+==========+=========+============================================================================+
| name | no | | The name of a Python library to install |
+--------------------+----------+---------+----------------------------------------------------------------------------+
| version | no | | The version number to install of the Python library specified in the |
| | | | 'name' parameter |
+--------------------+----------+---------+----------------------------------------------------------------------------+
| requirements | no | | The path to a pip requirements file |
+--------------------+----------+---------+----------------------------------------------------------------------------+
| virtualenv | no | | An optional path to a virtualenv directory to install into |
+--------------------+----------+---------+----------------------------------------------------------------------------+
| state | no | present | 'present', 'absent' or 'latest' |
+--------------------+----------+---------+----------------------------------------------------------------------------+
.. raw:: html
Please note that `virtualenv <http://www.virtualenv.org/>`_ must be installed on
the remote host if the `virtualenv` parameter is specified.
<table>
<tr>
<th class="head">parameter</th>
<th class="head">required</th>
<th class="head">default</th>
<th class="head">choices</th>
<th class="head">comments</th>
</tr>
<tr>
<td>virtualenv</td>
<td>no</td>
<td></td>
<td><ul></ul></td>
<td>An optional path to a virtualenv directory to install into</td>
</tr>
<tr>
<td>state</td>
<td>no</td>
<td>present</td>
<td><ul><li>present</li><li>absent</li><li>latest</li></ul></td>
<td>The state of module</td>
</tr>
<tr>
<td>version</td>
<td>no</td>
<td></td>
<td><ul></ul></td>
<td>The version number to install of the Python library specified in the 'name' parameter</td>
</tr>
<tr>
<td>requirements</td>
<td>no</td>
<td></td>
<td><ul></ul></td>
<td>The path to a pip requirements file</td>
</tr>
<tr>
<td>name</td>
<td>yes</td>
<td></td>
<td><ul></ul></td>
<td>The name of a Python library to install</td>
</tr>
</table>
Examples::
.. raw:: html
<p>Install <em>flask</em> python package.</p> <p><pre>
pip name=flask
</pre></p>
<p>Install <em>flask</em> python package on version 0.8.</p> <p><pre>
pip name=flask version=0.8
</pre></p>
<p>Install <em>Flask</em> (<a href='http://flask.pocoo.org/'>http://flask.pocoo.org/</a>) into the specified <em>virtualenv</em></p> <p><pre>
pip name=flask virtualenv=/srv/webapps/my_app/venv
</pre></p>
<p>Install specified python requirements.</p> <p><pre>
pip requirements=/srv/webapps/my_app/src/requirements.txt
</pre></p>
<p>Install specified python requirements in indicated virtualenv.</p> <p><pre>
pip requirements=/srv/webapps/my_app/src/requirements.txt virtualenv=/srv/webapps/my_app/venv
</pre></p>
<br/>
.. raw:: html
<h4>Notes</h4>
<p>Please note that <a href='http://www.virtualenv.org/, virtualenv'>http://www.virtualenv.org/, virtualenv</a> must be installed on the remote host if the virtualenv parameter is specified.</p>

@ -1,39 +1,76 @@
.. _postgresql_db:
postgresql_db
`````````````
``````````````````````````````
.. versionadded:: 0.6
Add or remove PostgreSQL databases from a remote host.
The default authentication assumes that you are either logging in as or
sudo'ing to the postgres account on the host.
This module uses psycopg2, a Python PostgreSQL database adapter. You must
ensure that psycopg2 is installed on the host before using this module. If
the remote host is the PostgreSQL server (which is the default case), then
PostgreSQL must also be installed on the remote host. For Ubuntu-based systems,
install the postgresql, libpq-dev, and python-psycopg2 packages on the remote
host before using this module.
+--------------------+----------+----------+----------------------------------------------------------------------------+
| parameter | required | default | comments |
+====================+==========+==========+============================================================================+
| name | yes | | name of the database to add or remove |
+--------------------+----------+----------+----------------------------------------------------------------------------+
| login_user | no | postgres | user (role) used to authenticate with PostgreSQL |
+--------------------+----------+----------+----------------------------------------------------------------------------+
| login_password | no | | password used to authenticate with PostgreSQL |
+--------------------+----------+----------+----------------------------------------------------------------------------+
| login_host | no | | host running PostgreSQL. Default (blank) implies localhost |
+--------------------+----------+----------+----------------------------------------------------------------------------+
| owner | no | | name of the role to set as owner of the database |
+--------------------+----------+----------+----------------------------------------------------------------------------+
| state | | present | 'absent' or 'present' |
+--------------------+----------+----------+----------------------------------------------------------------------------+
Example action from Ansible :doc:`playbooks`::
Add or remove PostgreSQL databases from a remote host.
.. raw:: html
<table>
<tr>
<th class="head">parameter</th>
<th class="head">required</th>
<th class="head">default</th>
<th class="head">choices</th>
<th class="head">comments</th>
</tr>
<tr>
<td>state</td>
<td>no</td>
<td>present</td>
<td><ul><li>present</li><li>absent</li></ul></td>
<td>The database state</td>
</tr>
<tr>
<td>name</td>
<td>yes</td>
<td></td>
<td><ul></ul></td>
<td>name of the database to add or remove</td>
</tr>
<tr>
<td>login_password</td>
<td>no</td>
<td></td>
<td><ul></ul></td>
<td>The password used to authenticate with</td>
</tr>
<tr>
<td>owner</td>
<td>no</td>
<td></td>
<td><ul></ul></td>
<td>Name of the role to set as owner of the database</td>
</tr>
<tr>
<td>login_user</td>
<td>no</td>
<td></td>
<td><ul></ul></td>
<td>The username used to authenticate with</td>
</tr>
<tr>
<td>login_host</td>
<td>no</td>
<td>localhost</td>
<td><ul></ul></td>
<td>Host running the database</td>
</tr>
</table>
.. raw:: html
<p>Create a new database with name 'acme'</p> <p><pre>
postgresql_db db=acme
</pre></p>
<br/>
.. raw:: html
<h4>Notes</h4>
<p>The default authentication assumes that you are either logging in as or sudo'ing to the postgres account on the host.</p>
<p>This module uses psycopg2, a Python PostgreSQL database adapter. You must ensure that psycopg2 is installed on the host before using this module. If the remote host is the PostgreSQL server (which is the default case), then PostgreSQL must also be installed on the remote host. For Ubuntu-based systems, install the postgresql, libpq-dev, and python-psycopg2 packages on the remote host before using this module.</p>

@ -1,65 +1,108 @@
.. _postgresql_user:
postgresql_user
```````````````
``````````````````````````````
.. versionadded:: 0.6
Add or remove PostgreSQL users (roles) from a remote host and, optionally, grant the users
access to an existing database or tables.
Add or remove PostgreSQL users (roles) from a remote host and, optionally, grant the users access to an existing database or tables.
The fundamental function of the module is to create, or delete, roles from a PostgreSQL cluster. Privilege assignment, or removal, is an optional step, which works on one database at a time. This allows for the module to be called several times in the same module to modify the permissions on different databases, or to grant permissions to already existing users.
A user cannot be removed untill all the privileges have been stripped from the user. In such situation, if the module tries to remove the user it will fail. To avoid this from happening the fail_on_user option signals the module to try to remove the user, but if not possible keep going; the module will report if changes happened and separately if the user was removed or not.
The default authentication assumes that you are either logging in as or
sudo'ing to the postgres account on the host.
.. raw:: html
This module uses psycopg2, a Python PostgreSQL database adapter. You must
ensure that psycopg2 is installed on the host before using this module. If
the remote host is the PostgreSQL server (which is the default case), then
PostgreSQL must also be installed on the remote host. For Ubuntu-based systems,
install the postgresql, libpq-dev, and python-psycopg2 packages on the remote
host before using this module.
<table>
<tr>
<th class="head">parameter</th>
<th class="head">required</th>
<th class="head">default</th>
<th class="head">choices</th>
<th class="head">comments</th>
</tr>
<tr>
<td>name</td>
<td>yes</td>
<td></td>
<td><ul></ul></td>
<td>name of the user (role) to add or remove</td>
</tr>
<tr>
<td>login_user</td>
<td>no</td>
<td>postgres</td>
<td><ul></ul></td>
<td>User (role) used to authenticate with PostgreSQL</td>
</tr>
<tr>
<td>login_host</td>
<td>no</td>
<td>localhost</td>
<td><ul></ul></td>
<td>Host running PostgreSQL.</td>
</tr>
<tr>
<td>db</td>
<td>no</td>
<td></td>
<td><ul></ul></td>
<td>name of database where permissions will be granted</td>
</tr>
<tr>
<td>state</td>
<td>no</td>
<td>present</td>
<td><ul><li>present</li><li>absent</li></ul></td>
<td>The database state</td>
</tr>
<tr>
<td>login_password</td>
<td>no</td>
<td></td>
<td><ul></ul></td>
<td>Password used to authenticate with PostgreSQL</td>
</tr>
<tr>
<td>password</td>
<td>yes</td>
<td></td>
<td><ul></ul></td>
<td>set the user's password</td>
</tr>
<tr>
<td>fail_on_user</td>
<td>no</td>
<td>True</td>
<td><ul><li>yes</li><li>no</li></ul></td>
<td>if yes, fail when user can't be removed. Otherwise just log and continue</td>
</tr>
<tr>
<td>priv</td>
<td>no</td>
<td></td>
<td><ul></ul></td>
<td>PostgreSQL privileges string in the format: <code>table:priv1,priv2</code></td>
</tr>
</table>
+--------------------+----------+----------+----------------------------------------------------------------------------+
| parameter | required | default | comments |
+====================+==========+==========+============================================================================+
| name | yes | | name of the user (role) to add or remove |
+--------------------+----------+----------+----------------------------------------------------------------------------+
| password | yes | | set the user's password |
+--------------------+----------+----------+----------------------------------------------------------------------------+
| db | no | | name of database where permissions will be granted |
+--------------------+----------+----------+----------------------------------------------------------------------------+
| priv | no | | PostgreSQL privileges string in the format: table:priv1,priv2 |
+--------------------+----------+----------+----------------------------------------------------------------------------+
| fail_on_user | no | yes | if yes, fail when user can't be removed. Otherwise just log and continue |
+--------------------+----------+----------+----------------------------------------------------------------------------+
| login_user | no | postgres | user (role) used to authenticate with PostgreSQL |
+--------------------+----------+----------+----------------------------------------------------------------------------+
| login_password | no | | password used to authenticate with PostgreSQL |
+--------------------+----------+----------+----------------------------------------------------------------------------+
| login_host | no | | host running PostgreSQL. Default (blank) implies localhost |
+--------------------+----------+----------+----------------------------------------------------------------------------+
| state | | present | 'absent' or 'present' |
+--------------------+----------+----------+----------------------------------------------------------------------------+
The fundamental function of the module is to create, or delete, roles from a PostgreSQL cluster.
Privilege assignment, or removal, is an optional step, which works on one database at a time.
This allows for the module to be called several times in the same module to modify the permissions on
different databases, or to grant permissions to already existing users.
A user cannot be removed untill all the privileges have been stripped from the user. In such situation,
if the module tries to remove the user it will fail. To avoid this from happening the *fail_on_user* option
signals the module to try to remove the user, but if not possible keep going; the module will report if changes
happened and separately if the user was removed or not.
Example privileges string format:
.. raw:: html
<p>Create django user and grant access to database and products table</p> <p><pre>
postgresql_user db=acme user=django password=ceec4eif7ya priv=CONNECT/products:ALL
</pre></p>
<p>Remove test user privileges from acme</p> <p><pre>
postgresql_user db=acme user=test priv=ALL/products:ALL state=absent fail_on_user=no
</pre></p>
<p>Remove test user from test database and the cluster</p> <p><pre>
postgresql_user db=test user=test priv=ALL state=absent
</pre></p>
<p>Example privileges string format</p> <p><pre>
INSERT,UPDATE/table:SELECT/anothertable:ALL
</pre></p>
<br/>
Example action from Ansible :doc:`playbooks`::
- name: Create django user and grant access to database and products table
postgresql_user db=acme user=django password=ceec4eif7ya priv=CONNECT/products:ALL
.. raw:: html
- name: Remove test user privileges from acme
postgresql_user db=acme user=test priv=ALL/products:ALL state=absent fail_on_user=no
- name: Remove test user from test database and the cluster
postgresql_user db=test user=test priv=ALL state=absent
<h4>Notes</h4>
<p>The default authentication assumes that you are either logging in as or sudo'ing to the postgres account on the host.</p>
<p>This module uses psycopg2, a Python PostgreSQL database adapter. You must ensure that psycopg2 is installed on the host before using this module. If the remote host is the PostgreSQL server (which is the default case), then PostgreSQL must also be installed on the remote host. For Ubuntu-based systems, install the postgresql, libpq-dev, and python-psycopg2 packages on the remote host before using this module.</p>

@ -4,18 +4,13 @@ raw
``````````````````````````````
Executes a low-down and dirty SSH command, not going through the module subsystem. This is useful and should only be done in two cases. The first case is installing python-simplejson on older (Python 2.4 and before) hosts that need it as a dependency to run modules, since nearly all core modules require it. Another is speaking to any devices such as routers that do not have any Python installed. In any other case, using the ``shell`` or ``command`` module is much more appropriate. Arguments given to ``raw`` are run directly through the configured remote shell and only output is returned. There is no error detection or change handler support for this module
.. raw:: html
<p>Example from /usr/bin/ansible to bootstrap a legacy python 2.4 host</p>
<p><pre>
ansible newhost.example.com -m raw -a "yum -y install python-simplejson"</pre></p>
<p>Example from /usr/bin/ansible to bootstrap a legacy python 2.4 host</p> <p><pre>
ansible newhost.example.com -m raw -a "yum -y install python-simplejson"
</pre></p>
<br/>

@ -1,24 +1,54 @@
.. _seboolean:
seboolean
`````````
``````````````````````````````
.. versionadded:: 0.7
Toggles SELinux booleans.
+--------------------+----------+---------------------+----------------------------------------------------------------------------+
| parameter | required | default | comments |
+====================+==========+=====================+============================================================================+
| name | yes | | name of the boolean to configure |
+--------------------+----------+---------------------+----------------------------------------------------------------------------+
| persistent | no | no | set to 'yes' if the boolean setting should survive a reboot |
+--------------------+----------+---------------------+----------------------------------------------------------------------------+
| state | yes | | desired boolean value. 'true' or 'false'. |
+--------------------+----------+---------------------+----------------------------------------------------------------------------+
Example from Ansible :doc:`playbooks`::
Toggles SELinux booleans.
.. raw:: html
<table>
<tr>
<th class="head">parameter</th>
<th class="head">required</th>
<th class="head">default</th>
<th class="head">choices</th>
<th class="head">comments</th>
</tr>
<tr>
<td>state</td>
<td>yes</td>
<td></td>
<td><ul><li>true</li><li>false</li></ul></td>
<td>Desired boolean value</td>
</tr>
<tr>
<td>name</td>
<td>yes</td>
<td></td>
<td><ul></ul></td>
<td>Name of the boolean to configure</td>
</tr>
<tr>
<td>persistent</td>
<td>no</td>
<td></td>
<td><ul><li>yes</li><li>no</li></ul></td>
<td>Set to 'yes' if the boolean setting should survive a reboot</td>
</tr>
</table>
.. raw:: html
<p>Set <em>httpd_can_network_connect</em> SELinux flag to <em>true</em> and <em>persistent</em></p> <p><pre>
seboolean name=httpd_can_network_connect state=true persistent=yes
</pre></p>
<br/>
.. raw:: html
<h4>Notes</h4>
<p>Not tested on any debian based system</p>

@ -1,25 +1,57 @@
.. _selinux:
selinux
```````
``````````````````````````````
.. versionadded:: 0.7
Configures the SELinux mode and policy. A reboot may be required after usage. Ansible will not issue this reboot but
will let you know when it is required.
Configures the SELinux mode and policy. A reboot may be required after usage. Ansible will not issue this reboot but will let you know when it is required.
+--------------------+----------+---------------------+----------------------------------------------------------------------------+
| parameter | required | default | comments |
+====================+==========+=====================+============================================================================+
| policy | yes | | name of the SELinux policy to use (example: 'targeted') |
+--------------------+----------+---------------------+----------------------------------------------------------------------------+
| state | yes | | the SELinux mode. 'enforcing', 'permissive', or 'disabled' |
+--------------------+----------+---------------------+----------------------------------------------------------------------------+
| conf | no | /etc/selinux/config | path to the SELinux configuration file, if non-standard |
+--------------------+----------+---------------------+----------------------------------------------------------------------------+
.. raw:: html
Example from Ansible :doc:`playbooks`::
<table>
<tr>
<th class="head">parameter</th>
<th class="head">required</th>
<th class="head">default</th>
<th class="head">choices</th>
<th class="head">comments</th>
</tr>
<tr>
<td>policy</td>
<td>yes</td>
<td></td>
<td><ul></ul></td>
<td>name of the SELinux policy to use (example: 'targeted')</td>
</tr>
<tr>
<td>state</td>
<td>yes</td>
<td></td>
<td><ul><li>enforcing</li><li>permissive</li><li>disabled</li></ul></td>
<td>The SELinux mode</td>
</tr>
<tr>
<td>conf</td>
<td>no</td>
<td>/etc/selinux/config</td>
<td><ul></ul></td>
<td>path to the SELinux configuration file, if non-standard</td>
</tr>
</table>
.. raw:: html
<p><pre>
selinux policy=targeted state=enforcing
</pre></p>
<p><pre>
selinux policy=targeted state=disabled
</pre></p>
<br/>
.. raw:: html
<h4>Notes</h4>
<p>Not tested on any debian based system</p>

@ -1,32 +1,68 @@
.. _service:
service
```````
Controls services on remote machines.
+--------------------+----------+---------+----------------------------------------------------------------------------+
| parameter | required | default | comments |
+====================+==========+=========+============================================================================+
| name | yes | | name of the service |
+--------------------+----------+---------+----------------------------------------------------------------------------+
| state | no | started | 'started', 'stopped', 'reloaded', or 'restarted'. Started/stopped are |
| | | | idempotent actions that will not run commands unless neccessary. |
| | | | 'restarted' will always bounce the service, 'reloaded' will always reload. |
+--------------------+----------+---------+----------------------------------------------------------------------------+
| pattern | no | | (new in 0.7) if the service does not respond to the status command, |
| | | | name a substring to look for as would be found in the output of the 'ps' |
| | | | command as a stand-in for a status result. If the string is found, the |
| | | | service will be assumed to be running. |
+--------------------+----------+---------+----------------------------------------------------------------------------+
| enabled | no | | Whether the service should start on boot. Either 'yes' or 'no'. |
+--------------------+----------+---------+----------------------------------------------------------------------------+
Example actions from Ansible :doc:`playbooks`::
``````````````````````````````
.. versionadded:: 0.1
Controls services on remote hosts.
.. raw:: html
<table>
<tr>
<th class="head">parameter</th>
<th class="head">required</th>
<th class="head">default</th>
<th class="head">choices</th>
<th class="head">comments</th>
</tr>
<tr>
<td>pattern</td>
<td>no</td>
<td></td>
<td><ul></ul></td>
<td>If the service does not respond to the status command, name a substring to look for as would be found in the output of the <em>ps</em> command as a stand-in for a status result. If the string is found, the servie will be assumed to be running. (added in Ansible 0.7)</td>
</tr>
<tr>
<td>state</td>
<td>no</td>
<td></td>
<td><ul><li>running</li><li>started</li><li>stopped</li><li>restarted</li><li>reloaded</li></ul></td>
<td><em>started</em>, <em>stopped</em>, <em>reloaded</em>, <em>restarted</em>. <em>Started</em>/<em>stopped</em> are idempotent actions that will not run commands unless necessary. <em>restarted</em> will always bounce the service. <em>reloaded</em> will always reload.</td>
</tr>
<tr>
<td>enabled</td>
<td>no</td>
<td></td>
<td><ul><li>yes</li><li>no</li></ul></td>
<td>Whether the service should start on boot.</td>
</tr>
<tr>
<td>name</td>
<td>yes</td>
<td></td>
<td><ul></ul></td>
<td>Name of the service.</td>
</tr>
</table>
.. raw:: html
<p>Example action from Ansible Playbooks</p> <p><pre>
service name=httpd state=started
</pre></p>
<p>Example action from Ansible Playbooks</p> <p><pre>
service name=httpd state=stopped
</pre></p>
<p>Example action from Ansible Playbooks</p> <p><pre>
service name=httpd state=restarted
</pre></p>
<p>Example action from Ansible Playbooks</p> <p><pre>
service name=httpd state=reloaded
</pre></p>
<p>Example action from Ansible Playbooks</p> <p><pre>
service name=foo pattern=/usr/bin/foo state=started
</pre></p>
<br/>

@ -4,18 +4,18 @@ setup
``````````````````````````````
This module is automatically called by playbooks to gather useful variables about remote hosts that can be used in playbooks. It can also be executed directly by ``/usr/bin/ansible`` to check what variables are available to a host. Ansible provides many *facts* about the system, automatically.
.. raw:: html
<p>Obtain facts from all hosts and store them indexed by hostname at /tmp/facts.</p>
<p><pre>
ansible all -m setup -tree /tmp/facts</pre></p>
<p>Obtain facts from all hosts and store them indexed by hostname at /tmp/facts.</p> <p><pre>
ansible all -m setup -tree /tmp/facts
</pre></p>
<br/>
.. raw:: html
<h4>Notes</h4>
<p>More ansible facts will be added with successive releases. If <em>facter</em> or <em>ohai</em> are installed, variables from these programs will also be snapshotted into the JSON file for usage in templating. These variables are prefixed with <code>facter_</code> and <code>ohai_</code> so it's easy to tell their source. All variables are bubbled up to the caller. Using the ansible facts and choosing to not install <em>facter</em> and <em>ohai</em> means you can avoid Ruby-dependencies on your remote systems.</p>

@ -1,31 +1,54 @@
.. _shell:
shell
`````
``````````````````````````````
The shell module takes the command name followed by a list of
arguments, space delimited. It is almost exactly like the command module
but runs the command through the user's configured shell on the remote node.
.. versionadded:: 0.2
+--------------------+----------+---------+----------------------------------------------------------------------------+
| parameter | required | default | comments |
+====================+==========+=========+============================================================================+
| (free form) | N/A | N/A | the command module takes a free form command to run |
+--------------------+----------+---------+----------------------------------------------------------------------------+
| creates | no | | a filename, when it already exists, this step will NOT be run |
+--------------------+----------+---------+----------------------------------------------------------------------------+
| chdir | no | | cd into this directory before running the command (0.6 and later) |
+--------------------+----------+---------+----------------------------------------------------------------------------+
The shell module takes the command name followed by a list of arguments, space delimited. It is almost exactly like the ``command`` module but runs the command through the user's configured shell on the remote node.
The given command will be executed on all selected nodes.
.. raw:: html
.. note::
If you want to execute a command securely and predicably, it may be
better to use the 'command' module instead. Best practices when
writing playbooks will follow the trend of using 'command' unless
'shell' is explicitly required. When running ad-hoc commands, use
your best judgement.
<table>
<tr>
<th class="head">parameter</th>
<th class="head">required</th>
<th class="head">default</th>
<th class="head">choices</th>
<th class="head">comments</th>
</tr>
<tr>
<td>creates</td>
<td>no</td>
<td></td>
<td><ul></ul></td>
<td>a filename, when it already exists, this step will NOT be run</td>
</tr>
<tr>
<td>chdir</td>
<td>no</td>
<td></td>
<td><ul></ul></td>
<td>cd into this directory before running the command (0.6 and later)</td>
</tr>
<tr>
<td>(free form)</td>
<td>no</td>
<td></td>
<td><ul></ul></td>
<td>The command module takes a free form command to run</td>
</tr>
</table>
Example action from a playbook::
.. raw:: html
<p>Execute the command in remote shell</p> <p><pre>
shell somescript.sh >> somelog.txt
</pre></p>
<br/>
.. raw:: html
<h4>Notes</h4>
<p>If you want to execute a command securely and predicably, it may be better to use the <span class='module'>command</span> module instead. Best practices when writing playbooks will follow the trend of using <span class='module'>command</span> unless <span class='module'>shell</span> is explicitly required. When running ad-hoc commands, use your best judgement.</p>

@ -0,0 +1,44 @@
.. _slurp:
slurp
``````````````````````````````
This module works like ``fetch``. It is used for fetching a base64- encoded blob containing the data in a remote file.
.. raw:: html
<table>
<tr>
<th class="head">parameter</th>
<th class="head">required</th>
<th class="head">default</th>
<th class="head">choices</th>
<th class="head">comments</th>
</tr>
<tr>
<td>src</td>
<td>yes</td>
<td></td>
<td><ul></ul></td>
<td>The file on the remote system to fetch. This must be a file, not a directory.</td>
</tr>
</table>
.. raw:: html
<p>Example using <code>/usr/bin/ansible</code></p> <p><pre>
ansible host -m slurp -a 'src=/tmp/xx'
host | success >> {
"content": "aGVsbG8gQW5zaWJsZSB3b3JsZAo=",
"encoding": "base64"
}
</pre></p>
<br/>
.. raw:: html
<h4>Notes</h4>
<p>See also: <span class='module'>fetch</span></p>

@ -1,23 +1,54 @@
.. _subversion:
subversion
``````````
``````````````````````````````
.. versionadded:: 0.7
Deploys a subversion repository.
This module is really simple, so for now this checks out from the given branch of a repo at a particular SHA or tag. Latest is not supported, you should not be doing that.
+--------------------+----------+---------+----------------------------------------------------------------------------+
| parameter | required | default | comments |
+====================+==========+=========+============================================================================+
| repo | yes | | The subversion URL to the repository. |
+--------------------+----------+---------+----------------------------------------------------------------------------+
| dest | yes | | Absolute path where the repository should be deployed. |
+--------------------+----------+---------+----------------------------------------------------------------------------+
| force | no | yes | If yes, any modified files in the working repository will be |
| | | | discarded. If no, this module will fail if it encounters modified files. |
+--------------------+----------+---------+----------------------------------------------------------------------------+
.. raw:: html
Example action from Ansible :doc:`playbooks`::
<table>
<tr>
<th class="head">parameter</th>
<th class="head">required</th>
<th class="head">default</th>
<th class="head">choices</th>
<th class="head">comments</th>
</tr>
<tr>
<td>repo</td>
<td>yes</td>
<td></td>
<td><ul></ul></td>
<td>The subversion URL to the repository.</td>
</tr>
<tr>
<td>dest</td>
<td>yes</td>
<td></td>
<td><ul></ul></td>
<td>Absolute path where the repository should be deployed.</td>
</tr>
<tr>
<td>force</td>
<td>no</td>
<td>True</td>
<td><ul><li>yes</li><li>no</li></ul></td>
<td>If yes, any modified files in the working repository will be discarded. If no, this module will fail if it encounters modified files.</td>
</tr>
</table>
.. raw:: html
<p>Export subversion repository in a specified folder</p> <p><pre>
subversion repo=svn+ssh://an.example.org/path/to/repo dest=/src/checkout
</pre></p>
<br/>
.. raw:: html
<h4>Notes</h4>
<p>Requires subversion and grep on the client.</p>

@ -1,20 +1,42 @@
.. _supervisorctl:
supervisorctl
`````````````
``````````````````````````````
.. versionadded:: 0.7
Manage the state of a program or group of programs running via Supervisord
Manage the state of a program or group of programs running via Supervisord
+--------------------+----------+---------+----------------------------------------------------------------------------+
| parameter | required | default | comments |
+====================+==========+=========+============================================================================+
| name | yes | | The name of the supervisord program/process to manage |
+--------------------+----------+---------+----------------------------------------------------------------------------+
| state | yes | | 'started', 'stopped' or 'restarted' |
+--------------------+----------+---------+----------------------------------------------------------------------------+
.. raw:: html
Example action from a playbook::
<table>
<tr>
<th class="head">parameter</th>
<th class="head">required</th>
<th class="head">default</th>
<th class="head">choices</th>
<th class="head">comments</th>
</tr>
<tr>
<td>state</td>
<td>yes</td>
<td></td>
<td><ul><li>started</li><li>stopped</li><li>restarted</li></ul></td>
<td>The state of service</td>
</tr>
<tr>
<td>name</td>
<td>yes</td>
<td></td>
<td><ul></ul></td>
<td>The name of the supervisord program/process to manage</td>
</tr>
</table>
.. raw:: html
<p>Manage the state of program <em>my_app</em> to be in <em>started</em> state.</p> <p><pre>
supervisorctl name=my_app state=started
</pre></p>
<br/>

@ -1,29 +1,60 @@
.. _template:
template
````````
Templates a file out to a remote server.
Templates are processed by the
`Jinja2 templating language <http://jinja.pocoo.org/docs/>`_ -
documentation on the template formatting can be found in the
`Template Designer Documentation <http://jinja.pocoo.org/docs/templates/>`_
+--------------------+----------+---------+----------------------------------------------------------------------------+
| parameter | required | default | comments |
+====================+==========+=========+============================================================================+
| src | yes | | Path of a Jinja2 formatted template on the local server. This can be |
| | | | a relative or absolute path. |
+--------------------+----------+---------+----------------------------------------------------------------------------+
| dest | yes | | Location to render the template on the remote server |
+--------------------+----------+---------+----------------------------------------------------------------------------+
| backup | no | no | Create a backup file including the timestamp information so you can |
| | | | get the original file back if you somehow clobbered it incorrectly. |
+--------------------+----------+---------+----------------------------------------------------------------------------+
| OTHERS | | | This module also supports all of the arguments to the file module |
+--------------------+----------+---------+----------------------------------------------------------------------------+
Example action from a playbook::
template src=/srv/mytemplates/foo.j2 dest=/etc/foo.conf owner=foo group=foo mode=0644
``````````````````````````````
Templates are processed by the Jinja2 templating language (http://jinja.pocoo.org/docs/) - documentation on the template formatting can be found in the Template Designer Documentation (http://jinja.pocoo.org/docs/templates/).
.. raw:: html
<table>
<tr>
<th class="head">parameter</th>
<th class="head">required</th>
<th class="head">default</th>
<th class="head">choices</th>
<th class="head">comments</th>
</tr>
<tr>
<td>dest</td>
<td>yes</td>
<td></td>
<td><ul></ul></td>
<td>Location to render the template to on the remote machine.</td>
</tr>
<tr>
<td>src</td>
<td>yes</td>
<td></td>
<td><ul></ul></td>
<td>Path of a Jinja2 formatted template on the local server. This can be a relative or absolute path.</td>
</tr>
<tr>
<td>backup</td>
<td>no</td>
<td>no</td>
<td><ul><li>yes</li><li>no</li></ul></td>
<td>Create a backup file including the timestamp information so you can get the original file back if you somehow clobbered it incorrectly.</td>
</tr>
<tr>
<td>others</td>
<td>no</td>
<td></td>
<td><ul></ul></td>
<td>all arguments accepted by the <span class='module'>file</span> module also work here</td>
</tr>
</table>
.. raw:: html
<p>Example from Ansible Playbooks</p> <p><pre>
template src=/mytemplates/foo.j2 dest=/etc/file.conf owner=bin group=wheel mode=0644
</pre></p>
<br/>
.. raw:: html
<h4>Notes</h4>
<p>Since Ansible version 0.9, templates are loaded with <code>trim_blocks=True</code>.</p>

@ -1,47 +1,123 @@
.. _user:
user
````
Creates user accounts, manipulates existing user accounts, and removes user accounts.
+--------------------+----------+---------+----------------------------------------------------------------------------+
| parameter | required | default | comments |
+====================+==========+=========+============================================================================+
| name | yes | | name of the user to create, remove, or edit |
+--------------------+----------+---------+----------------------------------------------------------------------------+
| comment | | | optionally sets the description of the user |
+--------------------+----------+---------+----------------------------------------------------------------------------+
| uid | | | optionally sets the uid of the user |
+--------------------+----------+---------+----------------------------------------------------------------------------+
| group | | | optionally sets the user's primary group (takes a group name) |
+--------------------+----------+---------+----------------------------------------------------------------------------+
| groups | | | puts the user in this comma-delimited list of groups |
+--------------------+----------+---------+----------------------------------------------------------------------------+
| append | | no | if 'yes', will only add groups, not set them to just the list in 'groups' |
+--------------------+----------+---------+----------------------------------------------------------------------------+
| shell | | | optionally set the user's shell |
+--------------------+----------+---------+----------------------------------------------------------------------------+
| createhome | | yes | unless 'no', a home directory will be made for the user |
+--------------------+----------+---------+----------------------------------------------------------------------------+
| home | | | sets where the user's homedir should be, if not the default |
+--------------------+----------+---------+----------------------------------------------------------------------------+
| password | | | optionally set the user's password to this crypted value. See the user's |
| | | | example in the github examples directory for what this looks like in a |
| | | | playbook |
+--------------------+----------+---------+----------------------------------------------------------------------------+
| state | | present | when 'absent', removes the user. |
+--------------------+----------+---------+----------------------------------------------------------------------------+
| system | | no | only when initially creating, setting this to 'yes' makes the user a |
| | | | system account. This setting cannot be changed on existing users. |
+--------------------+----------+---------+----------------------------------------------------------------------------+
| force | | no | when used with state=absent, behavior is as with userdel --force |
+--------------------+----------+---------+----------------------------------------------------------------------------+
| remove | | no | when used with state=absent, behavior is as with userdel --remove |
+--------------------+----------+---------+----------------------------------------------------------------------------+
Example action from Ansible :doc:`playbooks`::
user name=mdehaan comment=awesome password=awWxVV.JvmdHw createhome=yes
user name=mdehaan groups=wheel,skynet
user name=mdehaan state=absent force=yes
``````````````````````````````
.. versionadded:: 0.2
Manage user accounts and user attributes.
.. raw:: html
<table>
<tr>
<th class="head">parameter</th>
<th class="head">required</th>
<th class="head">default</th>
<th class="head">choices</th>
<th class="head">comments</th>
</tr>
<tr>
<td>comment</td>
<td>no</td>
<td></td>
<td><ul></ul></td>
<td>Optionally sets the description (aka <em>GECOS</em>) of user account.</td>
</tr>
<tr>
<td>shell</td>
<td>no</td>
<td></td>
<td><ul></ul></td>
<td>Optionally set the user's shell.</td>
</tr>
<tr>
<td>force</td>
<td>no</td>
<td>no</td>
<td><ul><li>True</li><li>False</li></ul></td>
<td>When used with <em>state=absent</em>, behavior is as with <em>userdel --force</em>.</td>
</tr>
<tr>
<td>name</td>
<td>yes</td>
<td></td>
<td><ul></ul></td>
<td>Name of the user to create, remove or modify.</td>
</tr>
<tr>
<td>createhome</td>
<td>no</td>
<td>yes</td>
<td><ul><li>True</li><li>False</li></ul></td>
<td>Unless set to <em>no</em>, a home directory will be made for the user when the account is created.</td>
</tr>
<tr>
<td>system</td>
<td>no</td>
<td>no</td>
<td><ul><li>True</li><li>False</li></ul></td>
<td>When creating an account, setting this to <em>yes</em> makes the user a system account. This setting cannot be changed on existing users.</td>
</tr>
<tr>
<td>remove</td>
<td>no</td>
<td>no</td>
<td><ul><li>True</li><li>False</li></ul></td>
<td>When used with <em>state=absent</em>, behavior is as with <em>userdel --remove</em>.</td>
</tr>
<tr>
<td>state</td>
<td>no</td>
<td>present</td>
<td><ul><li>present</li><li>absent</li></ul></td>
<td>Whether the account should exist. When <em>absent</em>, removes the user account.</td>
</tr>
<tr>
<td>groups</td>
<td>no</td>
<td></td>
<td><ul></ul></td>
<td>Puts the user in this comma-delimited list of groups.</td>
</tr>
<tr>
<td>home</td>
<td>no</td>
<td></td>
<td><ul></ul></td>
<td>Optionally set the user's home directory.</td>
</tr>
<tr>
<td>group</td>
<td>no</td>
<td></td>
<td><ul></ul></td>
<td>Optionally sets the user's primary group (takes a group name).</td>
</tr>
<tr>
<td>password</td>
<td>no</td>
<td></td>
<td><ul></ul></td>
<td>Optionally set the user's password to this crypted value. See the user example in the github examples directory for what this looks like in a playbook.</td>
</tr>
<tr>
<td>append</td>
<td>no</td>
<td></td>
<td><ul></ul></td>
<td>If <em>yes</em>, will only add groups, not set them to just the list in <em>groups</em>.</td>
</tr>
<tr>
<td>uid</td>
<td>no</td>
<td></td>
<td><ul></ul></td>
<td>Optionally sets the <em>UID</em> of the user.</td>
</tr>
</table>
.. raw:: html
<br/>

@ -1,43 +1,57 @@
.. _virt:
virt
````
Manages virtual machines supported by libvirt. Requires that libvirt be installed
on the managed machine.
+--------------------+----------+---------+----------------------------------------------------------------------------+
| parameter | required | default | comments |
+====================+==========+=========+============================================================================+
| name | yes | | name of the guest VM being managed |
+--------------------+----------+---------+----------------------------------------------------------------------------+
| state | | | 'running', 'shutdown', 'destroyed', or 'undefined'. Note that there may |
| | | | be some lag for state requests like 'shutdown' since these refer only to |
| | | | VM states. After starting a guest, it may not be immediately accessible. |
+--------------------+----------+---------+----------------------------------------------------------------------------+
| command | | | in addition to state management, various non-idempotent commands are |
| | | | available. See examples below. |
+--------------------+----------+---------+----------------------------------------------------------------------------+
Example action from Ansible :doc:`playbooks`::
``````````````````````````````
.. versionadded:: 0.2
Manages virtual machines supported by *libvirt*.
.. raw:: html
<table>
<tr>
<th class="head">parameter</th>
<th class="head">required</th>
<th class="head">default</th>
<th class="head">choices</th>
<th class="head">comments</th>
</tr>
<tr>
<td>state</td>
<td>no</td>
<td>no</td>
<td><ul><li>running</li><li>shutdown</li><li>destroyed</li><li>undefined</li></ul></td>
<td>Note that there may be some lag for state requests like <code>shutdown</code> since these refer only to VM states. After starting a guest, it may not be immediately accessible.</td>
</tr>
<tr>
<td>command</td>
<td>no</td>
<td></td>
<td><ul></ul></td>
<td>in addition to state management, various non-idempotent commands are available. See examples</td>
</tr>
<tr>
<td>name</td>
<td>yes</td>
<td></td>
<td><ul></ul></td>
<td>name of the guest VM being managed</td>
</tr>
</table>
.. raw:: html
<p>Example from Ansible Playbooks</p> <p><pre>
virt guest=alpha state=running
virt guest=alpha state=shutdown
virt guest=alpha state=destroyed
virt guest=alpha state=undefined
Example guest management commands from /usr/bin/ansible::
ansible host -m virt -a "guest=foo command=status"
ansible host -m virt -a "guest=foo command=pause"
ansible host -m virt -a "guest=foo command=unpause"
ansible host -m virt -a "guest=foo command=get_xml"
ansible host -m virt -a "guest=foo command=autostart"
</pre></p>
<p>Example guest management with <code>/usr/bin/ansible</code></p> <p><pre>
ansible host -m virt -a "guest=alpha command=status"
</pre></p>
<br/>
Example host (hypervisor) management commands from /usr/bin/ansible::
.. raw:: html
ansible host -m virt -a "command=freemem"
ansible host -m virt -a "command=list_vms"
ansible host -m virt -a "command=info"
ansible host -m virt -a "command=nodeinfo"
ansible host -m virt -a "command=virttype"
<h4>Notes</h4>
<p>Other non-idempotent commands are: <code>status</code>, <code>pause</code>, <code>unpause</code>, <code>get_xml</code>, <code>autostart</code>, <code>freemem</code>, <code>list_vms</code>, <code>info</code>, <code>nodeinfo</code>, <code>virttype</code></p>

@ -1,32 +1,63 @@
.. _wait_for:
wait_for
````````
``````````````````````````````
.. versionadded:: 0.7
Waits for a given port to become accessible (or inaccessible) on a local or remote server.
This is useful for when services are not immediately available after their init scripts return -- which is true of certain
Java application servers. It is also useful when starting guests with the virt module and
needing to pause until they are ready.
+--------------------+----------+-----------+----------------------------------------------------------------------------+
| parameter | required | default | comments |
+====================+==========+===========+============================================================================+
| host | no | 127.0.0.1 | hostname or IP to wait for |
+--------------------+----------+-----------+----------------------------------------------------------------------------+
| timeout | no | 300 | maximum number of seconds to wait |
+--------------------+----------+-----------+----------------------------------------------------------------------------+
| delay | no | 0 | number of seconds to wait before starting to poll |
+--------------------+----------+-----------+----------------------------------------------------------------------------+
| port | yes | | port to poll for openness or closedness |
+--------------------+----------+-----------+----------------------------------------------------------------------------+
| state | no | started | either 'started', or 'stopped' depending on whether the module should poll |
| | | | for the port being open or closed. |
+--------------------+----------+-----------+----------------------------------------------------------------------------+
Example from Ansible :doc:`playbooks`::
wait_for port=8080 delay=10
This is useful for when services are not immediately available after their init scripts return - which is true of certain Java application servers. It is also useful when starting guests with the ``virt`` module and needing to pause until they are ready.
.. raw:: html
<table>
<tr>
<th class="head">parameter</th>
<th class="head">required</th>
<th class="head">default</th>
<th class="head">choices</th>
<th class="head">comments</th>
</tr>
<tr>
<td>delay</td>
<td>no</td>
<td></td>
<td><ul></ul></td>
<td>number of seconds to wait before starting to poll</td>
</tr>
<tr>
<td>host</td>
<td>no</td>
<td>127.0.0.1</td>
<td><ul></ul></td>
<td>hostname or IP address to wait for</td>
</tr>
<tr>
<td>port</td>
<td>yes</td>
<td></td>
<td><ul></ul></td>
<td>port number to poll</td>
</tr>
<tr>
<td>timeout</td>
<td>no</td>
<td>300</td>
<td><ul></ul></td>
<td>maximum number of seconds to wait for</td>
</tr>
<tr>
<td>state</td>
<td>no</td>
<td>started</td>
<td><ul><li>started</li><li>stopped</li></ul></td>
<td>either <code>started</code>, or <code>stopped</code> depending on whether the module should poll for the port being open or closed.</td>
</tr>
</table>
.. raw:: html
<p>Example from Ansible Playbooks</p> <p><pre>
wait_for port=8000 delay=10
</pre></p>
<br/>

@ -1,23 +1,54 @@
.. _yum:
yum
```
``````````````````````````````
Will install, upgrade, remove, and list packages with the yum package manager.
+--------------------+----------+---------+----------------------------------------------------------------------------+
| parameter | required | default | comments |
+====================+==========+=========+============================================================================+
| name | yes | | package name, or package specifier with version, like 'name-1.0' |
+--------------------+----------+---------+----------------------------------------------------------------------------+
| state | | present | 'present', 'latest', or 'absent'. |
+--------------------+----------+---------+----------------------------------------------------------------------------+
| list | | | various non-idempotent commands for usage with /usr/bin/ansible and not |
| | | | playbooks. See examples below. |
+--------------------+----------+---------+----------------------------------------------------------------------------+
Will install, upgrade, remove, and list packages with the *yum* package manager.
Example action from Ansible :doc:`playbooks`::
.. raw:: html
<table>
<tr>
<th class="head">parameter</th>
<th class="head">required</th>
<th class="head">default</th>
<th class="head">choices</th>
<th class="head">comments</th>
</tr>
<tr>
<td>state</td>
<td>no</td>
<td>present</td>
<td><ul><li>present</li><li>latest</li><li>absent</li></ul></td>
<td>whether to install (<code>present</code>, <code>latest</code>), or remove (<code>absent</code>) a package.</td>
</tr>
<tr>
<td>list</td>
<td>no</td>
<td></td>
<td><ul></ul></td>
<td>various non-idempotent commands for usage with <code>/usr/bin/ansible</code> and <em>not</em> playbooks. See examples.</td>
</tr>
<tr>
<td>name</td>
<td>yes</td>
<td></td>
<td><ul></ul></td>
<td>package name, or package specifier with version, like <code>name-1.0</code>.</td>
</tr>
</table>
.. raw:: html
<p><pre>
yum name=httpd state=latest
</pre></p>
<p><pre>
yum name=httpd state=removed
</pre></p>
<p><pre>
yum name=httpd state=installed
</pre></p>
<br/>

@ -37,10 +37,10 @@ after the hostname with a colon.
four.example.com:5309
In 0.6 and later, if you have a lot of hosts following similar patterns you can do this::
In 0.6 and later, if you have a lot of hosts following similar patterns you can do this rather than listing each hostname::
[webservers]
www[01-50].example.com
www[01:50].example.com
Leading zeros can be included or removed, as desired, and the ranges are inclusive.

@ -200,7 +200,7 @@ s.parentNode.insertBefore(ga, s);
<p>
<p>
&copy; Copyright 2012 Michael DeHaan.<br/>
Last updated on Sep 28, 2012.<br/>
Last updated on Oct 03, 2012.<br/>
</p>
</div>
</footer>

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