Allude to apt on the examples page.
This commit is contained in:
parent
1f565c3d76
commit
d7b11e4a10
6 changed files with 21 additions and 18 deletions
|
@ -235,6 +235,7 @@ ansible webservers -m file -a "dest=/srv/foo/b.txt mode=600 owner=mdehaan group=
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="managing-packages">
|
<div class="section" id="managing-packages">
|
||||||
<h2>Managing Packages<a class="headerlink" href="#managing-packages" title="Permalink to this headline">¶</a></h2>
|
<h2>Managing Packages<a class="headerlink" href="#managing-packages" title="Permalink to this headline">¶</a></h2>
|
||||||
|
<p>There are modules available for yum and apt. Here are some examples with yum.</p>
|
||||||
<p>Ensure a package is installed, but don’t update it:</p>
|
<p>Ensure a package is installed, but don’t update it:</p>
|
||||||
<div class="highlight-python"><pre>ansible webservers -m yum -a "pkg=acme state=installed"</pre>
|
<div class="highlight-python"><pre>ansible webservers -m yum -a "pkg=acme state=installed"</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>ansible-playbook</title><link rel="stylesheet" href="./docbook-xsl.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.75.2" /></head><body><div xml:lang="en" class="refentry" title="ansible-playbook" lang="en"><a id="id493526"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>ansible-playbook — run an ansible playbook</p></div><div class="refsynopsisdiv" title="Synopsis"><a id="_synopsis"></a><h2>Synopsis</h2><p>ansible-playbook <filename.yml> … [options]</p></div><div class="refsect1" title="DESCRIPTION"><a id="_description"></a><h2>DESCRIPTION</h2><p><span class="strong"><strong>Ansible playbooks</strong></span> are a configuration and multinode deployment
|
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>ansible-playbook</title><link rel="stylesheet" href="./docbook-xsl.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.75.2" /></head><body><div xml:lang="en" class="refentry" title="ansible-playbook" lang="en"><a id="id420379"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>ansible-playbook — run an ansible playbook</p></div><div class="refsynopsisdiv" title="Synopsis"><a id="_synopsis"></a><h2>Synopsis</h2><p>ansible-playbook <filename.yml> … [options]</p></div><div class="refsect1" title="DESCRIPTION"><a id="_description"></a><h2>DESCRIPTION</h2><p><span class="strong"><strong>Ansible playbooks</strong></span> are a configuration and multinode deployment
|
||||||
system. Ansible-playbook is the tool used to run them. See the
|
system. Ansible-playbook is the tool used to run them. See the
|
||||||
project home page (link below) for more information.</p></div><div class="refsect1" title="ARGUMENTS"><a id="_arguments"></a><h2>ARGUMENTS</h2><div class="variablelist"><dl><dt><span class="term">
|
project home page (link below) for more information.</p></div><div class="refsect1" title="ARGUMENTS"><a id="_arguments"></a><h2>ARGUMENTS</h2><div class="variablelist"><dl><dt><span class="term">
|
||||||
<span class="strong"><strong>filename.yml</strong></span>
|
<span class="strong"><strong>filename.yml</strong></span>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>ansible</title><link rel="stylesheet" href="./docbook-xsl.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.75.2" /></head><body><div xml:lang="en" class="refentry" title="ansible" lang="en"><a id="id481682"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>ansible — run a command somewhere else</p></div><div class="refsynopsisdiv" title="Synopsis"><a id="_synopsis"></a><h2>Synopsis</h2><p>ansible <host-pattern> [-f forks] [-m module_name] [-a args]</p></div><div class="refsect1" title="DESCRIPTION"><a id="_description"></a><h2>DESCRIPTION</h2><p><span class="strong"><strong>Ansible</strong></span> is an extra-simple tool/framework/API for doing 'remote things' over
|
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>ansible</title><link rel="stylesheet" href="./docbook-xsl.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.75.2" /></head><body><div xml:lang="en" class="refentry" title="ansible" lang="en"><a id="id571043"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>ansible — run a command somewhere else</p></div><div class="refsynopsisdiv" title="Synopsis"><a id="_synopsis"></a><h2>Synopsis</h2><p>ansible <host-pattern> [-f forks] [-m module_name] [-a args]</p></div><div class="refsect1" title="DESCRIPTION"><a id="_description"></a><h2>DESCRIPTION</h2><p><span class="strong"><strong>Ansible</strong></span> is an extra-simple tool/framework/API for doing 'remote things' over
|
||||||
SSH.</p></div><div class="refsect1" title="ARGUMENTS"><a id="_arguments"></a><h2>ARGUMENTS</h2><div class="variablelist"><dl><dt><span class="term">
|
SSH.</p></div><div class="refsect1" title="ARGUMENTS"><a id="_arguments"></a><h2>ARGUMENTS</h2><div class="variablelist"><dl><dt><span class="term">
|
||||||
<span class="strong"><strong>host-pattern</strong></span>
|
<span class="strong"><strong>host-pattern</strong></span>
|
||||||
</span></dt><dd>
|
</span></dt><dd>
|
||||||
|
|
30
modules.html
30
modules.html
|
@ -193,7 +193,7 @@ command line or playbooks, you don’t really need to know much about
|
||||||
that. If you’re writing your own module, you care, and this means you do
|
that. If you’re writing your own module, you care, and this means you do
|
||||||
not have to write modules in any particular language – you get tho choose.</p>
|
not have to write modules in any particular language – you get tho choose.</p>
|
||||||
<p>Most modules other than command are <cite>idempotent</cite>, meaning they will seek
|
<p>Most modules other than command are <cite>idempotent</cite>, meaning they will seek
|
||||||
to avoid changes to the system unless a change needs to be made. When using ansible
|
to avoid changes to the system unless a change needs to be made. When using Ansible
|
||||||
playbooks, these modules can trigger ‘change events’. Unless otherwise
|
playbooks, these modules can trigger ‘change events’. Unless otherwise
|
||||||
noted, any given module does support change hooks.</p>
|
noted, any given module does support change hooks.</p>
|
||||||
<p>Let’s see what’s available in the Ansible module library, out of the box:</p>
|
<p>Let’s see what’s available in the Ansible module library, out of the box:</p>
|
||||||
|
@ -209,7 +209,7 @@ noted, any given module does support change hooks.</p>
|
||||||
<li>Can be either ‘installed’ or ‘removed’. NOTE: support</li>
|
<li>Can be either ‘installed’ or ‘removed’. NOTE: support</li>
|
||||||
</ul>
|
</ul>
|
||||||
<p>for ‘latest’ (see yum, below) is in work.</p>
|
<p>for ‘latest’ (see yum, below) is in work.</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>apt pkg=foo ensure=removed
|
<div class="highlight-python"><pre>apt pkg=foo ensure=removed
|
||||||
apt pkg=foo ensure=installed</pre>
|
apt pkg=foo ensure=installed</pre>
|
||||||
</div>
|
</div>
|
||||||
|
@ -228,7 +228,7 @@ paths to commands must be fully qualified.</p>
|
||||||
<p>This module does not support change hooks and returns the return code
|
<p>This module does not support change hooks and returns the return code
|
||||||
from the program as well as timing information about how long the
|
from the program as well as timing information about how long the
|
||||||
command was running for.</p>
|
command was running for.</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>command /sbin/shutdown -t now</pre>
|
<div class="highlight-python"><pre>command /sbin/shutdown -t now</pre>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -247,7 +247,7 @@ absolute or relative path.</li>
|
||||||
<li>Remote absolute path where the file should end up.</li>
|
<li>Remote absolute path where the file should end up.</li>
|
||||||
</ul>
|
</ul>
|
||||||
<p>This module also returns md5sum information about the resultant file.</p>
|
<p>This module also returns md5sum 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>
|
||||||
</div>
|
</div>
|
||||||
|
@ -285,7 +285,7 @@ to the file module are also available when running the <cite>copy</cite> or <cit
|
||||||
<ul class="simple">
|
<ul class="simple">
|
||||||
<li>name of group that should own the file or directory, as would be given to <cite>chgrp</cite></li>
|
<li>name of group that should own the file or directory, as would be given to <cite>chgrp</cite></li>
|
||||||
</ul>
|
</ul>
|
||||||
<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 dest=/etc/foo.conf owner=foo group=foo mode=0644
|
<div class="highlight-python"><pre>file dest=/etc/foo.conf owner=foo group=foo mode=0644
|
||||||
file dest=/some/path owner=foo group=foo state=directory
|
file dest=/some/path owner=foo group=foo state=directory
|
||||||
file dest/path/to/delete state=absent</pre>
|
file dest/path/to/delete state=absent</pre>
|
||||||
|
@ -307,7 +307,7 @@ file dest/path/to/delete state=absent</pre>
|
||||||
<li>What version to check out – either the git SHA, the literal string
|
<li>What version to check out – either the git SHA, the literal string
|
||||||
<tt class="docutils literal"><span class="pre">HEAD</span></tt>, or a tag name.</li>
|
<tt class="docutils literal"><span class="pre">HEAD</span></tt>, or a tag name.</li>
|
||||||
</ul>
|
</ul>
|
||||||
<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>
|
||||||
</div>
|
</div>
|
||||||
|
@ -342,7 +342,7 @@ unless necessary. <tt class="docutils literal"><span class="pre">restarted</spa
|
||||||
<ul class="simple">
|
<ul class="simple">
|
||||||
<li>The name of the service.</li>
|
<li>The name of the service.</li>
|
||||||
</ul>
|
</ul>
|
||||||
<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
|
||||||
service name=httpd state=restarted</pre>
|
service name=httpd state=restarted</pre>
|
||||||
|
@ -366,13 +366,13 @@ tell their source. All variables are then bubbled up to the caller.</p>
|
||||||
<tt class="docutils literal"><span class="pre">key=value</span></tt> pair in the JSON file for use in templating.</li>
|
<tt class="docutils literal"><span class="pre">key=value</span></tt> pair in the JSON file for use in templating.</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div></blockquote>
|
</div></blockquote>
|
||||||
<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>vars:
|
<div class="highlight-python"><pre>vars:
|
||||||
ntpserver: 'ntp.example.com'
|
ntpserver: 'ntp.example.com'
|
||||||
xyz: 1234</pre>
|
xyz: 1234</pre>
|
||||||
</div>
|
</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 -m all setup -a "ntpserver=ntp.example.com xyz=1234"</pre>
|
<div class="highlight-python"><pre>Ansible -m all setup -a "ntpserver=ntp.example.com xyz=1234"</pre>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="shell">
|
<div class="section" id="shell">
|
||||||
|
@ -445,7 +445,7 @@ example in the github examples directory for what this looks like in a playbook.
|
||||||
<ul class="simple">
|
<ul class="simple">
|
||||||
<li>Defaults to ‘present’. When ‘absent’, the user account will be removed if present.</li>
|
<li>Defaults to ‘present’. When ‘absent’, the user account will be removed if present.</li>
|
||||||
</ul>
|
</ul>
|
||||||
<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 state=absent</pre>
|
user name=mdehaan state=absent</pre>
|
||||||
</div>
|
</div>
|
||||||
|
@ -467,7 +467,7 @@ user name=mdehaan state=absent</pre>
|
||||||
various configuration attributes. Values include ‘installed’, ‘updates’,
|
various configuration attributes. Values include ‘installed’, ‘updates’,
|
||||||
‘available’, ‘repos’, or any package specifier.</li>
|
‘available’, ‘repos’, or any package specifier.</li>
|
||||||
</ul>
|
</ul>
|
||||||
<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 ensure=latest
|
<div class="highlight-python"><pre>yum pkg=httpd ensure=latest
|
||||||
yum pkg=httpd ensure=removed
|
yum pkg=httpd ensure=removed
|
||||||
yum pkg=httpd ensure=installed</pre>
|
yum pkg=httpd ensure=installed</pre>
|
||||||
|
@ -480,14 +480,14 @@ yum pkg=httpd ensure=installed</pre>
|
||||||
<p class="first admonition-title">See also</p>
|
<p class="first admonition-title">See also</p>
|
||||||
<dl class="last docutils">
|
<dl class="last docutils">
|
||||||
<dt><a class="reference internal" href="examples.html"><em>Command Line Examples</em></a></dt>
|
<dt><a class="reference internal" href="examples.html"><em>Command Line Examples</em></a></dt>
|
||||||
<dd>Examples of using modules in /usr/bin/ansible</dd>
|
<dd>Examples of using modules in /usr/bin/Ansible</dd>
|
||||||
<dt><a class="reference internal" href="playbooks.html"><em>Playbooks</em></a></dt>
|
<dt><a class="reference internal" href="playbooks.html"><em>Playbooks</em></a></dt>
|
||||||
<dd>Examples of using modules with /usr/bin/ansible-playbook</dd>
|
<dd>Examples of using modules with /usr/bin/Ansible-playbook</dd>
|
||||||
<dt><a class="reference internal" href="moduledev.html"><em>Module Development Guide</em></a></dt>
|
<dt><a class="reference internal" href="moduledev.html"><em>Module Development Guide</em></a></dt>
|
||||||
<dd>How to write your own modules</dd>
|
<dd>How to write your own modules</dd>
|
||||||
<dt><a class="reference internal" href="api.html"><em>API & Integrations</em></a></dt>
|
<dt><a class="reference internal" href="api.html"><em>API & Integrations</em></a></dt>
|
||||||
<dd>Examples of using modules with the Python API</dd>
|
<dd>Examples of using modules with the Python API</dd>
|
||||||
<dt><a class="reference external" href="http://groups.google.com/group/ansible-project">Mailing List</a></dt>
|
<dt><a class="reference external" href="http://groups.google.com/group/Ansible-project">Mailing List</a></dt>
|
||||||
<dd>Questions? Help? Ideas? Stop by the list on Google Groups</dd>
|
<dd>Questions? Help? Ideas? Stop by the list on Google Groups</dd>
|
||||||
<dt><a class="reference external" href="http://irc.freenode.net">irc.freenode.net</a></dt>
|
<dt><a class="reference external" href="http://irc.freenode.net">irc.freenode.net</a></dt>
|
||||||
<dd>#ansible IRC chat channel</dd>
|
<dd>#ansible IRC chat channel</dd>
|
||||||
|
|
|
@ -96,6 +96,8 @@ The mode, owner, and group arguments can also be used on the copy or template li
|
||||||
Managing Packages
|
Managing Packages
|
||||||
`````````````````
|
`````````````````
|
||||||
|
|
||||||
|
There are modules available for yum and apt. Here are some examples with yum.
|
||||||
|
|
||||||
Ensure a package is installed, but don't update it::
|
Ensure a package is installed, but don't update it::
|
||||||
|
|
||||||
ansible webservers -m yum -a "pkg=acme state=installed"
|
ansible webservers -m yum -a "pkg=acme state=installed"
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue