mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Update the format of the modules page to use tables.
This commit is contained in:
parent
58cb60c8af
commit
db19d83e40
3 changed files with 788 additions and 561 deletions
863
modules.html
863
modules.html
|
@ -210,9 +210,8 @@ ansible webservers -m ping
|
||||||
ansible webservers -m command -a "/sbin/reboot -t now"</pre>
|
ansible webservers -m command -a "/sbin/reboot -t now"</pre>
|
||||||
</div>
|
</div>
|
||||||
<p>Each module supports taking arguments. Nearly all modules take <tt class="docutils literal"><span class="pre">key=value</span></tt>
|
<p>Each module supports taking arguments. Nearly all modules take <tt class="docutils literal"><span class="pre">key=value</span></tt>
|
||||||
arguments, space delimited. Some modules take
|
arguments, space delimited. Some modules take no arguments, and the
|
||||||
no arguments, and the command/shell modules simply take the string
|
command/shell modules simply take the string of the command you want to run.</p>
|
||||||
of the command you want to run.</p>
|
|
||||||
<p>From playbooks, Ansible modules are executed in a very similar way:</p>
|
<p>From playbooks, Ansible modules are executed in a very similar way:</p>
|
||||||
<div class="highlight-python"><pre>- name: reboot the servers
|
<div class="highlight-python"><pre>- name: reboot the servers
|
||||||
action: command /sbin/reboot -t now</pre>
|
action: command /sbin/reboot -t now</pre>
|
||||||
|
@ -229,34 +228,56 @@ noted, any given module does support change hooks.</p>
|
||||||
<div class="section" id="apt">
|
<div class="section" id="apt">
|
||||||
<span id="id1"></span><h2>apt<a class="headerlink" href="#apt" title="Permalink to this headline">¶</a></h2>
|
<span id="id1"></span><h2>apt<a class="headerlink" href="#apt" title="Permalink to this headline">¶</a></h2>
|
||||||
<p>Manages apt-packages (such as for Debian/Ubuntu).</p>
|
<p>Manages apt-packages (such as for Debian/Ubuntu).</p>
|
||||||
<p><em>pkg</em>:</p>
|
<table border="1" class="docutils">
|
||||||
<ul class="simple">
|
<colgroup>
|
||||||
<li>A package name or package specifier with version, like <cite>foo</cite>, or <cite>foo=1.0</cite> to install a specific version of the foo package.</li>
|
<col width="17%" />
|
||||||
</ul>
|
<col width="9%" />
|
||||||
<p><em>state</em>:</p>
|
<col width="8%" />
|
||||||
<ul class="simple">
|
<col width="66%" />
|
||||||
<li>Can be either ‘installed’, ‘removed’, or ‘latest’. The default is ‘installed’. (In 0.4 and later, the aliases ‘absent’ and ‘present’ can also be used. They correspond with ‘removed’ and ‘installed’)</li>
|
</colgroup>
|
||||||
</ul>
|
<thead valign="bottom">
|
||||||
<p><em>update-cache</em>:</p>
|
<tr><th class="head">parameter</th>
|
||||||
<ul class="simple">
|
<th class="head">required</th>
|
||||||
<li>Whether the apt cache must be updated prior to operation. This is equivalent
|
<th class="head">default</th>
|
||||||
to doing “apt-get update”. Optional, and can be
|
<th class="head">comments</th>
|
||||||
‘yes’, or ‘no’. The default is ‘no’. This can be done as the part of a
|
</tr>
|
||||||
package operation or as a seperate step.</li>
|
</thead>
|
||||||
</ul>
|
<tbody valign="top">
|
||||||
<p><em>purge</em>:</p>
|
<tr><td>name</td>
|
||||||
<ul class="simple">
|
<td>no</td>
|
||||||
<li>Will force purge of configuration file for when ensure is set to ‘removed’.
|
<td> </td>
|
||||||
Defaults to ‘no’.</li>
|
<td>A package name or package specifier with version, like <cite>foo</cite> or <cite>foo=1.0</cite></td>
|
||||||
</ul>
|
</tr>
|
||||||
<p><em>default-release</em>:</p>
|
<tr><td>state</td>
|
||||||
<ul class="simple">
|
<td>no</td>
|
||||||
<li>Corresponds to the -t option for apt, and sets pin priorities</li>
|
<td>present</td>
|
||||||
</ul>
|
<td>‘absent’, ‘present’, or ‘latest’.</td>
|
||||||
<p><em>install-recommends</em>: (devel branch now, part of ansible 0.6 later)</p>
|
</tr>
|
||||||
<ul class="simple">
|
<tr><td>update-cache</td>
|
||||||
<li>Corresponds to the –no-install-recommends option for apt. Defaults to ‘yes’, which means install the recommended packages the same way APT does by default. Set this to ‘no’ to add the option not to install recommended packages.</li>
|
<td>no</td>
|
||||||
</ul>
|
<td>no</td>
|
||||||
|
<td>run the equivalent of apt-get update before the operation?
|
||||||
|
Can be run as part of the package installation or a seperate step</td>
|
||||||
|
</tr>
|
||||||
|
<tr><td>purge</td>
|
||||||
|
<td>no</td>
|
||||||
|
<td>no</td>
|
||||||
|
<td>Will forge purge of configuration files if state is set to ‘removed’.</td>
|
||||||
|
</tr>
|
||||||
|
<tr><td>default-release</td>
|
||||||
|
<td>no</td>
|
||||||
|
<td> </td>
|
||||||
|
<td>Corresponds to the -t option for apt and sets pin priorities</td>
|
||||||
|
</tr>
|
||||||
|
<tr><td>install-recommends</td>
|
||||||
|
<td>no</td>
|
||||||
|
<td>yes</td>
|
||||||
|
<td>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.</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
<p>Example action from Ansible <a class="reference internal" href="playbooks.html"><em>Playbooks</em></a>:</p>
|
<p>Example action from Ansible <a class="reference internal" href="playbooks.html"><em>Playbooks</em></a>:</p>
|
||||||
<div class="highlight-python"><pre>apt pkg=foo update-cache=yes
|
<div class="highlight-python"><pre>apt pkg=foo update-cache=yes
|
||||||
apt pkg=foo state=removed
|
apt pkg=foo state=removed
|
||||||
|
@ -273,14 +294,38 @@ and does not support a conf.d style structure where it is easy to build up the c
|
||||||
Assmeble will take a directory of files that have already been transferred to the system, and concatenate them
|
Assmeble 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
|
together to produce a destination file. Files are assembled in string sorting order. Puppet calls this idea
|
||||||
“fragments”.</p>
|
“fragments”.</p>
|
||||||
<p><em>src</em>:</p>
|
<table border="1" class="docutils">
|
||||||
<ul class="simple">
|
<colgroup>
|
||||||
<li>An already existing directory full of source files.</li>
|
<col width="17%" />
|
||||||
</ul>
|
<col width="9%" />
|
||||||
<p><em>dest</em>:</p>
|
<col width="8%" />
|
||||||
<ul class="simple">
|
<col width="66%" />
|
||||||
<li>A file to create using the concatenation of all of the source files.</li>
|
</colgroup>
|
||||||
</ul>
|
<thead valign="bottom">
|
||||||
|
<tr><th class="head">parameter</th>
|
||||||
|
<th class="head">required</th>
|
||||||
|
<th class="head">default</th>
|
||||||
|
<th class="head">comments</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody valign="top">
|
||||||
|
<tr><td>src</td>
|
||||||
|
<td>yes</td>
|
||||||
|
<td> </td>
|
||||||
|
<td>An already existing directory full of source files</td>
|
||||||
|
</tr>
|
||||||
|
<tr><td>dest</td>
|
||||||
|
<td>yes</td>
|
||||||
|
<td> </td>
|
||||||
|
<td>A file to create using the concatenation of all of the source files</td>
|
||||||
|
</tr>
|
||||||
|
<tr><td>OTHERS</td>
|
||||||
|
<td> </td>
|
||||||
|
<td> </td>
|
||||||
|
<td>All arguments that the file module takes may also be used</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
<p>Example action from Ansible <a class="reference internal" href="playbooks.html"><em>Playbooks</em></a>:</p>
|
<p>Example action from Ansible <a class="reference internal" href="playbooks.html"><em>Playbooks</em></a>:</p>
|
||||||
<div class="highlight-python"><pre>assemble src=/etc/someapp/fragments dest=/etc/someapp/someapp.conf</pre>
|
<div class="highlight-python"><pre>assemble src=/etc/someapp/fragments dest=/etc/someapp/someapp.conf</pre>
|
||||||
</div>
|
</div>
|
||||||
|
@ -288,18 +333,38 @@ together to produce a destination file. Files are assembled in string sorting o
|
||||||
<div class="section" id="authorized-key">
|
<div class="section" id="authorized-key">
|
||||||
<span id="id3"></span><h2>authorized_key<a class="headerlink" href="#authorized-key" title="Permalink to this headline">¶</a></h2>
|
<span id="id3"></span><h2>authorized_key<a class="headerlink" href="#authorized-key" title="Permalink to this headline">¶</a></h2>
|
||||||
<p>(new in 0.5). Adds or removes an authorized key for a user from a remote host.</p>
|
<p>(new in 0.5). Adds or removes an authorized key for a user from a remote host.</p>
|
||||||
<p><em>user</em>:</p>
|
<table border="1" class="docutils">
|
||||||
<ul class="simple">
|
<colgroup>
|
||||||
<li>Name of the user who access is being granted or remoted to.</li>
|
<col width="17%" />
|
||||||
</ul>
|
<col width="9%" />
|
||||||
<p><em>state</em>:</p>
|
<col width="8%" />
|
||||||
<ul class="simple">
|
<col width="66%" />
|
||||||
<li>Either ‘absent’ or ‘present’, this is whether the given key should be in the authorized keys file or not.</li>
|
</colgroup>
|
||||||
</ul>
|
<thead valign="bottom">
|
||||||
<p><em>key</em>:</p>
|
<tr><th class="head">parameter</th>
|
||||||
<ul class="simple">
|
<th class="head">required</th>
|
||||||
<li>The actual key, as a string.</li>
|
<th class="head">default</th>
|
||||||
</ul>
|
<th class="head">comments</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody valign="top">
|
||||||
|
<tr><td>user</td>
|
||||||
|
<td>yes</td>
|
||||||
|
<td> </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>the SSH public key, as a string</td>
|
||||||
|
</tr>
|
||||||
|
<tr><td>state</td>
|
||||||
|
<td>no</td>
|
||||||
|
<td>present</td>
|
||||||
|
<td>whether the given key should or should not be in the file</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
<p>Example action from Ansible <a class="reference internal" href="playbooks.html"><em>Playbooks</em></a>:</p>
|
<p>Example action from Ansible <a class="reference internal" href="playbooks.html"><em>Playbooks</em></a>:</p>
|
||||||
<div class="highlight-python"><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>
|
<div class="highlight-python"><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>
|
||||||
</div>
|
</div>
|
||||||
|
@ -332,16 +397,40 @@ following:</p>
|
||||||
<p>The copy module moves a file on the local box to remote locations. In addition to the options
|
<p>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 <cite>file</cite> module can also be passed to the copy
|
listed below, the arguments available to the <cite>file</cite> module can also be passed to the copy
|
||||||
module.</p>
|
module.</p>
|
||||||
<p><em>src</em>:</p>
|
<table border="1" class="docutils">
|
||||||
<ul class="simple">
|
<colgroup>
|
||||||
<li>Local path to a file to copy to the remote server. This can be an
|
<col width="17%" />
|
||||||
absolute or relative path.</li>
|
<col width="9%" />
|
||||||
</ul>
|
<col width="8%" />
|
||||||
<p><em>dest</em>:</p>
|
<col width="66%" />
|
||||||
<ul class="simple">
|
</colgroup>
|
||||||
<li>Remote absolute path where the file should end up.</li>
|
<thead valign="bottom">
|
||||||
</ul>
|
<tr><th class="head">parameter</th>
|
||||||
<p>This module also returns md5sum information about the resultant file.</p>
|
<th class="head">required</th>
|
||||||
|
<th class="head">default</th>
|
||||||
|
<th class="head">comments</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody valign="top">
|
||||||
|
<tr><td>src</td>
|
||||||
|
<td>yes</td>
|
||||||
|
<td> </td>
|
||||||
|
<td>Local path to a file to copy to the remote server, can be absolute or
|
||||||
|
relative.</td>
|
||||||
|
</tr>
|
||||||
|
<tr><td>dest</td>
|
||||||
|
<td>yes</td>
|
||||||
|
<td> </td>
|
||||||
|
<td>Remote absolute path where the file should end up</td>
|
||||||
|
</tr>
|
||||||
|
<tr><td>OTHERS</td>
|
||||||
|
<td> </td>
|
||||||
|
<td> </td>
|
||||||
|
<td>All arguments the file module takes are also supported</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<p>This module also returns md5sum and other information about the resultant file.</p>
|
||||||
<p>Example action from Ansible <a class="reference internal" href="playbooks.html"><em>Playbooks</em></a>:</p>
|
<p>Example action from Ansible <a class="reference internal" href="playbooks.html"><em>Playbooks</em></a>:</p>
|
||||||
<div class="highlight-python"><pre>copy src=/srv/myfiles/foo.conf dest=/etc/foo.conf owner=foo group=foo mode=0644</pre>
|
<div class="highlight-python"><pre>copy src=/srv/myfiles/foo.conf dest=/etc/foo.conf owner=foo group=foo mode=0644</pre>
|
||||||
</div>
|
</div>
|
||||||
|
@ -360,70 +449,129 @@ module behind the scenes.</p>
|
||||||
<h2>fetch<a class="headerlink" href="#fetch" title="Permalink to this headline">¶</a></h2>
|
<h2>fetch<a class="headerlink" href="#fetch" title="Permalink to this headline">¶</a></h2>
|
||||||
<p>This module works like ‘copy’, but in reverse. It is used for fetching files
|
<p>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.</p>
|
from remote machines and storing them locally in a file tree, organized by hostname.</p>
|
||||||
<p><em>src</em>:</p>
|
<table border="1" class="docutils">
|
||||||
<ul class="simple">
|
<colgroup>
|
||||||
<li>The file on the remote system to fetch. This needs to be a file, not a directory. Recursive fetching may be supported later.</li>
|
<col width="17%" />
|
||||||
</ul>
|
<col width="9%" />
|
||||||
<p><em>dest</em>:</p>
|
<col width="8%" />
|
||||||
<ul class="simple">
|
<col width="66%" />
|
||||||
<li>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’ (in Ansible 0.0.3 and later).</li>
|
</colgroup>
|
||||||
</ul>
|
<thead valign="bottom">
|
||||||
<p>The fetch module is a useful way to gather log files from remote systems. If you require
|
<tr><th class="head">parameter</th>
|
||||||
fetching multiple files from remote systems, you may wish to execute a tar command and
|
<th class="head">required</th>
|
||||||
then fetch the tarball.</p>
|
<th class="head">default</th>
|
||||||
|
<th class="head">comments</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody valign="top">
|
||||||
|
<tr><td>src</td>
|
||||||
|
<td>yes</td>
|
||||||
|
<td> </td>
|
||||||
|
<td>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.</td>
|
||||||
|
</tr>
|
||||||
|
<tr><td>dest</td>
|
||||||
|
<td>yes</td>
|
||||||
|
<td> </td>
|
||||||
|
<td>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’</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
<p>Example:</p>
|
<p>Example:</p>
|
||||||
<div class="highlight-python"><pre>fetch src=/var/log/messages dest=/home/logtree</pre>
|
<div class="highlight-python"><pre>fetch src=/var/log/messages dest=/home/logtree</pre>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="file">
|
<div class="section" id="file">
|
||||||
<h2>file<a class="headerlink" href="#file" title="Permalink to this headline">¶</a></h2>
|
<h2>file<a class="headerlink" href="#file" title="Permalink to this headline">¶</a></h2>
|
||||||
<p>Sets attributes of files, symlinks, and directories, or removes files/symlinks/directories.
|
<p>Sets attributes of files, symlinks, and directories, or removes files/symlinks/directories. Many other modules
|
||||||
All parameters available to the file module are also available when running the <cite>copy</cite> or
|
support the same options as the file module – including ‘copy’, ‘template’, and ‘assmeble’.</p>
|
||||||
<cite>template</cite> modules.</p>
|
<table border="1" class="docutils">
|
||||||
<p><em>dest</em>:</p>
|
<colgroup>
|
||||||
<ul class="simple">
|
<col width="17%" />
|
||||||
<li>alias for ‘path’. Sets an absolute path to a file on the filesystem when used with ‘state=file’. When used with ‘state=link’, sets the destination to create a symbolic link defined by ‘src’ key.</li>
|
<col width="9%" />
|
||||||
</ul>
|
<col width="8%" />
|
||||||
<p><em>state</em>:</p>
|
<col width="66%" />
|
||||||
<ul class="simple">
|
</colgroup>
|
||||||
<li>either ‘file’, ‘link’, ‘directory’, or ‘absent’. The default is ‘file’. If ‘directory’, the directory and all immediate subdirectories will be created if they do not exist. If ‘file’, the file will NOT be created if it does not exist, specify <cite>copy</cite> or <cite>template</cite> for the module name instead if you need to put content at the specified location. If ‘link’, the symbolic link will be created or changed. If ‘absent’, directories will be recursively deleted, and files or symlinks will be unlinked.</li>
|
<thead valign="bottom">
|
||||||
</ul>
|
<tr><th class="head">parameter</th>
|
||||||
<p><em>mode</em>:</p>
|
<th class="head">required</th>
|
||||||
<ul class="simple">
|
<th class="head">default</th>
|
||||||
<li>the mode the file or directory should be, such as 644, as would be given to <cite>chmod</cite>. English modes like “g+x” are not yet supported.</li>
|
<th class="head">comments</th>
|
||||||
</ul>
|
</tr>
|
||||||
<p><em>owner</em>:</p>
|
</thead>
|
||||||
<ul class="simple">
|
<tbody valign="top">
|
||||||
<li>name of user that should own the file or directory, as would be given to <cite>chown</cite></li>
|
<tr><td>dest</td>
|
||||||
</ul>
|
<td>yes</td>
|
||||||
<p><em>group</em>:</p>
|
<td> </td>
|
||||||
<ul class="simple">
|
<td>defines the file being managed, unless when used with state=link, and
|
||||||
<li>name of group that should own the file or directory, as would be given to <cite>chgrp</cite></li>
|
then sets the destination to create a symbolic link to using ‘src’</td>
|
||||||
</ul>
|
</tr>
|
||||||
<p><em>src</em>:</p>
|
<tr><td>state</td>
|
||||||
<ul class="simple">
|
<td> </td>
|
||||||
<li>path of the file to link to (applies only to ‘link’ state)</li>
|
<td>file</td>
|
||||||
</ul>
|
<td>values are ‘file’, ‘link’, ‘directory’, or ‘absent’. If directory,
|
||||||
<p><em>seuser</em>:</p>
|
all immediate subdirectories will be created if they do not exist. If
|
||||||
<ul class="simple">
|
‘file’, the file will NOT be created if it does not exist, see the ‘copy’
|
||||||
<li>‘user’ part of SELinux file context. Will default to what is provided by system policy, if available. Only used on systems with SELinux present. If you specify ‘_default’, it will use the ‘user’ portion of default context from the policy if available.</li>
|
or ‘template’ module if you want that behavior. If ‘link’, the symbolic
|
||||||
</ul>
|
link will be created or changed. If absent, directories will be
|
||||||
<p><em>serole</em>:</p>
|
recursively deleted, and files or symlinks will be unlinked.</td>
|
||||||
<ul class="simple">
|
</tr>
|
||||||
<li>‘role’ part of SELinux file context. Will default to what is provided by system policy, if available. Only used on systems with SELinux present. If you specify ‘_default’, it will use the ‘role’ portion of default context from the policy if available.</li>
|
<tr><td>mode</td>
|
||||||
</ul>
|
<td> </td>
|
||||||
<p><em>setype</em>:</p>
|
<td> </td>
|
||||||
<ul class="simple">
|
<td>mode the file or directory shoudl be, such as 0644 as would be fed to
|
||||||
<li>‘type’ part of SELinux file context. Will default to what is provided by system policy, if available. Only used on systems with SELinux present. If you specify ‘_default’, it will use the ‘type’ portion of default context from the policy if available.</li>
|
chmod. English modes like ‘g+x’ are not yet supported</td>
|
||||||
</ul>
|
</tr>
|
||||||
<p><em>selevel</em>:</p>
|
<tr><td>owner</td>
|
||||||
<ul class="simple">
|
<td> </td>
|
||||||
<li>‘level’ part of SELinux file context. This is the MLS and MCS attribute of the file context, also sometimes known as the ‘range’. It defaults to ‘s0’. Only used only used on hosts with SELinux present. If you specify ‘_default’, it will use the ‘level’ portion of default context from the policy if available.</li>
|
<td> </td>
|
||||||
</ul>
|
<td>name of the user that should own the file/directory, as would be fed to
|
||||||
<p><em>context</em>:</p>
|
chown</td>
|
||||||
<ul class="simple">
|
</tr>
|
||||||
<li>accepts only ‘default’ as value. This will restore a file’s selinux context to the default context in the policy. Does nothing if no default is available. Only used on hosts with SELinux present.</li>
|
<tr><td>group</td>
|
||||||
</ul>
|
<td> </td>
|
||||||
|
<td> </td>
|
||||||
|
<td>name of the group that should own the file/directory, as would be fed to
|
||||||
|
group</td>
|
||||||
|
</tr>
|
||||||
|
<tr><td>src</td>
|
||||||
|
<td> </td>
|
||||||
|
<td> </td>
|
||||||
|
<td>path of the file to link to (applies only to state=link)</td>
|
||||||
|
</tr>
|
||||||
|
<tr><td>seuser</td>
|
||||||
|
<td> </td>
|
||||||
|
<td> </td>
|
||||||
|
<td>user part of SELinux file context. Will default to system policy, if
|
||||||
|
applicable. If set to ‘_default’, it will use the ‘user’ portion of the
|
||||||
|
the policy if available</td>
|
||||||
|
</tr>
|
||||||
|
<tr><td>serole</td>
|
||||||
|
<td> </td>
|
||||||
|
<td> </td>
|
||||||
|
<td>role part of SELinux file context, ‘_default’ feature works as above.</td>
|
||||||
|
</tr>
|
||||||
|
<tr><td>setype</td>
|
||||||
|
<td> </td>
|
||||||
|
<td> </td>
|
||||||
|
<td>type part of SELinux file context, ‘_default’ feature works as above</td>
|
||||||
|
</tr>
|
||||||
|
<tr><td>selevel</td>
|
||||||
|
<td> </td>
|
||||||
|
<td>s0</td>
|
||||||
|
<td>level part of the SELinux file context. This is the MLS/MCS attribute,
|
||||||
|
sometimes known as the ‘range’. ‘_default’ feature works as above</td>
|
||||||
|
</tr>
|
||||||
|
<tr><td>context</td>
|
||||||
|
<td> </td>
|
||||||
|
<td> </td>
|
||||||
|
<td>accepts only ‘default’ as a value. This will restore a file’s selinux
|
||||||
|
context in the policy. Does nothing if no default is available.</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
<p>Example action from Ansible <a class="reference internal" href="playbooks.html"><em>Playbooks</em></a>:</p>
|
<p>Example action from Ansible <a class="reference internal" href="playbooks.html"><em>Playbooks</em></a>:</p>
|
||||||
<div class="highlight-python"><pre>file path=/etc/foo.conf owner=foo group=foo mode=0644
|
<div class="highlight-python"><pre>file path=/etc/foo.conf owner=foo group=foo mode=0644
|
||||||
file path=/some/path owner=foo group=foo state=directory
|
file path=/some/path owner=foo group=foo state=directory
|
||||||
|
@ -436,23 +584,44 @@ file path=/some/path state=directory context=default</pre>
|
||||||
<div class="section" id="git">
|
<div class="section" id="git">
|
||||||
<span id="id7"></span><h2>git<a class="headerlink" href="#git" title="Permalink to this headline">¶</a></h2>
|
<span id="id7"></span><h2>git<a class="headerlink" href="#git" title="Permalink to this headline">¶</a></h2>
|
||||||
<p>Deploys software (or files) from git checkouts.</p>
|
<p>Deploys software (or files) from git checkouts.</p>
|
||||||
<p><em>repo</em>:</p>
|
<table border="1" class="docutils">
|
||||||
<ul class="simple">
|
<colgroup>
|
||||||
<li>git, ssh, or http protocol address of the git repo to checkout.</li>
|
<col width="17%" />
|
||||||
</ul>
|
<col width="9%" />
|
||||||
<p><em>dest</em>:</p>
|
<col width="8%" />
|
||||||
<ul class="simple">
|
<col width="66%" />
|
||||||
<li>Where to check it out, an absolute directory path.</li>
|
</colgroup>
|
||||||
</ul>
|
<thead valign="bottom">
|
||||||
<p><em>version</em>:</p>
|
<tr><th class="head">parameter</th>
|
||||||
<ul class="simple">
|
<th class="head">required</th>
|
||||||
<li>What version to check out – either the git SHA, the literal string
|
<th class="head">default</th>
|
||||||
<tt class="docutils literal"><span class="pre">HEAD</span></tt>, branch name, or a tag name.</li>
|
<th class="head">comments</th>
|
||||||
</ul>
|
</tr>
|
||||||
<p><em>remote</em>:</p>
|
</thead>
|
||||||
<ul class="simple">
|
<tbody valign="top">
|
||||||
<li>Name of the remote branch, defaults to ‘origin’.</li>
|
<tr><td>repo</td>
|
||||||
</ul>
|
<td>yes</td>
|
||||||
|
<td> </td>
|
||||||
|
<td>git, ssh, or http protocol address of the git repo</td>
|
||||||
|
</tr>
|
||||||
|
<tr><td>dest</td>
|
||||||
|
<td>yes</td>
|
||||||
|
<td> </td>
|
||||||
|
<td>absolute path of where the repo should be checked out to</td>
|
||||||
|
</tr>
|
||||||
|
<tr><td>version</td>
|
||||||
|
<td> </td>
|
||||||
|
<td> </td>
|
||||||
|
<td>what version to check out – either the git SHA, the literal string
|
||||||
|
‘HEAD’, branch name, or a tag name.</td>
|
||||||
|
</tr>
|
||||||
|
<tr><td>remote</td>
|
||||||
|
<td> </td>
|
||||||
|
<td>origin</td>
|
||||||
|
<td>name of the remote branch</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
<p>Example action from Ansible <a class="reference internal" href="playbooks.html"><em>Playbooks</em></a>:</p>
|
<p>Example action from Ansible <a class="reference internal" href="playbooks.html"><em>Playbooks</em></a>:</p>
|
||||||
<div class="highlight-python"><pre>git repo=git://foosball.example.org/path/to/repo.git dest=/srv/checkout version=release-0.22</pre>
|
<div class="highlight-python"><pre>git repo=git://foosball.example.org/path/to/repo.git dest=/srv/checkout version=release-0.22</pre>
|
||||||
</div>
|
</div>
|
||||||
|
@ -460,22 +629,43 @@ file path=/some/path state=directory context=default</pre>
|
||||||
<div class="section" id="group">
|
<div class="section" id="group">
|
||||||
<span id="id8"></span><h2>group<a class="headerlink" href="#group" title="Permalink to this headline">¶</a></h2>
|
<span id="id8"></span><h2>group<a class="headerlink" href="#group" title="Permalink to this headline">¶</a></h2>
|
||||||
<p>Adds or removes groups.</p>
|
<p>Adds or removes groups.</p>
|
||||||
<p><em>name</em>:</p>
|
<table border="1" class="docutils">
|
||||||
<ul class="simple">
|
<colgroup>
|
||||||
<li>name of the group</li>
|
<col width="17%" />
|
||||||
</ul>
|
<col width="9%" />
|
||||||
<p><em>gid</em>:</p>
|
<col width="8%" />
|
||||||
<ul class="simple">
|
<col width="66%" />
|
||||||
<li>optional gid to set for the group</li>
|
</colgroup>
|
||||||
</ul>
|
<thead valign="bottom">
|
||||||
<p><em>state</em>:</p>
|
<tr><th class="head">parameter</th>
|
||||||
<ul class="simple">
|
<th class="head">required</th>
|
||||||
<li>either ‘absent’, or ‘present’. ‘present’ is the default.</li>
|
<th class="head">default</th>
|
||||||
</ul>
|
<th class="head">comments</th>
|
||||||
<p><em>system</em>:</p>
|
</tr>
|
||||||
<ul class="simple">
|
</thead>
|
||||||
<li>(new in 0.4) Indicates the group (when being created), should be a system group. This does not allow changing groups from and to system groups. Value is ‘yes’ or ‘no’, default is ‘no’.</li>
|
<tbody valign="top">
|
||||||
</ul>
|
<tr><td>name</td>
|
||||||
|
<td>yes</td>
|
||||||
|
<td> </td>
|
||||||
|
<td>name of the group</td>
|
||||||
|
</tr>
|
||||||
|
<tr><td>gid</td>
|
||||||
|
<td> </td>
|
||||||
|
<td> </td>
|
||||||
|
<td>optional git to set for the group</td>
|
||||||
|
</tr>
|
||||||
|
<tr><td>state</td>
|
||||||
|
<td> </td>
|
||||||
|
<td>present</td>
|
||||||
|
<td>‘absent’ or ‘present’</td>
|
||||||
|
</tr>
|
||||||
|
<tr><td>system</td>
|
||||||
|
<td> </td>
|
||||||
|
<td>no</td>
|
||||||
|
<td>if ‘yes’, indicates that the group being created is a system group.</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
<p>To control members of the group, see the users resource.</p>
|
<p>To control members of the group, see the users resource.</p>
|
||||||
<p>Example action from Ansible <a class="reference internal" href="playbooks.html"><em>Playbooks</em></a>:</p>
|
<p>Example action from Ansible <a class="reference internal" href="playbooks.html"><em>Playbooks</em></a>:</p>
|
||||||
<div class="highlight-python"><pre>group name=somegroup state=present</pre>
|
<div class="highlight-python"><pre>group name=somegroup state=present</pre>
|
||||||
|
@ -518,26 +708,47 @@ for this module.</p>
|
||||||
<div class="section" id="id11">
|
<div class="section" id="id11">
|
||||||
<h2>service<a class="headerlink" href="#id11" title="Permalink to this headline">¶</a></h2>
|
<h2>service<a class="headerlink" href="#id11" title="Permalink to this headline">¶</a></h2>
|
||||||
<p>Controls services on remote machines.</p>
|
<p>Controls services on remote machines.</p>
|
||||||
<p><em>state</em>:</p>
|
<table border="1" class="docutils">
|
||||||
<ul class="simple">
|
<colgroup>
|
||||||
<li>Values are <tt class="docutils literal"><span class="pre">started</span></tt>, <tt class="docutils literal"><span class="pre">stopped</span></tt>, <tt class="docutils literal"><span class="pre">reloaded</span></tt>, or <tt class="docutils literal"><span class="pre">restarted</span></tt>.
|
<col width="17%" />
|
||||||
Started/stopped are idempotent actions that will not run commands
|
<col width="9%" />
|
||||||
unless necessary. <tt class="docutils literal"><span class="pre">restarted</span></tt> will always bounce the service, <tt class="docutils literal"><span class="pre">reloaded</span></tt>
|
<col width="8%" />
|
||||||
will always issue a reload.</li>
|
<col width="66%" />
|
||||||
</ul>
|
</colgroup>
|
||||||
<p><em>enabled</em>:</p>
|
<thead valign="bottom">
|
||||||
<ul class="simple">
|
<tr><th class="head">parameter</th>
|
||||||
<li>(new in 0.4) Whether the service should start on boot. Either ‘yes’ or ‘no’.
|
<th class="head">required</th>
|
||||||
Uses chkconfig or updates-rc.d as appropriate.</li>
|
<th class="head">default</th>
|
||||||
</ul>
|
<th class="head">comments</th>
|
||||||
<p><em>list</em>:</p>
|
</tr>
|
||||||
<ul class="simple">
|
</thead>
|
||||||
<li>(new in 0.4) When used with the value ‘status’, returns the status of the service along with other results. This is primarily useful for /usr/bin/ansible, and not meaningful for playbooks.</li>
|
<tbody valign="top">
|
||||||
</ul>
|
<tr><td>name</td>
|
||||||
<p><em>name</em>:</p>
|
<td>yes</td>
|
||||||
<ul class="simple">
|
<td> </td>
|
||||||
<li>The name of the service.</li>
|
<td>name of the service</td>
|
||||||
</ul>
|
</tr>
|
||||||
|
<tr><td>state</td>
|
||||||
|
<td>no</td>
|
||||||
|
<td>started</td>
|
||||||
|
<td>‘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.</td>
|
||||||
|
</tr>
|
||||||
|
<tr><td>enabled</td>
|
||||||
|
<td>no</td>
|
||||||
|
<td> </td>
|
||||||
|
<td>Whether the service should start on boot. Either ‘yes’ or ‘no’.</td>
|
||||||
|
</tr>
|
||||||
|
<tr><td>list</td>
|
||||||
|
<td>no</td>
|
||||||
|
<td> </td>
|
||||||
|
<td>when used as ‘list=status’, returns the status of the service along with
|
||||||
|
other results. Primarily useful for /usr/bin/ansible or playbooks with
|
||||||
|
–verbose.</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
<p>Example action from Ansible <a class="reference internal" href="playbooks.html"><em>Playbooks</em></a>:</p>
|
<p>Example action from Ansible <a class="reference internal" href="playbooks.html"><em>Playbooks</em></a>:</p>
|
||||||
<div class="highlight-python"><pre>service name=httpd state=started
|
<div class="highlight-python"><pre>service name=httpd state=started
|
||||||
service name=httpd state=stopped
|
service name=httpd state=stopped
|
||||||
|
@ -547,11 +758,9 @@ service name=httpd state=reloaded</pre>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="setup">
|
<div class="section" id="setup">
|
||||||
<span id="id12"></span><h2>setup<a class="headerlink" href="#setup" title="Permalink to this headline">¶</a></h2>
|
<span id="id12"></span><h2>setup<a class="headerlink" href="#setup" title="Permalink to this headline">¶</a></h2>
|
||||||
<p>Writes a JSON file containing key/value data, for use in templating.
|
<p>This module is automatically called by playbooks to gather useful variables about remote hosts that can be used
|
||||||
Call this once before using the <a class="reference internal" href="#template"><em>template</em></a> module. Playbooks
|
in playbooks. It can also be executed directly by /usr/bin/ansible to check what variables are available
|
||||||
will execute this module automatically as the first step in each play
|
to a host.</p>
|
||||||
using the variables section, so it is unnecessary to make explicit
|
|
||||||
calls to setup within a playbook.</p>
|
|
||||||
<p>Ansible provides many ‘facts’ about the system, automatically.</p>
|
<p>Ansible provides many ‘facts’ about the system, automatically.</p>
|
||||||
<p>Some of the variables that are supplied are listed below. These in particular
|
<p>Some of the variables that are supplied are listed below. These in particular
|
||||||
are from a VMWare Fusion 4 VM running CentOS 6.2:</p>
|
are from a VMWare Fusion 4 VM running CentOS 6.2:</p>
|
||||||
|
@ -625,17 +834,8 @@ tell their source.</p>
|
||||||
<p>All variables are bubbled up to the caller. Using the ansible facts and choosing
|
<p>All variables are bubbled up to the caller. Using the ansible facts and choosing
|
||||||
to not install facter and ohai means you can avoid ruby-dependencies
|
to not install facter and ohai means you can avoid ruby-dependencies
|
||||||
on your remote systems.</p>
|
on your remote systems.</p>
|
||||||
<p><em>variablename</em>:</p>
|
|
||||||
<ul class="simple">
|
|
||||||
<li>Arbitrary variable names, which must be a mix of alphanumeric characters and underscores, can also be defined. Setting a variable creates a <tt class="docutils literal"><span class="pre">key=value</span></tt> pair in the JSON file for use in templating.</li>
|
|
||||||
</ul>
|
|
||||||
<p>Example action from Ansible <a class="reference internal" href="playbooks.html"><em>Playbooks</em></a>:</p>
|
|
||||||
<div class="highlight-python"><pre>vars:
|
|
||||||
ntpserver: 'ntp.example.com'
|
|
||||||
xyz: 1234</pre>
|
|
||||||
</div>
|
|
||||||
<p>Example action from <cite>/usr/bin/ansible</cite>:</p>
|
<p>Example action from <cite>/usr/bin/ansible</cite>:</p>
|
||||||
<div class="highlight-python"><pre>ansible all -m setup -a "ntpserver=ntp.example.com xyz=1234"</pre>
|
<div class="highlight-python"><pre>ansible testserver -m setup</pre>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="shell">
|
<div class="section" id="shell">
|
||||||
|
@ -658,20 +858,40 @@ command was running.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="template">
|
<div class="section" id="template">
|
||||||
<span id="id14"></span><h2>template<a class="headerlink" href="#template" title="Permalink to this headline">¶</a></h2>
|
<span id="id14"></span><h2>template<a class="headerlink" href="#template" title="Permalink to this headline">¶</a></h2>
|
||||||
<p>Templates a file out to a remote server. Call the <a class="reference internal" href="#setup"><em>setup</em></a> module
|
<p>Templates a file out to a remote server.</p>
|
||||||
prior to usage if you are not running from a playbook. In addition to the options
|
<table border="1" class="docutils">
|
||||||
listed below, the arguments available to the <cite>file</cite> and <cite>copy</cite> modules can also be passed
|
<colgroup>
|
||||||
to the template module.</p>
|
<col width="17%" />
|
||||||
<p><em>src</em>:</p>
|
<col width="9%" />
|
||||||
<ul class="simple">
|
<col width="8%" />
|
||||||
<li>Path of a Jinja2 formatted template on the local server. This can
|
<col width="66%" />
|
||||||
be a relative or absolute path.</li>
|
</colgroup>
|
||||||
</ul>
|
<thead valign="bottom">
|
||||||
<p><em>dest</em>:</p>
|
<tr><th class="head">parameter</th>
|
||||||
<ul class="simple">
|
<th class="head">required</th>
|
||||||
<li>Location to render the template on the remote server</li>
|
<th class="head">default</th>
|
||||||
</ul>
|
<th class="head">comments</th>
|
||||||
<p>This module also returns md5sum information about the resultant file.</p>
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody valign="top">
|
||||||
|
<tr><td>src</td>
|
||||||
|
<td>yes</td>
|
||||||
|
<td> </td>
|
||||||
|
<td>Path of a Jinja2 formatted template on the local server. This can be
|
||||||
|
a relative or absolute path.</td>
|
||||||
|
</tr>
|
||||||
|
<tr><td>dest</td>
|
||||||
|
<td>yes</td>
|
||||||
|
<td> </td>
|
||||||
|
<td>Location to render the template on the remote server</td>
|
||||||
|
</tr>
|
||||||
|
<tr><td>OTHERS</td>
|
||||||
|
<td> </td>
|
||||||
|
<td> </td>
|
||||||
|
<td>This module also supports all of the arguments to the file module</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
<p>Example action from a playbook:</p>
|
<p>Example action from a playbook:</p>
|
||||||
<div class="highlight-python"><pre>template src=/srv/mytemplates/foo.j2 dest=/etc/foo.conf owner=foo group=foo mode=0644</pre>
|
<div class="highlight-python"><pre>template src=/srv/mytemplates/foo.j2 dest=/etc/foo.conf owner=foo group=foo mode=0644</pre>
|
||||||
</div>
|
</div>
|
||||||
|
@ -679,62 +899,96 @@ be a relative or absolute path.</li>
|
||||||
<div class="section" id="user">
|
<div class="section" id="user">
|
||||||
<span id="id15"></span><h2>user<a class="headerlink" href="#user" title="Permalink to this headline">¶</a></h2>
|
<span id="id15"></span><h2>user<a class="headerlink" href="#user" title="Permalink to this headline">¶</a></h2>
|
||||||
<p>Creates user accounts, manipulates existing user accounts, and removes user accounts.</p>
|
<p>Creates user accounts, manipulates existing user accounts, and removes user accounts.</p>
|
||||||
<p><em>name</em>:</p>
|
<table border="1" class="docutils">
|
||||||
<ul class="simple">
|
<colgroup>
|
||||||
<li>Name of the user to create, remove, or edit</li>
|
<col width="17%" />
|
||||||
</ul>
|
<col width="9%" />
|
||||||
<p><em>comment</em>:</p>
|
<col width="8%" />
|
||||||
<ul class="simple">
|
<col width="66%" />
|
||||||
<li>Optionally sets the description of the user</li>
|
</colgroup>
|
||||||
</ul>
|
<thead valign="bottom">
|
||||||
<p><em>uid</em>:</p>
|
<tr><th class="head">parameter</th>
|
||||||
<ul class="simple">
|
<th class="head">required</th>
|
||||||
<li>optional uid to set for the user</li>
|
<th class="head">default</th>
|
||||||
</ul>
|
<th class="head">comments</th>
|
||||||
<p><em>group</em>:</p>
|
</tr>
|
||||||
<ul class="simple">
|
</thead>
|
||||||
<li>Optionally sets the user’s primary group, takes a group name</li>
|
<tbody valign="top">
|
||||||
</ul>
|
<tr><td>name</td>
|
||||||
<p><em>groups</em>:</p>
|
<td>yes</td>
|
||||||
<ul class="simple">
|
<td> </td>
|
||||||
<li>Put the user in the specified groups, takes comma delimited group names</li>
|
<td>name of the user to create, remove, or edit</td>
|
||||||
</ul>
|
</tr>
|
||||||
<p><em>append</em>:</p>
|
<tr><td>comment</td>
|
||||||
<ul class="simple">
|
<td> </td>
|
||||||
<li>If true, will only add additional groups to the user listed in ‘groups’, rather than making the user only be in those specified groups</li>
|
<td> </td>
|
||||||
</ul>
|
<td>optionally sets the description of the user</td>
|
||||||
<p><em>shell</em>:</p>
|
</tr>
|
||||||
<ul class="simple">
|
<tr><td>uid</td>
|
||||||
<li>Optionally sets the user’s shell</li>
|
<td> </td>
|
||||||
</ul>
|
<td> </td>
|
||||||
<p><em>createhome</em>:</p>
|
<td>optionally sets the uid of the user</td>
|
||||||
<ul class="simple">
|
</tr>
|
||||||
<li>Whether to create the user’s home directory. Takes ‘yes’, or ‘no’. The default is ‘yes’.</li>
|
<tr><td>group</td>
|
||||||
</ul>
|
<td> </td>
|
||||||
<p><em>home=</em>:</p>
|
<td> </td>
|
||||||
<ul class="simple">
|
<td>optionally sets the user’s primary group (takes a group name)</td>
|
||||||
<li>Specifies where the user’s home directory should be, if not in /home/$username.</li>
|
</tr>
|
||||||
</ul>
|
<tr><td>groups</td>
|
||||||
<p><em>password</em>:</p>
|
<td> </td>
|
||||||
<ul class="simple">
|
<td> </td>
|
||||||
<li>Sets the user’s password to this crypted value. Pass in a result from crypt. See the users example in the github examples directory for what this looks like in a playbook.</li>
|
<td>puts the user in this comma-delimited list of groups</td>
|
||||||
</ul>
|
</tr>
|
||||||
<p><em>state</em>:</p>
|
<tr><td>append</td>
|
||||||
<ul class="simple">
|
<td> </td>
|
||||||
<li>Defaults to ‘present’. When ‘absent’, the user account will be removed if present. Optionally additional removal behaviors can be set with the ‘force’ or ‘remove’ parameter values (see below).</li>
|
<td>no</td>
|
||||||
</ul>
|
<td>if ‘yes’, will only add groups, not set them to just the list in ‘groups’</td>
|
||||||
<p><em>system</em>:</p>
|
</tr>
|
||||||
<ul class="simple">
|
<tr><td>shell</td>
|
||||||
<li>(new in 0.4) Indicates the user (when being created), should be a system account. This does not allow changing users from and to system accounts. Value is ‘yes’ or ‘no’, default is ‘no’.</li>
|
<td> </td>
|
||||||
</ul>
|
<td> </td>
|
||||||
<p><em>force</em>:</p>
|
<td>optionally set the user’s shell</td>
|
||||||
<ul class="simple">
|
</tr>
|
||||||
<li>When used with a state of ‘absent’, the behavior denoted in the ‘userdel’ manpage for <tt class="docutils literal"><span class="pre">--force</span></tt> is also used when removing the user. Value is ‘yes’ or ‘no’, default is ‘no’.</li>
|
<tr><td>createhome</td>
|
||||||
</ul>
|
<td> </td>
|
||||||
<p><em>remove</em>:</p>
|
<td>yes</td>
|
||||||
<ul class="simple">
|
<td>unless ‘no’, a home directory will be made for the user</td>
|
||||||
<li>When used with a state of ‘absent’, the behavior denoted in the ‘userdel’ manpage for <tt class="docutils literal"><span class="pre">--remove</span></tt> is also used when removing the user. Value is ‘yes’ or ‘no’, default is ‘no’.</li>
|
</tr>
|
||||||
</ul>
|
<tr><td>home</td>
|
||||||
|
<td> </td>
|
||||||
|
<td> </td>
|
||||||
|
<td>sets where the user’s homedir should be, if not the default</td>
|
||||||
|
</tr>
|
||||||
|
<tr><td>password</td>
|
||||||
|
<td> </td>
|
||||||
|
<td> </td>
|
||||||
|
<td>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</td>
|
||||||
|
</tr>
|
||||||
|
<tr><td>state</td>
|
||||||
|
<td> </td>
|
||||||
|
<td>present</td>
|
||||||
|
<td>when ‘absent’, removes the user.</td>
|
||||||
|
</tr>
|
||||||
|
<tr><td>system</td>
|
||||||
|
<td> </td>
|
||||||
|
<td>no</td>
|
||||||
|
<td>only when initially creating, setting this to ‘yes’ makes the user a
|
||||||
|
system account. This setting cannot be changed on existing users.</td>
|
||||||
|
</tr>
|
||||||
|
<tr><td>force</td>
|
||||||
|
<td> </td>
|
||||||
|
<td>no</td>
|
||||||
|
<td>when used with state=absent, behavior is as with userdel –force</td>
|
||||||
|
</tr>
|
||||||
|
<tr><td>remove</td>
|
||||||
|
<td> </td>
|
||||||
|
<td>no</td>
|
||||||
|
<td>when used with state=remove, behavior is as with userdel –remove</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
<p>Example action from Ansible <a class="reference internal" href="playbooks.html"><em>Playbooks</em></a>:</p>
|
<p>Example action from Ansible <a class="reference internal" href="playbooks.html"><em>Playbooks</em></a>:</p>
|
||||||
<div class="highlight-python"><pre>user name=mdehaan comment=awesome passwd=awWxVV.JvmdHw createhome=yes
|
<div class="highlight-python"><pre>user name=mdehaan comment=awesome passwd=awWxVV.JvmdHw createhome=yes
|
||||||
user name=mdehaan groups=wheel,skynet
|
user name=mdehaan groups=wheel,skynet
|
||||||
|
@ -745,18 +999,41 @@ user name=mdehaan state=absent force=yes</pre>
|
||||||
<span id="id16"></span><h2>virt<a class="headerlink" href="#virt" title="Permalink to this headline">¶</a></h2>
|
<span id="id16"></span><h2>virt<a class="headerlink" href="#virt" title="Permalink to this headline">¶</a></h2>
|
||||||
<p>Manages virtual machines supported by libvirt. Requires that libvirt be installed
|
<p>Manages virtual machines supported by libvirt. Requires that libvirt be installed
|
||||||
on the managed machine.</p>
|
on the managed machine.</p>
|
||||||
<p><em>guest</em>:</p>
|
<table border="1" class="docutils">
|
||||||
<ul class="simple">
|
<colgroup>
|
||||||
<li>The name of the guest VM being managed</li>
|
<col width="17%" />
|
||||||
</ul>
|
<col width="9%" />
|
||||||
<p><em>state</em></p>
|
<col width="8%" />
|
||||||
<ul class="simple">
|
<col width="66%" />
|
||||||
<li>Desired state of the VM. Either <cite>running</cite>, <cite>shutdown</cite>, <cite>destroyed</cite>, or <cite>undefined</cite>. Note that there may be some lag for state requests like ‘shutdown’, and these states only refer to the virtual machine states. After starting a guest, the guest OS may not be immediately accessible.</li>
|
</colgroup>
|
||||||
</ul>
|
<thead valign="bottom">
|
||||||
<p><em>command</em>:</p>
|
<tr><th class="head">parameter</th>
|
||||||
<ul class="simple">
|
<th class="head">required</th>
|
||||||
<li>In addition to state management, various non-idempotent commands are available for API and script usage (but don’t make much sense in a playbook). These mostly return information, though some also affect state. See examples below.</li>
|
<th class="head">default</th>
|
||||||
</ul>
|
<th class="head">comments</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody valign="top">
|
||||||
|
<tr><td>name</td>
|
||||||
|
<td>yes</td>
|
||||||
|
<td> </td>
|
||||||
|
<td>name of the guest VM being managed</td>
|
||||||
|
</tr>
|
||||||
|
<tr><td>state</td>
|
||||||
|
<td> </td>
|
||||||
|
<td> </td>
|
||||||
|
<td>‘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.</td>
|
||||||
|
</tr>
|
||||||
|
<tr><td>command</td>
|
||||||
|
<td> </td>
|
||||||
|
<td> </td>
|
||||||
|
<td>in addition to state management, various non-idempotent commands are
|
||||||
|
available. See examples below.</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
<p>Example action from Ansible <a class="reference internal" href="playbooks.html"><em>Playbooks</em></a>:</p>
|
<p>Example action from Ansible <a class="reference internal" href="playbooks.html"><em>Playbooks</em></a>:</p>
|
||||||
<div class="highlight-python"><pre>virt guest=alpha state=running
|
<div class="highlight-python"><pre>virt guest=alpha state=running
|
||||||
virt guest=alpha state=shutdown
|
virt guest=alpha state=shutdown
|
||||||
|
@ -781,21 +1058,39 @@ ansible host -m virt -a "command=virttype"</pre>
|
||||||
<div class="section" id="yum">
|
<div class="section" id="yum">
|
||||||
<span id="id17"></span><h2>yum<a class="headerlink" href="#yum" title="Permalink to this headline">¶</a></h2>
|
<span id="id17"></span><h2>yum<a class="headerlink" href="#yum" title="Permalink to this headline">¶</a></h2>
|
||||||
<p>Will install, upgrade, remove, and list packages with the yum package manager.</p>
|
<p>Will install, upgrade, remove, and list packages with the yum package manager.</p>
|
||||||
<p><em>pkg</em>:</p>
|
<table border="1" class="docutils">
|
||||||
<ul class="simple">
|
<colgroup>
|
||||||
<li>A package name or package specifier with version, like name-1.0</li>
|
<col width="17%" />
|
||||||
</ul>
|
<col width="9%" />
|
||||||
<p><em>state</em>:</p>
|
<col width="8%" />
|
||||||
<ul class="simple">
|
<col width="66%" />
|
||||||
<li>Can be either ‘installed’, ‘latest’, or ‘removed’. The default is ‘installed’. (In 0.4 and later, the aliases ‘absent’ and ‘present’ can also be used. They correspond with ‘removed’ and ‘installed’)</li>
|
</colgroup>
|
||||||
</ul>
|
<thead valign="bottom">
|
||||||
<p><em>list</em>:</p>
|
<tr><th class="head">parameter</th>
|
||||||
<ul class="simple">
|
<th class="head">required</th>
|
||||||
<li>When ‘list’ is supplied instead of ‘state’, the yum module can list
|
<th class="head">default</th>
|
||||||
various configuration attributes. Values include ‘installed’, ‘updates’,
|
<th class="head">comments</th>
|
||||||
‘available’, ‘repos’, or any package specifier. (This is more intended for
|
</tr>
|
||||||
use with /usr/bin/ansible or the API, not playbooks.)</li>
|
</thead>
|
||||||
</ul>
|
<tbody valign="top">
|
||||||
|
<tr><td>name</td>
|
||||||
|
<td>yes</td>
|
||||||
|
<td> </td>
|
||||||
|
<td>package name, or package specifier with version, like ‘name-1.0’</td>
|
||||||
|
</tr>
|
||||||
|
<tr><td>state</td>
|
||||||
|
<td> </td>
|
||||||
|
<td>present</td>
|
||||||
|
<td>‘present’, ‘latest’, or ‘absent’.</td>
|
||||||
|
</tr>
|
||||||
|
<tr><td>list</td>
|
||||||
|
<td> </td>
|
||||||
|
<td> </td>
|
||||||
|
<td>various non-idempotent commands for usage with /usr/bin/ansible and not
|
||||||
|
playbooks. See examples below.</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
<p>Example action from Ansible <a class="reference internal" href="playbooks.html"><em>Playbooks</em></a>:</p>
|
<p>Example action from Ansible <a class="reference internal" href="playbooks.html"><em>Playbooks</em></a>:</p>
|
||||||
<div class="highlight-python"><pre>yum pkg=httpd state=latest
|
<div class="highlight-python"><pre>yum pkg=httpd state=latest
|
||||||
yum pkg=httpd state=removed
|
yum pkg=httpd state=removed
|
||||||
|
|
484
rst/modules.rst
484
rst/modules.rst
|
@ -14,9 +14,8 @@ Let's review how we execute three different modules from the command line::
|
||||||
ansible webservers -m command -a "/sbin/reboot -t now"
|
ansible webservers -m command -a "/sbin/reboot -t now"
|
||||||
|
|
||||||
Each module supports taking arguments. Nearly all modules take ``key=value``
|
Each module supports taking arguments. Nearly all modules take ``key=value``
|
||||||
arguments, space delimited. Some modules take
|
arguments, space delimited. Some modules take no arguments, and the
|
||||||
no arguments, and the command/shell modules simply take the string
|
command/shell modules simply take the string of the command you want to run.
|
||||||
of the command you want to run.
|
|
||||||
|
|
||||||
From playbooks, Ansible modules are executed in a very similar way::
|
From playbooks, Ansible modules are executed in a very similar way::
|
||||||
|
|
||||||
|
@ -42,33 +41,24 @@ apt
|
||||||
|
|
||||||
Manages apt-packages (such as for Debian/Ubuntu).
|
Manages apt-packages (such as for Debian/Ubuntu).
|
||||||
|
|
||||||
*pkg*:
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
|
| parameter | required | default | comments |
|
||||||
* A package name or package specifier with version, like `foo`, or `foo=1.0` to install a specific version of the foo package.
|
+====================+==========+=========+============================================================================+
|
||||||
|
| name | no | | A package name or package specifier with version, like `foo` or `foo=1.0` |
|
||||||
*state*:
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
|
| state | no | present | 'absent', 'present', or 'latest'. |
|
||||||
* Can be either 'installed', 'removed', or 'latest'. The default is 'installed'. (In 0.4 and later, the aliases 'absent' and 'present' can also be used. They correspond with 'removed' and 'installed')
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
|
| update-cache | no | no | run the equivalent of apt-get update before the operation? |
|
||||||
*update-cache*:
|
| | | | Can be run as part of the package installation or a seperate step |
|
||||||
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
* Whether the apt cache must be updated prior to operation. This is equivalent
|
| purge | no | no | Will forge purge of configuration files if state is set to 'removed'. |
|
||||||
to doing "apt-get update". Optional, and can be
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
'yes', or 'no'. The default is 'no'. This can be done as the part of a
|
| default-release | no | | Corresponds to the -t option for apt and sets pin priorities |
|
||||||
package operation or as a seperate step.
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
|
| install-recommends | no | yes | Corresponds to the --no-install-recommends option for apt, default |
|
||||||
*purge*:
|
| | | | behavior works as apt's default behavior, 'no' does not install |
|
||||||
|
| | | | recommended packages. Suggested packages are never installed. |
|
||||||
* Will force purge of configuration file for when ensure is set to 'removed'.
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
Defaults to 'no'.
|
|
||||||
|
|
||||||
*default-release*:
|
|
||||||
|
|
||||||
* Corresponds to the -t option for apt, and sets pin priorities
|
|
||||||
|
|
||||||
*install-recommends*: (devel branch now, part of ansible 0.6 later)
|
|
||||||
|
|
||||||
* Corresponds to the --no-install-recommends option for apt. Defaults to 'yes', which means install the recommended packages the same way APT does by default. Set this to 'no' to add the option not to install recommended packages.
|
|
||||||
|
|
||||||
Example action from Ansible :doc:`playbooks`::
|
Example action from Ansible :doc:`playbooks`::
|
||||||
|
|
||||||
|
@ -90,13 +80,15 @@ Assmeble will take a directory of files that have already been transferred to th
|
||||||
together to produce a destination file. Files are assembled in string sorting order. Puppet calls this idea
|
together to produce a destination file. Files are assembled in string sorting order. Puppet calls this idea
|
||||||
"fragments".
|
"fragments".
|
||||||
|
|
||||||
*src*:
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
|
| parameter | required | default | comments |
|
||||||
* An already existing directory full of source files.
|
+====================+==========+=========+============================================================================+
|
||||||
|
| src | yes | | An already existing directory full of source files |
|
||||||
*dest*:
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
|
| dest | yes | | A file to create using the concatenation of all of the source files |
|
||||||
* A file to create using the concatenation of all of the source files.
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
|
| OTHERS | | | All arguments that the file module takes may also be used |
|
||||||
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
|
|
||||||
Example action from Ansible :doc:`playbooks`::
|
Example action from Ansible :doc:`playbooks`::
|
||||||
|
|
||||||
|
@ -110,17 +102,15 @@ authorized_key
|
||||||
|
|
||||||
(new in 0.5). Adds or removes an authorized key for a user from a remote host.
|
(new in 0.5). Adds or removes an authorized key for a user from a remote host.
|
||||||
|
|
||||||
*user*:
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
|
| parameter | required | default | comments |
|
||||||
* Name of the user who access is being granted or remoted to.
|
+====================+==========+=========+============================================================================+
|
||||||
|
| user | yes | | Name of the user who should have access to the remote host |
|
||||||
*state*:
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
|
| key | yes | | the SSH public key, as a string |
|
||||||
* Either 'absent' or 'present', this is whether the given key should be in the authorized keys file or not.
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
|
| state | no | present | whether the given key should or should not be in the file |
|
||||||
*key*:
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
|
|
||||||
* The actual key, as a string.
|
|
||||||
|
|
||||||
Example action from Ansible :doc:`playbooks`::
|
Example action from Ansible :doc:`playbooks`::
|
||||||
|
|
||||||
|
@ -169,17 +159,18 @@ The copy module moves a file on the local box to remote locations. In addition
|
||||||
listed below, the arguments available to the `file` module can also be passed to the copy
|
listed below, the arguments available to the `file` module can also be passed to the copy
|
||||||
module.
|
module.
|
||||||
|
|
||||||
*src*:
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
|
| 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 |
|
||||||
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
|
| OTHERS | | | All arguments the file module takes are also supported |
|
||||||
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
|
|
||||||
* Local path to a file to copy to the remote server. This can be an
|
This module also returns md5sum and other information about the resultant file.
|
||||||
absolute or relative path.
|
|
||||||
|
|
||||||
|
|
||||||
*dest*:
|
|
||||||
|
|
||||||
* Remote absolute path where the file should end up.
|
|
||||||
|
|
||||||
This module also returns md5sum information about the resultant file.
|
|
||||||
|
|
||||||
Example action from Ansible :doc:`playbooks`::
|
Example action from Ansible :doc:`playbooks`::
|
||||||
|
|
||||||
|
@ -208,17 +199,16 @@ fetch
|
||||||
This module works like 'copy', but in reverse. It is used for fetching files
|
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.
|
from remote machines and storing them locally in a file tree, organized by hostname.
|
||||||
|
|
||||||
*src*:
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
|
| parameter | required | default | comments |
|
||||||
* The file on the remote system to fetch. This needs to be a file, not a directory. Recursive fetching may be supported later.
|
+====================+==========+=========+============================================================================+
|
||||||
|
| src | yes | | The file on the remote system to fetch. This needs to be a file, not |
|
||||||
*dest*:
|
| | | | a directory. Recursive fetching may be supported in a later release. |
|
||||||
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
* 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' (in Ansible 0.0.3 and later).
|
| 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 |
|
||||||
The fetch module is a useful way to gather log files from remote systems. If you require
|
| | | | be saved into '/foo/host.example.com/tmp/bar' |
|
||||||
fetching multiple files from remote systems, you may wish to execute a tar command and
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
then fetch the tarball.
|
|
||||||
|
|
||||||
Example::
|
Example::
|
||||||
|
|
||||||
|
@ -228,53 +218,47 @@ Example::
|
||||||
file
|
file
|
||||||
````
|
````
|
||||||
|
|
||||||
Sets attributes of files, symlinks, and directories, or removes files/symlinks/directories.
|
Sets attributes of files, symlinks, and directories, or removes files/symlinks/directories. Many other modules
|
||||||
All parameters available to the file module are also available when running the `copy` or
|
support the same options as the file module -- including 'copy', 'template', and 'assmeble'.
|
||||||
`template` modules.
|
|
||||||
|
|
||||||
*dest*:
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
|
| parameter | required | default | comments |
|
||||||
* alias for 'path'. Sets an absolute path to a file on the filesystem when used with 'state=file'. When used with 'state=link', sets the destination to create a symbolic link defined by 'src' key.
|
+====================+==========+=========+============================================================================+
|
||||||
|
| dest | yes | | defines the file being managed, unless when used with state=link, and |
|
||||||
*state*:
|
| | | | then sets the destination to create a symbolic link to using 'src' |
|
||||||
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
* either 'file', 'link', 'directory', or 'absent'. The default is 'file'. If 'directory', the directory and all immediate subdirectories will be created if they do not exist. If 'file', the file will NOT be created if it does not exist, specify `copy` or `template` for the module name instead if you need to put content at the specified location. If 'link', the symbolic link will be created or changed. If 'absent', directories will be recursively deleted, and files or symlinks will be unlinked.
|
| state | | file | values are 'file', 'link', 'directory', or 'absent'. If directory, |
|
||||||
|
| | | | all immediate subdirectories will be created if they do not exist. If |
|
||||||
*mode*:
|
| | | | 'file', the file will NOT be created if it does not exist, see the 'copy' |
|
||||||
|
| | | | or 'template' module if you want that behavior. If 'link', the symbolic |
|
||||||
* the mode the file or directory should be, such as 644, as would be given to `chmod`. English modes like "g+x" are not yet supported.
|
| | | | link will be created or changed. If absent, directories will be |
|
||||||
|
| | | | recursively deleted, and files or symlinks will be unlinked. |
|
||||||
*owner*:
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
|
| mode | | | mode the file or directory shoudl be, such as 0644 as would be fed to |
|
||||||
* name of user that should own the file or directory, as would be given to `chown`
|
| | | | chmod. English modes like 'g+x' are not yet supported |
|
||||||
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
*group*:
|
| owner | | | name of the user that should own the file/directory, as would be fed to |
|
||||||
|
| | | | chown |
|
||||||
* name of group that should own the file or directory, as would be given to `chgrp`
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
|
| group | | | name of the group that should own the file/directory, as would be fed to |
|
||||||
*src*:
|
| | | | group |
|
||||||
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
* path of the file to link to (applies only to 'link' state)
|
| src | | | path of the file to link to (applies only to state=link) |
|
||||||
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
*seuser*:
|
| seuser | | | user part of SELinux file context. Will default to system policy, if |
|
||||||
|
| | | | applicable. If set to '_default', it will use the 'user' portion of the |
|
||||||
* 'user' part of SELinux file context. Will default to what is provided by system policy, if available. Only used on systems with SELinux present. If you specify '_default', it will use the 'user' portion of default context from the policy if available.
|
| | | | the policy if available |
|
||||||
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
*serole*:
|
| serole | | | role part of SELinux file context, '_default' feature works as above. |
|
||||||
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
* 'role' part of SELinux file context. Will default to what is provided by system policy, if available. Only used on systems with SELinux present. If you specify '_default', it will use the 'role' portion of default context from the policy if available.
|
| setype | | | type part of SELinux file context, '_default' feature works as above |
|
||||||
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
*setype*:
|
| selevel | | s0 | level part of the SELinux file context. This is the MLS/MCS attribute, |
|
||||||
|
| | | | sometimes known as the 'range'. '_default' feature works as above |
|
||||||
* 'type' part of SELinux file context. Will default to what is provided by system policy, if available. Only used on systems with SELinux present. If you specify '_default', it will use the 'type' portion of default context from the policy if available.
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
|
| context | | | accepts only 'default' as a value. This will restore a file's selinux |
|
||||||
*selevel*:
|
| | | | context in the policy. Does nothing if no default is available. |
|
||||||
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
* 'level' part of SELinux file context. This is the MLS and MCS attribute of the file context, also sometimes known as the 'range'. It defaults to 's0'. Only used only used on hosts with SELinux present. If you specify '_default', it will use the 'level' portion of default context from the policy if available.
|
|
||||||
|
|
||||||
*context*:
|
|
||||||
|
|
||||||
* accepts only 'default' as value. This will restore a file's selinux context to the default context in the policy. Does nothing if no default is available. Only used on hosts with SELinux present.
|
|
||||||
|
|
||||||
Example action from Ansible :doc:`playbooks`::
|
Example action from Ansible :doc:`playbooks`::
|
||||||
|
|
||||||
|
@ -292,22 +276,18 @@ git
|
||||||
|
|
||||||
Deploys software (or files) from git checkouts.
|
Deploys software (or files) from git checkouts.
|
||||||
|
|
||||||
*repo*:
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
|
| parameter | required | default | comments |
|
||||||
* git, ssh, or http protocol address of the git repo to checkout.
|
+====================+==========+=========+============================================================================+
|
||||||
|
| repo | yes | | git, ssh, or http protocol address of the git repo |
|
||||||
*dest*:
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
|
| dest | yes | | absolute path of where the repo should be checked out to |
|
||||||
* Where to check it out, an absolute directory path.
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
|
| version | | | what version to check out -- either the git SHA, the literal string |
|
||||||
*version*:
|
| | | | 'HEAD', branch name, or a tag name. |
|
||||||
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
* What version to check out -- either the git SHA, the literal string
|
| remote | | origin | name of the remote branch |
|
||||||
``HEAD``, branch name, or a tag name.
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
|
|
||||||
*remote*:
|
|
||||||
|
|
||||||
* Name of the remote branch, defaults to 'origin'.
|
|
||||||
|
|
||||||
Example action from Ansible :doc:`playbooks`::
|
Example action from Ansible :doc:`playbooks`::
|
||||||
|
|
||||||
|
@ -320,22 +300,17 @@ group
|
||||||
|
|
||||||
Adds or removes groups.
|
Adds or removes groups.
|
||||||
|
|
||||||
*name*:
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
|
| parameter | required | default | comments |
|
||||||
* name of the group
|
+====================+==========+=========+============================================================================+
|
||||||
|
| name | yes | | name of the group |
|
||||||
*gid*:
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
|
| gid | | | optional git to set for the group |
|
||||||
* optional gid to set for the group
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
|
| state | | present | 'absent' or 'present' |
|
||||||
*state*:
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
|
| system | | no | if 'yes', indicates that the group being created is a system group. |
|
||||||
* either 'absent', or 'present'. 'present' is the default.
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
|
|
||||||
*system*:
|
|
||||||
|
|
||||||
* (new in 0.4) Indicates the group (when being created), should be a system group. This does not allow changing groups from and to system groups. Value is 'yes' or 'no', default is 'no'.
|
|
||||||
|
|
||||||
|
|
||||||
To control members of the group, see the users resource.
|
To control members of the group, see the users resource.
|
||||||
|
|
||||||
|
@ -398,25 +373,21 @@ service
|
||||||
|
|
||||||
Controls services on remote machines.
|
Controls services on remote machines.
|
||||||
|
|
||||||
*state*:
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
|
| parameter | required | default | comments |
|
||||||
* Values are ``started``, ``stopped``, ``reloaded``, or ``restarted``.
|
+====================+==========+=========+============================================================================+
|
||||||
Started/stopped are idempotent actions that will not run commands
|
| name | yes | | name of the service |
|
||||||
unless necessary. ``restarted`` will always bounce the service, ``reloaded``
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
will always issue a reload.
|
| state | no | started | 'started', 'stopped', 'reloaded', or 'restarted'. Started/stopped are |
|
||||||
|
| | | | idempotent actions that will not run commands unless neccessary. |
|
||||||
*enabled*:
|
| | | | 'restarted' will always bounce the service, 'reloaded' will always reload. |
|
||||||
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
* (new in 0.4) Whether the service should start on boot. Either 'yes' or 'no'.
|
| enabled | no | | Whether the service should start on boot. Either 'yes' or 'no'. |
|
||||||
Uses chkconfig or updates-rc.d as appropriate.
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
|
| list | no | | when used as 'list=status', returns the status of the service along with |
|
||||||
*list*:
|
| | | | other results. Primarily useful for /usr/bin/ansible or playbooks with |
|
||||||
|
| | | | --verbose. |
|
||||||
* (new in 0.4) When used with the value 'status', returns the status of the service along with other results. This is primarily useful for /usr/bin/ansible, and not meaningful for playbooks.
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
|
|
||||||
*name*:
|
|
||||||
|
|
||||||
* The name of the service.
|
|
||||||
|
|
||||||
Example action from Ansible :doc:`playbooks`::
|
Example action from Ansible :doc:`playbooks`::
|
||||||
|
|
||||||
|
@ -430,11 +401,9 @@ Example action from Ansible :doc:`playbooks`::
|
||||||
setup
|
setup
|
||||||
`````
|
`````
|
||||||
|
|
||||||
Writes a JSON file containing key/value data, for use in templating.
|
This module is automatically called by playbooks to gather useful variables about remote hosts that can be used
|
||||||
Call this once before using the :ref:`template` module. Playbooks
|
in playbooks. It can also be executed directly by /usr/bin/ansible to check what variables are available
|
||||||
will execute this module automatically as the first step in each play
|
to a host.
|
||||||
using the variables section, so it is unnecessary to make explicit
|
|
||||||
calls to setup within a playbook.
|
|
||||||
|
|
||||||
Ansible provides many 'facts' about the system, automatically.
|
Ansible provides many 'facts' about the system, automatically.
|
||||||
|
|
||||||
|
@ -514,19 +483,9 @@ All variables are bubbled up to the caller. Using the ansible facts and choosin
|
||||||
to not install facter and ohai means you can avoid ruby-dependencies
|
to not install facter and ohai means you can avoid ruby-dependencies
|
||||||
on your remote systems.
|
on your remote systems.
|
||||||
|
|
||||||
*variablename*:
|
|
||||||
|
|
||||||
* Arbitrary variable names, which must be a mix of alphanumeric characters and underscores, can also be defined. Setting a variable creates a ``key=value`` pair in the JSON file for use in templating.
|
|
||||||
|
|
||||||
Example action from Ansible :doc:`playbooks`::
|
|
||||||
|
|
||||||
vars:
|
|
||||||
ntpserver: 'ntp.example.com'
|
|
||||||
xyz: 1234
|
|
||||||
|
|
||||||
Example action from `/usr/bin/ansible`::
|
Example action from `/usr/bin/ansible`::
|
||||||
|
|
||||||
ansible all -m setup -a "ntpserver=ntp.example.com xyz=1234"
|
ansible testserver -m setup
|
||||||
|
|
||||||
|
|
||||||
.. _shell:
|
.. _shell:
|
||||||
|
@ -560,21 +519,18 @@ Example action from a playbook::
|
||||||
template
|
template
|
||||||
````````
|
````````
|
||||||
|
|
||||||
Templates a file out to a remote server. Call the :ref:`setup` module
|
Templates a file out to a remote server.
|
||||||
prior to usage if you are not running from a playbook. In addition to the options
|
|
||||||
listed below, the arguments available to the `file` and `copy` modules can also be passed
|
|
||||||
to the template module.
|
|
||||||
|
|
||||||
*src*:
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
|
| parameter | required | default | comments |
|
||||||
* Path of a Jinja2 formatted template on the local server. This can
|
+====================+==========+=========+============================================================================+
|
||||||
be a relative or absolute path.
|
| src | yes | | Path of a Jinja2 formatted template on the local server. This can be |
|
||||||
|
| | | | a relative or absolute path. |
|
||||||
*dest*:
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
|
| dest | yes | | Location to render the template on the remote server |
|
||||||
* Location to render the template on the remote server
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
|
| OTHERS | | | This module also supports all of the arguments to the file module |
|
||||||
This module also returns md5sum information about the resultant file.
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
|
|
||||||
Example action from a playbook::
|
Example action from a playbook::
|
||||||
|
|
||||||
|
@ -588,61 +544,40 @@ user
|
||||||
|
|
||||||
Creates user accounts, manipulates existing user accounts, and removes user accounts.
|
Creates user accounts, manipulates existing user accounts, and removes user accounts.
|
||||||
|
|
||||||
*name*:
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
|
| parameter | required | default | comments |
|
||||||
* Name of the user to create, remove, or edit
|
+====================+==========+=========+============================================================================+
|
||||||
|
| name | yes | | name of the user to create, remove, or edit |
|
||||||
*comment*:
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
|
| comment | | | optionally sets the description of the user |
|
||||||
* Optionally sets the description of the user
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
|
| uid | | | optionally sets the uid of the user |
|
||||||
*uid*:
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
|
| group | | | optionally sets the user's primary group (takes a group name) |
|
||||||
* optional uid to set for the user
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
|
| groups | | | puts the user in this comma-delimited list of groups |
|
||||||
*group*:
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
|
| append | | no | if 'yes', will only add groups, not set them to just the list in 'groups' |
|
||||||
* Optionally sets the user's primary group, takes a group name
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
|
| shell | | | optionally set the user's shell |
|
||||||
*groups*:
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
|
| createhome | | yes | unless 'no', a home directory will be made for the user |
|
||||||
* Put the user in the specified groups, takes comma delimited group names
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
|
| home | | | sets where the user's homedir should be, if not the default |
|
||||||
*append*:
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
|
| password | | | optionally set the user's password to this crypted value. See the user's |
|
||||||
* If true, will only add additional groups to the user listed in 'groups', rather than making the user only be in those specified groups
|
| | | | example in the github examples directory for what this looks like in a |
|
||||||
|
| | | | playbook |
|
||||||
*shell*:
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
|
| state | | present | when 'absent', removes the user. |
|
||||||
* Optionally sets the user's shell
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
|
| system | | no | only when initially creating, setting this to 'yes' makes the user a |
|
||||||
*createhome*:
|
| | | | system account. This setting cannot be changed on existing users. |
|
||||||
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
* Whether to create the user's home directory. Takes 'yes', or 'no'. The default is 'yes'.
|
| force | | no | when used with state=absent, behavior is as with userdel --force |
|
||||||
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
*home=*:
|
| remove | | no | when used with state=remove, behavior is as with userdel --remove |
|
||||||
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
* Specifies where the user's home directory should be, if not in /home/$username.
|
|
||||||
|
|
||||||
*password*:
|
|
||||||
|
|
||||||
* Sets the user's password to this crypted value. Pass in a result from crypt. See the users example in the github examples directory for what this looks like in a playbook.
|
|
||||||
|
|
||||||
*state*:
|
|
||||||
|
|
||||||
* Defaults to 'present'. When 'absent', the user account will be removed if present. Optionally additional removal behaviors can be set with the 'force' or 'remove' parameter values (see below).
|
|
||||||
|
|
||||||
*system*:
|
|
||||||
|
|
||||||
* (new in 0.4) Indicates the user (when being created), should be a system account. This does not allow changing users from and to system accounts. Value is 'yes' or 'no', default is 'no'.
|
|
||||||
|
|
||||||
*force*:
|
|
||||||
|
|
||||||
* When used with a state of 'absent', the behavior denoted in the 'userdel' manpage for ``--force`` is also used when removing the user. Value is 'yes' or 'no', default is 'no'.
|
|
||||||
|
|
||||||
*remove*:
|
|
||||||
|
|
||||||
* When used with a state of 'absent', the behavior denoted in the 'userdel' manpage for ``--remove`` is also used when removing the user. Value is 'yes' or 'no', default is 'no'.
|
|
||||||
|
|
||||||
Example action from Ansible :doc:`playbooks`::
|
Example action from Ansible :doc:`playbooks`::
|
||||||
|
|
||||||
|
@ -658,17 +593,18 @@ virt
|
||||||
Manages virtual machines supported by libvirt. Requires that libvirt be installed
|
Manages virtual machines supported by libvirt. Requires that libvirt be installed
|
||||||
on the managed machine.
|
on the managed machine.
|
||||||
|
|
||||||
*guest*:
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
|
| parameter | required | default | comments |
|
||||||
* The name of the guest VM being managed
|
+====================+==========+=========+============================================================================+
|
||||||
|
| name | yes | | name of the guest VM being managed |
|
||||||
*state*
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
|
| state | | | 'running', 'shutdown', 'destroyed', or 'undefined'. Note that there may |
|
||||||
* Desired state of the VM. Either `running`, `shutdown`, `destroyed`, or `undefined`. Note that there may be some lag for state requests like 'shutdown', and these states only refer to the virtual machine states. After starting a guest, the guest OS may not be immediately accessible.
|
| | | | 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*:
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
|
| command | | | in addition to state management, various non-idempotent commands are |
|
||||||
* In addition to state management, various non-idempotent commands are available for API and script usage (but don't make much sense in a playbook). These mostly return information, though some also affect state. See examples below.
|
| | | | available. See examples below. |
|
||||||
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
|
|
||||||
Example action from Ansible :doc:`playbooks`::
|
Example action from Ansible :doc:`playbooks`::
|
||||||
|
|
||||||
|
@ -700,20 +636,16 @@ yum
|
||||||
|
|
||||||
Will install, upgrade, remove, and list packages with the yum package manager.
|
Will install, upgrade, remove, and list packages with the yum package manager.
|
||||||
|
|
||||||
*pkg*:
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
|
| parameter | required | default | comments |
|
||||||
* A package name or package specifier with version, like name-1.0
|
+====================+==========+=========+============================================================================+
|
||||||
|
| name | yes | | package name, or package specifier with version, like 'name-1.0' |
|
||||||
*state*:
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
|
| state | | present | 'present', 'latest', or 'absent'. |
|
||||||
* Can be either 'installed', 'latest', or 'removed'. The default is 'installed'. (In 0.4 and later, the aliases 'absent' and 'present' can also be used. They correspond with 'removed' and 'installed')
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
|
| list | | | various non-idempotent commands for usage with /usr/bin/ansible and not |
|
||||||
*list*:
|
| | | | playbooks. See examples below. |
|
||||||
|
+--------------------+----------+---------+----------------------------------------------------------------------------+
|
||||||
* When 'list' is supplied instead of 'state', the yum module can list
|
|
||||||
various configuration attributes. Values include 'installed', 'updates',
|
|
||||||
'available', 'repos', or any package specifier. (This is more intended for
|
|
||||||
use with /usr/bin/ansible or the API, not playbooks.)
|
|
||||||
|
|
||||||
Example action from Ansible :doc:`playbooks`::
|
Example action from Ansible :doc:`playbooks`::
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue