<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>
<spanid="id2"></span><h2><aclass="toc-backref"href="#contents">apt_repository</a><aclass="headerlink"href="#apt-repository"title="Permalink to this headline">¶</a></h2>
<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 <ahref='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></div>
<divclass="section"id="assemble">
<spanid="id3"></span><h2><aclass="toc-backref"href="#contents">assemble</a><aclass="headerlink"href="#assemble"title="Permalink to this headline">¶</a></h2>
<spanclass="versionmodified">New in version 0.5.</span></p>
<p>Assembles a configuration file from fragments. Often a particular program will take a single configuration file and does not support a <ttclass="docutils literal"><spanclass="pre">conf.d</span></tt> 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 <em>fragments</em>.</p>
<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>
<spanid="id4"></span><h2><aclass="toc-backref"href="#contents">async_status</a><aclass="headerlink"href="#async-status"title="Permalink to this headline">¶</a></h2>
<spanclass="versionmodified">New in version 0.5.</span></p>
<p>This module gets the status of an asynchronous task. See: <aclass="reference external"href="http://ansible.cc/docs/playbooks2.html#asynchronous-actions-and-polling">http://ansible.cc/docs/playbooks2.html#asynchronous-actions-and-polling</a></p>
<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>
<spanid="id5"></span><h2><aclass="toc-backref"href="#contents">authorized_key</a><aclass="headerlink"href="#authorized-key"title="Permalink to this headline">¶</a></h2>
<spanid="id6"></span><h2><aclass="toc-backref"href="#contents">command</a><aclass="headerlink"href="#command"title="Permalink to this headline">¶</a></h2>
<p>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 <ttclass="docutils literal"><spanclass="pre">$HOME</span></tt> and operations like <ttclass="docutils literal"><spanclass="pre">"<"</span></tt>, <ttclass="docutils literal"><spanclass="pre">">"</span></tt>, <ttclass="docutils literal"><spanclass="pre">"|"</span></tt>, and <ttclass="docutils literal"><spanclass="pre">"&"</span></tt> will not work. As such, all paths to commands must be fully qualified</p>
<td>a filename, when it does not exist, this step will <b>not</b> be run. (added in Ansible 0.8)</td>
</tr>
</table><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>
<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 <spanclass='module'>shell</span> module instead. The <spanclass='module'>command</span> module is much more secure as it's not affected by the user's environment.</p></div>
<divclass="section"id="copy">
<spanid="id7"></span><h2><aclass="toc-backref"href="#contents">copy</a><aclass="headerlink"href="#copy"title="Permalink to this headline">¶</a></h2>
<p>The <ttclass="docutils literal"><spanclass="pre">copy</span></tt> module copies a file on the local box to remote locations.</p>
<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>
<spanid="id8"></span><h2><aclass="toc-backref"href="#contents">cron</a><aclass="headerlink"href="#cron"title="Permalink to this headline">¶</a></h2>
<pclass="versionadded">
<spanclass="versionmodified">New in version 0.9.</span></p>
<p>Use this module to manage crontab entries. This module allows you to create named crontab entries, update, or delete them.
The module include one line with the description of the crontab entry “#Ansible: <name>” corresponding to the “name” passed to the module, which is used by future ansible/module calls to find/check the state.</p>
<table>
<tr>
<thclass="head">parameter</th>
<thclass="head">required</th>
<thclass="head">default</th>
<thclass="head">choices</th>
<thclass="head">comments</th>
</tr>
<tr>
<td>name</td>
<td>yes</td>
<td></td>
<td><ul></ul></td>
<td>Description of a crontab entry.</td>
</tr>
<tr>
<td>hour</td>
<td>no</td>
<td>*</td>
<td><ul></ul></td>
<td>Hour when the job should run ( 0-23, *, */2, etc )</td>
</tr>
<tr>
<td>job</td>
<td>no</td>
<td></td>
<td><ul></ul></td>
<td>The command to execute.Required if state=present.</td>
</tr>
<tr>
<td>month</td>
<td>no</td>
<td>*</td>
<td><ul></ul></td>
<td>Month of the year the job should run ( 1-12, *, */2, etc )</td>
</tr>
<tr>
<td>state</td>
<td>no</td>
<td>present</td>
<td><ul></ul></td>
<td>Whether to ensure the job is present or absent.</td>
</tr>
<tr>
<td>user</td>
<td>no</td>
<td>root</td>
<td><ul></ul></td>
<td>The specific user who's crontab should be modified.</td>
</tr>
<tr>
<td>backup</td>
<td>no</td>
<td></td>
<td><ul></ul></td>
<td>If set, then create a backup of the crontab before it is modified.The location of the backup is returned in the 'backup' variable by this module.</td>
</tr>
<tr>
<td>day</td>
<td>no</td>
<td>*</td>
<td><ul></ul></td>
<td>Day of the month the job should run ( 1-31, *, */2, etc )</td>
</tr>
<tr>
<td>minute</td>
<td>no</td>
<td>*</td>
<td><ul></ul></td>
<td>Minute when the job should run ( 0-59, *, */2, etc )</td>
</tr>
<tr>
<td>weekday</td>
<td>no</td>
<td>*</td>
<td><ul></ul></td>
<td>Day of the week that the job should run ( 0-7 for Sunday - Saturday, or mon, tue, * etc )</td>
</tr>
</table><p>Ensure a job that runs at 2 and 5 exists. Creates an entry like "* 5,2 * * ls -alh > /dev/null"</p><p><pre>
<p>Ensure an old job is no longer present. Removes any job that is preceded by "#Ansible: an old job" in the crontab</p><p><pre>
name="an old job" cron job="/some/dir/job.sh" state=absent
</pre></p>
<br/></div>
<divclass="section"id="debug">
<spanid="id9"></span><h2><aclass="toc-backref"href="#contents">debug</a><aclass="headerlink"href="#debug"title="Permalink to this headline">¶</a></h2>
<pclass="versionadded">
<spanclass="versionmodified">New in version 0.8.</span></p>
<p>This module prints statements during execution and can be useful for debugging variables or expressions without necessarily halting the playbook. Useful for debugging together with the only_if directive.
In order to see the debug message, you need to run ansible in verbose mode (using the -v option).</p>
<table>
<tr>
<thclass="head">parameter</th>
<thclass="head">required</th>
<thclass="head">default</th>
<thclass="head">choices</th>
<thclass="head">comments</th>
</tr>
<tr>
<td>msg</td>
<td>no</td>
<td>Hello world!</td>
<td><ul></ul></td>
<td>The customized message that is printed. If ommited, prints a generic message.</td>
</tr>
<tr>
<td>fail</td>
<td>no</td>
<td>no</td>
<td><ul></ul></td>
<td>A boolean that indicates whether the debug module should fail or not.</td>
</tr>
<tr>
<td>rc</td>
<td>no</td>
<td></td>
<td><ul></ul></td>
<td>The return code of the module. If fail=yes, this will default to 1.</td>
</tr>
</table><p>Example that prints the loopback address and gateway for each host</p><p><pre>
[{'local_action': 'debug msg="System $inventory_hostname has uuid $ansible_product_uuid"'}, {'only_if': "is_unset('${ansible_default_ipv4.gateway}')", 'local_action': 'debug msg="System $inventory_hostname lacks a gateway" fail=yes'}, {'only_if': "is_set('${ansible_default_ipv4.gateway}')", 'local_action': 'debug msg="System $inventory_hostname has gateway ${ansible_default_ipv4.gateway}"'}]
<spanid="id10"></span><h2><aclass="toc-backref"href="#contents">easy_install</a><aclass="headerlink"href="#easy-install"title="Permalink to this headline">¶</a></h2>
<p>Please note that the <spanclass='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 <spanclass='module'>pip</span> module which you can first install using <spanclass='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></div>
<spanid="id11"></span><h2><aclass="toc-backref"href="#contents">facter</a><aclass="headerlink"href="#facter"title="Permalink to this headline">¶</a></h2>
<p>Runs the <em>facter</em> discovery program (<aclass="reference external"href="https://github.com/puppetlabs/facter">https://github.com/puppetlabs/facter</a>) on the remote system, returning JSON data that can be useful for inventory purposes.</p>
</table><p>Example playbook using fail and only_if together</p><p><pre>
action: fail msg="The system may not be provisioned according to the CMDB status." rc=100<p>only_if: “’$cmdb_status’ != ‘to-be-staged’”</p>
<spanid="id13"></span><h2><aclass="toc-backref"href="#contents">fetch</a><aclass="headerlink"href="#fetch"title="Permalink to this headline">¶</a></h2>
<spanclass="versionmodified">New in version 0.2.</span></p>
<p>This module works like <ttclass="docutils literal"><spanclass="pre">copy</span></tt>, but in reverse. It is used for fetching files from remote machines and storing them locally in a file tree, organized by hostname.</p>
<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>
<p>Sets attributes of files, symlinks, and directories, or removes files/symlinks/directories. Many other modules support the same options as the file module - including <ttclass="docutils literal"><spanclass="pre">copy</span></tt>, <ttclass="docutils literal"><spanclass="pre">template</span></tt>, and <ttclass="docutils literal"><spanclass="pre">assmeble</span></tt>.</p>
<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>
<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>
<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>
<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 <spanclass='module'>copy</span> or <spanclass='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>
<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>
<spanid="id15"></span><h2><aclass="toc-backref"href="#contents">fireball</a><aclass="headerlink"href="#fireball"title="Permalink to this headline">¶</a></h2>
<spanclass="versionmodified">New in version 0.9.</span></p>
<p>This modules launches an ephemeral <em>fireball</em> 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.
</table><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>
<spanid="id16"></span><h2><aclass="toc-backref"href="#contents">get_url</a><aclass="headerlink"href="#get-url"title="Permalink to this headline">¶</a></h2>
<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>
<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>
<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>
<spanid="id18"></span><h2><aclass="toc-backref"href="#contents">group</a><aclass="headerlink"href="#group"title="Permalink to this headline">¶</a></h2>
<spanid="id19"></span><h2><aclass="toc-backref"href="#contents">hpilo_boot</a><aclass="headerlink"href="#hpilo-boot"title="Permalink to this headline">¶</a></h2>
<pclass="versionadded">
<spanclass="versionmodified">New in version 0.8.</span></p>
<p>This module boots a system through its HP iLO interface. The boot media can be one of: cdrom, floppy, hdd, network or usb.
This module requires the hpilo python module.</p>
<table>
<tr>
<thclass="head">parameter</th>
<thclass="head">required</th>
<thclass="head">default</th>
<thclass="head">choices</th>
<thclass="head">comments</th>
</tr>
<tr>
<td>force</td>
<td>no</td>
<td></td>
<td><ul><li>yes</li><li>no</li></ul></td>
<td>Whether to force a reboot (even when the system is already booted)</td>
<td>The URL of a cdrom, floppy or usb boot media image. <code>protocol://username:password@hostname:port/filename</code>protocol is either <code>http</code> or <code>https</code>username:password is optionalport is optional</td>
</tr>
<tr>
<td>host</td>
<td>yes</td>
<td></td>
<td><ul></ul></td>
<td>The HP iLO hostname/address that is linked to the physical system.</td>
<td>The state of the boot media.no_boot: Do not boot from the deviceboot_once: Boot from the device once and then notthereafterboot_always: Boot from the device each time the serveris rebootedconnect: Connect the virtual media device and set to boot_alwaysdisconnect: Disconnects the virtual media device and set to no_boot</td>
</tr>
<tr>
<td>login</td>
<td>no</td>
<td>Administrator</td>
<td><ul></ul></td>
<td>The login name to authenticate to the HP iLO interface.</td>
</tr>
<tr>
<td>password</td>
<td>no</td>
<td>admin</td>
<td><ul></ul></td>
<td>The password to authenticate to the HP iLO interface.</td>
</tr>
<tr>
<td>match</td>
<td>no</td>
<td></td>
<td><ul></ul></td>
<td>An optional string to match against the iLO server name.This is a safety measure to prevent accidentally using the wrong HP iLO interface with dire consequences.</td>
</tr>
</table><p>Task to boot a system using an ISO from an HP iLO interface only if the system is an HP server</p><p><pre>
<p>To use a USB key image you need to specify floppy as boot media.</p>
<p>This module ought to be run from a system that can access the HP iLO interface directly, either by using <code>local_action</code> or <code>using delegate</code>_to.</p></div>
<divclass="section"id="hpilo-facts">
<spanid="id20"></span><h2><aclass="toc-backref"href="#contents">hpilo_facts</a><aclass="headerlink"href="#hpilo-facts"title="Permalink to this headline">¶</a></h2>
<pclass="versionadded">
<spanclass="versionmodified">New in version 0.8.</span></p>
<p>This module gathers facts for a specific system using its HP iLO interface. These facts include hardware and network related information useful for provisioning (e.g. macaddress, uuid).
This module requires the hpilo python module.</p>
<table>
<tr>
<thclass="head">parameter</th>
<thclass="head">required</th>
<thclass="head">default</th>
<thclass="head">choices</th>
<thclass="head">comments</th>
</tr>
<tr>
<td>host</td>
<td>yes</td>
<td></td>
<td><ul></ul></td>
<td>The HP iLO hostname/address that is linked to the physical system.</td>
</tr>
<tr>
<td>password</td>
<td>no</td>
<td>admin</td>
<td><ul></ul></td>
<td>The password to authenticate to the HP iLO interface.</td>
</tr>
<tr>
<td>login</td>
<td>no</td>
<td>Administrator</td>
<td><ul></ul></td>
<td>The login name to authenticate to the HP iLO interface.</td>
</tr>
<tr>
<td>match</td>
<td>no</td>
<td></td>
<td><ul></ul></td>
<td>An optional string to match against the iLO server name.This is a safety measure to prevent accidentally using the wrong HP iLO interface with dire consequences.</td>
</tr>
</table><p>Task to gather facts from a HP iLO interface only if the system is an HP server</p><p><pre>
<p>This module ought to be run from a system that can access the HP iLO interface directly, either by using <code>local_action</code> or <code>using delegate</code>_to.</p></div>
<spanid="id21"></span><h2><aclass="toc-backref"href="#contents">ini_file</a><aclass="headerlink"href="#ini-file"title="Permalink to this headline">¶</a></h2>
<spanclass="versionmodified">New in version 0.9.</span></p>
<p>Manage (add, remove, change) individual settings in an INI-style file without having to manage the file as a whole with, say, <ttclass="docutils literal"><spanclass="pre">template</span></tt> or <ttclass="docutils literal"><spanclass="pre">assemble</span></tt>. Adds missing sections if they don’t exist.</p>
<spanid="id22"></span><h2><aclass="toc-backref"href="#contents">lineinfile</a><aclass="headerlink"href="#lineinfile"title="Permalink to this headline">¶</a></h2>
<spanclass="versionmodified">New in version 0.7.</span></p>
<p>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 <ttclass="docutils literal"><spanclass="pre">copy</span></tt> or <ttclass="docutils literal"><spanclass="pre">template</span></tt> modules.</p>
<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>
<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>
<spanid="id23"></span><h2><aclass="toc-backref"href="#contents">mount</a><aclass="headerlink"href="#mount"title="Permalink to this headline">¶</a></h2>
<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>
<spanid="id24"></span><h2><aclass="toc-backref"href="#contents">mysql_db</a><aclass="headerlink"href="#mysql-db"title="Permalink to this headline">¶</a></h2>
<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></div>
<spanid="id25"></span><h2><aclass="toc-backref"href="#contents">mysql_user</a><aclass="headerlink"href="#mysql-user"title="Permalink to this headline">¶</a></h2>
<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></div>
<spanid="id26"></span><h2><aclass="toc-backref"href="#contents">nagios</a><aclass="headerlink"href="#nagios"title="Permalink to this headline">¶</a></h2>
<spanclass="versionmodified">New in version 0.7.</span></p>
<p>The <ttclass="docutils literal"><spanclass="pre">nagios</span></tt> module has two basic functions: scheduling downtime and toggling alerts for services or hosts.
All actions require the <ttclass="docutils literal"><spanclass="pre">host</span></tt> parameter to be given explicitly. In playbooks you can use the <ttclass="docutils literal"><spanclass="pre">$inventory_hostname</span></tt> 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., <ttclass="docutils literal"><spanclass="pre">services=httpd,nfs,puppet</span></tt>.
When specifying what service to handle there is a special service value, <em>host</em>, which will handle alerts/downtime for the <em>host itself</em>, e.g., <ttclass="docutils literal"><spanclass="pre">service=host</span></tt>. This keyword may not be given with other services at the same time. <em>Setting alerts/downtime for a host does not affect alerts/downtime for any of the services running on it.</em>
When using the <ttclass="docutils literal"><spanclass="pre">nagios</span></tt> module you will need to specify your nagios server using the <ttclass="docutils literal"><spanclass="pre">delegate_to</span></tt> parameter.</p>
<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>
<spanclass="versionmodified">New in version 0.6.</span></p>
<p>Similar to the <ttclass="docutils literal"><spanclass="pre">facter</span></tt> module, this runs the <em>ohai</em> discovery program (<aclass="reference external"href="http://wiki.opscode.com/display/chef/Ohai">http://wiki.opscode.com/display/chef/Ohai</a>) on the remote host and returns JSON inventory data. <em>Ohai</em> data is a bit more verbose and nested than <em>facter</em>.</p>
<p>Retrieve <em>ohai</em> data from all Web servers and store in one-file per host</p><p><pre>
<spanid="id28"></span><h2><aclass="toc-backref"href="#contents">pause</a><aclass="headerlink"href="#pause"title="Permalink to this headline">¶</a></h2>
<spanclass="versionmodified">New in version 0.8.</span></p>
<p>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 <ttclass="docutils literal"><spanclass="pre">ctrl+c</span></tt> 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 <ttclass="docutils literal"><spanclass="pre">ctrl+c</span></tt> and then <ttclass="docutils literal"><spanclass="pre">c</span></tt>. To abort a playbook: press <ttclass="docutils literal"><spanclass="pre">ctrl+c</span></tt> and then <ttclass="docutils literal"><spanclass="pre">a</span></tt>.
The pause module integrates into async/parallelized playbooks without any special considerations (see also: Rolling Updates). When using pauses with the <ttclass="docutils literal"><spanclass="pre">serial</span></tt> playbook parameter (as in rolling updates) you are only prompted once for the current group of hosts.</p>
<p>A trivial test module, this module always returns ‘pong’ on successful contact. It does not make sense in playbooks, but is useful from <ttclass="docutils literal"><spanclass="pre">/usr/bin/ansible</span></tt></p>
<p>Please note that <ahref='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></div>
<spanid="id31"></span><h2><aclass="toc-backref"href="#contents">postgresql_db</a><aclass="headerlink"href="#postgresql-db"title="Permalink to this headline">¶</a></h2>
<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></div>
<spanid="id32"></span><h2><aclass="toc-backref"href="#contents">postgresql_user</a><aclass="headerlink"href="#postgresql-user"title="Permalink to this headline">¶</a></h2>
<p>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.</p>
<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></div>
<p>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 <ttclass="docutils literal"><spanclass="pre">shell</span></tt> or <ttclass="docutils literal"><spanclass="pre">command</span></tt> module is much more appropriate. Arguments given to <ttclass="docutils literal"><spanclass="pre">raw</span></tt> 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</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"
<spanid="id34"></span><h2><aclass="toc-backref"href="#contents">seboolean</a><aclass="headerlink"href="#seboolean"title="Permalink to this headline">¶</a></h2>
<spanid="id35"></span><h2><aclass="toc-backref"href="#contents">selinux</a><aclass="headerlink"href="#selinux"title="Permalink to this headline">¶</a></h2>
<spanclass="versionmodified">New in version 0.7.</span></p>
<p>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.</p>
<spanid="id36"></span><h2><aclass="toc-backref"href="#contents">service</a><aclass="headerlink"href="#service"title="Permalink to this headline">¶</a></h2>
<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 service will be assumed to be running. (added in Ansible 0.7)</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>
<spanid="id37"></span><h2><aclass="toc-backref"href="#contents">setup</a><aclass="headerlink"href="#setup"title="Permalink to this headline">¶</a></h2>
<p>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 <ttclass="docutils literal"><spanclass="pre">/usr/bin/ansible</span></tt> to check what variables are available to a host. Ansible provides many <em>facts</em> about the system, automatically.</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/><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></div>
<spanid="id38"></span><h2><aclass="toc-backref"href="#contents">shell</a><aclass="headerlink"href="#shell"title="Permalink to this headline">¶</a></h2>
<p>The shell module takes the command name followed by a list of arguments, space delimited. It is almost exactly like the <ttclass="docutils literal"><spanclass="pre">command</span></tt> module but runs the command through a shell (<ttclass="docutils literal"><spanclass="pre">/bin/sh</span></tt>) on the remote node.</p>
<p>If you want to execute a command securely and predicably, it may be better to use the <spanclass='module'>command</span> module instead. Best practices when writing playbooks will follow the trend of using <spanclass='module'>command</span> unless <spanclass='module'>shell</span> is explicitly required. When running ad-hoc commands, use your best judgement.</p></div>
<spanid="id39"></span><h2><aclass="toc-backref"href="#contents">slurp</a><aclass="headerlink"href="#slurp"title="Permalink to this headline">¶</a></h2>
<p>This module works like <ttclass="docutils literal"><spanclass="pre">fetch</span></tt>. It is used for fetching a base64- encoded blob containing the data in a remote file.</p>
<spanid="id40"></span><h2><aclass="toc-backref"href="#contents">subversion</a><aclass="headerlink"href="#subversion"title="Permalink to this headline">¶</a></h2>
<spanclass="versionmodified">New in version 0.7.</span></p>
<p>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.</p>
<spanid="id41"></span><h2><aclass="toc-backref"href="#contents">supervisorctl</a><aclass="headerlink"href="#supervisorctl"title="Permalink to this headline">¶</a></h2>
<spanid="id42"></span><h2><aclass="toc-backref"href="#contents">template</a><aclass="headerlink"href="#template"title="Permalink to this headline">¶</a></h2>
<p>Templates are processed by the Jinja2 templating language (<aclass="reference external"href="http://jinja.pocoo.org/docs/">http://jinja.pocoo.org/docs/</a>) - documentation on the template formatting can be found in the Template Designer Documentation (<aclass="reference external"href="http://jinja.pocoo.org/docs/templates/">http://jinja.pocoo.org/docs/templates/</a>).</p>
<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>
<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>
<spanid="id45"></span><h2><aclass="toc-backref"href="#contents">vsphere_facts</a><aclass="headerlink"href="#vsphere-facts"title="Permalink to this headline">¶</a></h2>
<pclass="versionadded">
<spanclass="versionmodified">New in version 0.8.</span></p>
<p>This module gathers facts for a specific guest on VMWare vSphere. These facts include hardware and network related information useful for provisioning (e.g. macaddress, uuid).
This module requires the pysphere python module.</p>
<table>
<tr>
<thclass="head">parameter</th>
<thclass="head">required</th>
<thclass="head">default</th>
<thclass="head">choices</th>
<thclass="head">comments</th>
</tr>
<tr>
<td>host</td>
<td>yes</td>
<td></td>
<td><ul></ul></td>
<td>The vSphere server from the cluster the virtual server is located on.</td>
</tr>
<tr>
<td>password</td>
<td>yes</td>
<td></td>
<td><ul></ul></td>
<td>The password to authenticate on the vSphere cluster.</td>
</tr>
<tr>
<td>login</td>
<td>yes</td>
<td></td>
<td><ul></ul></td>
<td>The login name to authenticate on the vSphere cluster.</td>
</tr>
<tr>
<td>guest</td>
<td>yes</td>
<td></td>
<td><ul></ul></td>
<td>The virtual server to gather facts for on the vSphere cluster.</td>
</tr>
</table><p>Task to gather facts from a vSphere cluster only if the system is a VMWare guest</p><p><pre>
<p>This module ought to be run from a system that can access vSphere directly. Either by using <code>local_action</code>, or <code>using delegate</code>_to.</p></div>
<spanid="id46"></span><h2><aclass="toc-backref"href="#contents">wait_for</a><aclass="headerlink"href="#wait-for"title="Permalink to this headline">¶</a></h2>
<spanclass="versionmodified">New in version 0.7.</span></p>
<p>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 <ttclass="docutils literal"><spanclass="pre">virt</span></tt> module and needing to pause until they are ready.</p>
<h2><aclass="toc-backref"href="#contents">Additional Contrib Modules</a><aclass="headerlink"href="#additional-contrib-modules"title="Permalink to this headline">¶</a></h2>
<p>In addition to the following built-in modules, community modules are available at <aclass="reference external"href="http://github.com/ansible/ansible-resources">Ansible Resources</a>.</p>
<h2><aclass="toc-backref"href="#contents">Writing your own modules</a><aclass="headerlink"href="#writing-your-own-modules"title="Permalink to this headline">¶</a></h2>