docs build + formatting fix on the modules page
This commit is contained in:
parent
6eb53ad540
commit
d3fa1c36a5
16 changed files with 162 additions and 52 deletions
|
@ -275,7 +275,7 @@ languages:
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
© Copyright 2012 Michael DeHaan.<br/>
|
© Copyright 2012 Michael DeHaan.<br/>
|
||||||
Last updated on Jun 19, 2012.<br/>
|
Last updated on Jul 04, 2012.<br/>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
2
api.html
2
api.html
|
@ -359,7 +359,7 @@ a conf.d file appropriately or something similar. Who knows?</p>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
© Copyright 2012 Michael DeHaan.<br/>
|
© Copyright 2012 Michael DeHaan.<br/>
|
||||||
Last updated on Jun 19, 2012.<br/>
|
Last updated on Jul 04, 2012.<br/>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
|
@ -150,6 +150,7 @@ s.parentNode.insertBefore(ga, s);
|
||||||
<li><a class="reference internal" href="#">Best Practices</a><ul>
|
<li><a class="reference internal" href="#">Best Practices</a><ul>
|
||||||
<li><a class="reference internal" href="#group-by-roles">Group By Roles</a></li>
|
<li><a class="reference internal" href="#group-by-roles">Group By Roles</a></li>
|
||||||
<li><a class="reference internal" href="#directory-organization">Directory Organization</a></li>
|
<li><a class="reference internal" href="#directory-organization">Directory Organization</a></li>
|
||||||
|
<li><a class="reference internal" href="#bundling-ansible-modules-with-playbooks">Bundling Ansible Modules With Playbooks</a></li>
|
||||||
<li><a class="reference internal" href="#miscellaneous-tips">Miscellaneous Tips</a></li>
|
<li><a class="reference internal" href="#miscellaneous-tips">Miscellaneous Tips</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
@ -193,6 +194,7 @@ using the group variable system.</p>
|
||||||
<p>Playbooks should be organized like this:</p>
|
<p>Playbooks should be organized like this:</p>
|
||||||
<div class="highlight-python"><pre>(root of source control repository)
|
<div class="highlight-python"><pre>(root of source control repository)
|
||||||
|
|
||||||
|
global_vars.yml # variables for all playbooks
|
||||||
acme/ # each playbook has a directory
|
acme/ # each playbook has a directory
|
||||||
|
|
||||||
setup.yml # playbook to manage the service
|
setup.yml # playbook to manage the service
|
||||||
|
@ -206,7 +208,7 @@ using the group variable system.</p>
|
||||||
etc_other_conf_other.conf
|
etc_other_conf_other.conf
|
||||||
|
|
||||||
vars/
|
vars/
|
||||||
main.yml
|
main.yml # variables specific to this playbook
|
||||||
|
|
||||||
handlers/
|
handlers/
|
||||||
main.yml
|
main.yml
|
||||||
|
@ -224,6 +226,7 @@ will require <cite>handlers</cite>, <cite>tasks</cite>, and <cite>templates</cit
|
||||||
user: root
|
user: root
|
||||||
|
|
||||||
vars_files
|
vars_files
|
||||||
|
- ../global_vars.yml
|
||||||
- vars/main.yml
|
- vars/main.yml
|
||||||
tasks:
|
tasks:
|
||||||
- include: tasks/setup.yml
|
- include: tasks/setup.yml
|
||||||
|
@ -239,6 +242,11 @@ when things change, and these are described in <a class="reference internal" hre
|
||||||
You don’t have to do this though. It’s fine to select sections of your infrastructure to manage at a single time.
|
You don’t have to do this though. It’s fine to select sections of your infrastructure to manage at a single time.
|
||||||
You may wish to construct simple shell scripts to wrap calls to ansible-playbook.</p>
|
You may wish to construct simple shell scripts to wrap calls to ansible-playbook.</p>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="section" id="bundling-ansible-modules-with-playbooks">
|
||||||
|
<h2>Bundling Ansible Modules With Playbooks<a class="headerlink" href="#bundling-ansible-modules-with-playbooks" title="Permalink to this headline">¶</a></h2>
|
||||||
|
<p>In version 0.5 and later, if a playbook has a ”./library” directory relative to it’s YAML file, this directory can be used to add ansible modules that will automatically be in the ansible module path. This is a great way to keep modules that
|
||||||
|
go with a playbook together.</p>
|
||||||
|
</div>
|
||||||
<div class="section" id="miscellaneous-tips">
|
<div class="section" id="miscellaneous-tips">
|
||||||
<h2>Miscellaneous Tips<a class="headerlink" href="#miscellaneous-tips" title="Permalink to this headline">¶</a></h2>
|
<h2>Miscellaneous Tips<a class="headerlink" href="#miscellaneous-tips" title="Permalink to this headline">¶</a></h2>
|
||||||
<p>When you can do something simply, do something simply. Do not reach to use every feature of Ansible together, all
|
<p>When you can do something simply, do something simply. Do not reach to use every feature of Ansible together, all
|
||||||
|
@ -289,7 +297,7 @@ This way you have an audit trail describing when and why you changed the rules a
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
© Copyright 2012 Michael DeHaan.<br/>
|
© Copyright 2012 Michael DeHaan.<br/>
|
||||||
Last updated on Jun 19, 2012.<br/>
|
Last updated on Jul 04, 2012.<br/>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
|
@ -382,7 +382,7 @@ a simplified syntax for this.</p>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
© Copyright 2012 Michael DeHaan.<br/>
|
© Copyright 2012 Michael DeHaan.<br/>
|
||||||
Last updated on Jun 19, 2012.<br/>
|
Last updated on Jul 04, 2012.<br/>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
18
faq.html
18
faq.html
|
@ -230,8 +230,7 @@ best’, and distills all of the ideas behind all of these other tools to th
|
||||||
<p>Ansible uses SSH by default instead of SSL and custom daemons, and requires
|
<p>Ansible uses SSH by default instead of SSL and custom daemons, and requires
|
||||||
no extra software to run on managed machines. You can also write modules
|
no extra software to run on managed machines. You can also write modules
|
||||||
in any language as long as they return JSON. Ansible’s API, of course, is
|
in any language as long as they return JSON. Ansible’s API, of course, is
|
||||||
heavily inspired by Func. Some features, like delegation hierarchies, are
|
heavily inspired by Func. Ansible also adds
|
||||||
not supported, but Ansible does have an async mode. Ansible also adds
|
|
||||||
a configuration management and multinode orchestration layer (<a class="reference internal" href="playbooks.html"><em>Playbooks</em></a>)
|
a configuration management and multinode orchestration layer (<a class="reference internal" href="playbooks.html"><em>Playbooks</em></a>)
|
||||||
that Func didn’t have.</p>
|
that Func didn’t have.</p>
|
||||||
</div>
|
</div>
|
||||||
|
@ -247,7 +246,7 @@ notification events (like Puppet). This is kind of a ‘best of both worlds
|
||||||
also designed with multi-node deployment in mind from day-one – something that is difficult
|
also designed with multi-node deployment in mind from day-one – something that is difficult
|
||||||
for Puppet because of the pull architecture. Ansible is push based,
|
for Puppet because of the pull architecture. Ansible is push based,
|
||||||
so you can do things in an ordered fashion, addressing batches of servers
|
so you can do things in an ordered fashion, addressing batches of servers
|
||||||
at one time, and you do not have to contend with the DAG. It’s also extensible in any language
|
at one time, and you do not have to contend with the dependency graph. It’s also extensible in any language
|
||||||
and the source is designed so that you don’t have to be an expert programmer to submit a patch.</p>
|
and the source is designed so that you don’t have to be an expert programmer to submit a patch.</p>
|
||||||
<p>Ansible’s resources are heavily inspired by Puppet, with the “state” keyword being a more or less
|
<p>Ansible’s resources are heavily inspired by Puppet, with the “state” keyword being a more or less
|
||||||
direct port of “ensure” from Puppet. Unlike Puppet, Ansible can be extended in any language,
|
direct port of “ensure” from Puppet. Unlike Puppet, Ansible can be extended in any language,
|
||||||
|
@ -324,9 +323,12 @@ to go.</p>
|
||||||
Ansible, it is not consuming any resources, and you don’t have to contend
|
Ansible, it is not consuming any resources, and you don’t have to contend
|
||||||
with a herd of machines all knocking at the door of your management server
|
with a herd of machines all knocking at the door of your management server
|
||||||
all at once.</p>
|
all at once.</p>
|
||||||
|
<p>The SSH connection type (paramiko is the default, binary openssh is an option)
|
||||||
|
can also make use of “ControlMaster” features in SSH, which reuses network
|
||||||
|
connections.</p>
|
||||||
<p>If you have 10,000 systems, running a single ansible playbook against all of
|
<p>If you have 10,000 systems, running a single ansible playbook against all of
|
||||||
them probably isn’t appropriate, which is why ansible-pull exists.</p>
|
them probably isn’t appropriate, which is why ansible-pull exists. This tool
|
||||||
<p>This tool is designed for running out of git and cron, and can scale to any
|
is designed for running out of git and cron, and can scale to any
|
||||||
number of hosts. Ansible-pull uses local connections versus SSH, but can be
|
number of hosts. Ansible-pull uses local connections versus SSH, but can be
|
||||||
easily bootstrapped or reconfigured just using SSH. There is more information
|
easily bootstrapped or reconfigured just using SSH. There is more information
|
||||||
available about this in the <a class="reference internal" href="playbooks2.html"><em>Advanced Playbooks</em></a> section. The self-bootstrapping
|
available about this in the <a class="reference internal" href="playbooks2.html"><em>Advanced Playbooks</em></a> section. The self-bootstrapping
|
||||||
|
@ -336,8 +338,8 @@ model.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="are-transports-other-than-ssh-supported">
|
<div class="section" id="are-transports-other-than-ssh-supported">
|
||||||
<h3>Are transports other than SSH supported?<a class="headerlink" href="#are-transports-other-than-ssh-supported" title="Permalink to this headline">¶</a></h3>
|
<h3>Are transports other than SSH supported?<a class="headerlink" href="#are-transports-other-than-ssh-supported" title="Permalink to this headline">¶</a></h3>
|
||||||
<p>Currently SSH and local connections are supported. In 0.5, we’ll also be including
|
<p>Currently SSH (you can choose between paramiko or the openssh binaries)
|
||||||
a faster SSH transport. The interface is actually pluggable so a
|
and local connections are supported. The interface is actually pluggable so a
|
||||||
small patch could bring transport over message bus or XMPP as an option.</p>
|
small patch could bring transport over message bus or XMPP as an option.</p>
|
||||||
<p>Stop by the mailing list if you have ideas. The connection-specific parts of Ansible
|
<p>Stop by the mailing list if you have ideas. The connection-specific parts of Ansible
|
||||||
are all abstracted away from the core implementation so it is very easy to extend.</p>
|
are all abstracted away from the core implementation so it is very easy to extend.</p>
|
||||||
|
@ -386,7 +388,7 @@ tasks – whether for a QA sytem, build system, or anything you can think of
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
© Copyright 2012 Michael DeHaan.<br/>
|
© Copyright 2012 Michael DeHaan.<br/>
|
||||||
Last updated on Jun 19, 2012.<br/>
|
Last updated on Jul 04, 2012.<br/>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
|
@ -190,7 +190,7 @@ s.parentNode.insertBefore(ga, s);
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
© Copyright 2012 Michael DeHaan.<br/>
|
© Copyright 2012 Michael DeHaan.<br/>
|
||||||
Last updated on Jun 19, 2012.<br/>
|
Last updated on Jul 04, 2012.<br/>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
|
@ -158,6 +158,7 @@ s.parentNode.insertBefore(ga, s);
|
||||||
<li><a class="reference internal" href="#tagged-releases">Tagged Releases</a></li>
|
<li><a class="reference internal" href="#tagged-releases">Tagged Releases</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
<li><a class="reference internal" href="#choosing-between-paramiko-and-native-ssh">Choosing Between Paramiko and Native SSH</a></li>
|
||||||
<li><a class="reference internal" href="#your-first-commands">Your first commands</a></li>
|
<li><a class="reference internal" href="#your-first-commands">Your first commands</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
@ -205,7 +206,7 @@ also need:</p>
|
||||||
<ul class="simple">
|
<ul class="simple">
|
||||||
<li><tt class="docutils literal"><span class="pre">python-simplejson</span></tt></li>
|
<li><tt class="docutils literal"><span class="pre">python-simplejson</span></tt></li>
|
||||||
</ul>
|
</ul>
|
||||||
<p>NOTE: Ansible 0.4 will have ways to remote bootstrap this, using Ansible itself. Stay tuned.</p>
|
<p>(Note that even that’s not quite true. Ansible’s “raw” module (for executing commands in a quick and dirty way) and the copy module – some of the most basic features in ansible don’t even need that. So technically, you can use Ansible to install python-simplejson using the raw module, which then allows you to use everything else. That’s jumping ahead though.)</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="python-2-6-epel-instructions-for-rhel-and-centos-5">
|
<div class="section" id="python-2-6-epel-instructions-for-rhel-and-centos-5">
|
||||||
<h2>Python 2.6 EPEL instructions for RHEL and CentOS 5<a class="headerlink" href="#python-2-6-epel-instructions-for-rhel-and-centos-5" title="Permalink to this headline">¶</a></h2>
|
<h2>Python 2.6 EPEL instructions for RHEL and CentOS 5<a class="headerlink" href="#python-2-6-epel-instructions-for-rhel-and-centos-5" title="Permalink to this headline">¶</a></h2>
|
||||||
|
@ -293,6 +294,21 @@ project page:</p>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="section" id="choosing-between-paramiko-and-native-ssh">
|
||||||
|
<h2>Choosing Between Paramiko and Native SSH<a class="headerlink" href="#choosing-between-paramiko-and-native-ssh" title="Permalink to this headline">¶</a></h2>
|
||||||
|
<p>By default, ansible uses paramiko to talk to managed nodes over SSH. Paramiko is fast, works
|
||||||
|
very transparently, requires no configuration, and is a good choice for most users.
|
||||||
|
However, it does not support some advanced SSH features that folks will want to use.</p>
|
||||||
|
<p>Starting in version 0.5, if you want to leverage more advanced SSH features (such as Kerberized SSH or jump hosts),
|
||||||
|
pass the flag “–connection=ssh” to any ansible command, or set the
|
||||||
|
ANSIBLE_TRANSPORT environment variable to ‘ssh’. This will cause Ansible to use openssh
|
||||||
|
tools instead.</p>
|
||||||
|
<p>If ANSIBLE_SSH_ARGS are not set, ansible will try to use some sensible ControlMaster options
|
||||||
|
by default. You are free to override this environment variable, but should still pass ControlMaster
|
||||||
|
options to ensure performance of this transport. With ControlMaster in use, both transports
|
||||||
|
are roughly the same speed. Without CM, the binary ssh transport is signficantly slower.</p>
|
||||||
|
<p>If none of this makes sense to you, the default paramiko option is probably fine.</p>
|
||||||
|
</div>
|
||||||
<div class="section" id="your-first-commands">
|
<div class="section" id="your-first-commands">
|
||||||
<h2>Your first commands<a class="headerlink" href="#your-first-commands" title="Permalink to this headline">¶</a></h2>
|
<h2>Your first commands<a class="headerlink" href="#your-first-commands" title="Permalink to this headline">¶</a></h2>
|
||||||
<p>Now that you’ve installed Ansible, it’s time to test it.</p>
|
<p>Now that you’ve installed Ansible, it’s time to test it.</p>
|
||||||
|
@ -306,9 +322,21 @@ bserver.example.org</pre>
|
||||||
<div class="highlight-python"><pre>ssh-agent bash
|
<div class="highlight-python"><pre>ssh-agent bash
|
||||||
ssh-add ~/.ssh/id_rsa</pre>
|
ssh-add ~/.ssh/id_rsa</pre>
|
||||||
</div>
|
</div>
|
||||||
|
<p>(Depending on your setup, you may wish to ansible’s –private-key-file option to specify a pem file instead)</p>
|
||||||
<p>Now ping all your nodes:</p>
|
<p>Now ping all your nodes:</p>
|
||||||
<div class="highlight-python"><pre>ansible all -m ping</pre>
|
<div class="highlight-python"><pre>ansible all -m ping</pre>
|
||||||
</div>
|
</div>
|
||||||
|
<p>If you want to access machines remotely as a different user than root, you will want to
|
||||||
|
specify the ‘-u’ option to ansible. If you would like to access sudo mode, there are also flags to do that:</p>
|
||||||
|
<div class="highlight-python"><pre># as bruce
|
||||||
|
ansible all -m ping -u bruce
|
||||||
|
|
||||||
|
# as bruce, sudoing to root
|
||||||
|
ansible all -m ping -u bruce --sudo
|
||||||
|
|
||||||
|
# as bruce, sudoing to batman
|
||||||
|
ansible all -m ping -u bruce --sudo --sudo-user batman</pre>
|
||||||
|
</div>
|
||||||
<p>Now run a live command on all of your nodes:</p>
|
<p>Now run a live command on all of your nodes:</p>
|
||||||
<div class="highlight-python"><pre>ansible all -a "/bin/echo hello"</pre>
|
<div class="highlight-python"><pre>ansible all -a "/bin/echo hello"</pre>
|
||||||
</div>
|
</div>
|
||||||
|
@ -349,7 +377,7 @@ explore, but you already have a fully working infrastructure!</p>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
© Copyright 2012 Michael DeHaan.<br/>
|
© Copyright 2012 Michael DeHaan.<br/>
|
||||||
Last updated on Jun 19, 2012.<br/>
|
Last updated on Jul 04, 2012.<br/>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
12
index.html
12
index.html
|
@ -190,7 +190,7 @@ and command execution framework. Other tools in this space have been too
|
||||||
complicated for too long, require too much bootstrapping, and have too
|
complicated for too long, require too much bootstrapping, and have too
|
||||||
much learning curve. Ansible is dead simple and painless to extend.
|
much learning curve. Ansible is dead simple and painless to extend.
|
||||||
For comparison, Puppet and Chef have about 60k lines of code.
|
For comparison, Puppet and Chef have about 60k lines of code.
|
||||||
Ansible’s core is a little over 1000 lines.</p>
|
Ansible’s core is a little over 2000 lines..</p>
|
||||||
<p>Ansible isn’t just for idempotent configuration – it’s also great for ad-hoc
|
<p>Ansible isn’t just for idempotent configuration – it’s also great for ad-hoc
|
||||||
tasks, quickly firing off commands against nodes. See <a class="reference internal" href="examples.html"><em>Command Line</em></a>.</p>
|
tasks, quickly firing off commands against nodes. See <a class="reference internal" href="examples.html"><em>Command Line</em></a>.</p>
|
||||||
</div>
|
</div>
|
||||||
|
@ -237,6 +237,7 @@ hosts.</p>
|
||||||
<li>Dead simple setup</li>
|
<li>Dead simple setup</li>
|
||||||
<li>Super fast & parallel by default</li>
|
<li>Super fast & parallel by default</li>
|
||||||
<li>No server or client daemons; use existing SSHd out of the box</li>
|
<li>No server or client daemons; use existing SSHd out of the box</li>
|
||||||
|
<li>Supports Kerberized SSH, jump hosts, forwarding, etc</li>
|
||||||
<li>No additional software required on client boxes</li>
|
<li>No additional software required on client boxes</li>
|
||||||
<li>Can be easily run from a checkout, no installation required</li>
|
<li>Can be easily run from a checkout, no installation required</li>
|
||||||
<li>Modules are idempotent, but you can also easily use shell commands</li>
|
<li>Modules are idempotent, but you can also easily use shell commands</li>
|
||||||
|
@ -290,6 +291,7 @@ Email: <input type=text name=email> <input type=submit name="sub" val
|
||||||
<li class="toctree-l3"><a class="reference internal" href="gettingstarted.html#tagged-releases">Tagged Releases</a></li>
|
<li class="toctree-l3"><a class="reference internal" href="gettingstarted.html#tagged-releases">Tagged Releases</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="gettingstarted.html#choosing-between-paramiko-and-native-ssh">Choosing Between Paramiko and Native SSH</a></li>
|
||||||
<li class="toctree-l2"><a class="reference internal" href="gettingstarted.html#your-first-commands">Your first commands</a></li>
|
<li class="toctree-l2"><a class="reference internal" href="gettingstarted.html#your-first-commands">Your first commands</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
@ -314,6 +316,8 @@ Email: <input type=text name=email> <input type=submit name="sub" val
|
||||||
</li>
|
</li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="modules.html">Ansible Modules</a><ul>
|
<li class="toctree-l1"><a class="reference internal" href="modules.html">Ansible Modules</a><ul>
|
||||||
<li class="toctree-l2"><a class="reference internal" href="modules.html#apt">apt</a></li>
|
<li class="toctree-l2"><a class="reference internal" href="modules.html#apt">apt</a></li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="modules.html#assemble">assemble</a></li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="modules.html#authorized-key">authorized_key</a></li>
|
||||||
<li class="toctree-l2"><a class="reference internal" href="modules.html#command">command</a></li>
|
<li class="toctree-l2"><a class="reference internal" href="modules.html#command">command</a></li>
|
||||||
<li class="toctree-l2"><a class="reference internal" href="modules.html#copy">copy</a></li>
|
<li class="toctree-l2"><a class="reference internal" href="modules.html#copy">copy</a></li>
|
||||||
<li class="toctree-l2"><a class="reference internal" href="modules.html#facter">facter</a></li>
|
<li class="toctree-l2"><a class="reference internal" href="modules.html#facter">facter</a></li>
|
||||||
|
@ -324,7 +328,7 @@ Email: <input type=text name=email> <input type=submit name="sub" val
|
||||||
<li class="toctree-l2"><a class="reference internal" href="modules.html#ohai">ohai</a></li>
|
<li class="toctree-l2"><a class="reference internal" href="modules.html#ohai">ohai</a></li>
|
||||||
<li class="toctree-l2"><a class="reference internal" href="modules.html#ping">ping</a></li>
|
<li class="toctree-l2"><a class="reference internal" href="modules.html#ping">ping</a></li>
|
||||||
<li class="toctree-l2"><a class="reference internal" href="modules.html#raw">raw</a></li>
|
<li class="toctree-l2"><a class="reference internal" href="modules.html#raw">raw</a></li>
|
||||||
<li class="toctree-l2"><a class="reference internal" href="modules.html#id9">service</a></li>
|
<li class="toctree-l2"><a class="reference internal" href="modules.html#id11">service</a></li>
|
||||||
<li class="toctree-l2"><a class="reference internal" href="modules.html#setup">setup</a></li>
|
<li class="toctree-l2"><a class="reference internal" href="modules.html#setup">setup</a></li>
|
||||||
<li class="toctree-l2"><a class="reference internal" href="modules.html#shell">shell</a></li>
|
<li class="toctree-l2"><a class="reference internal" href="modules.html#shell">shell</a></li>
|
||||||
<li class="toctree-l2"><a class="reference internal" href="modules.html#template">template</a></li>
|
<li class="toctree-l2"><a class="reference internal" href="modules.html#template">template</a></li>
|
||||||
|
@ -349,6 +353,7 @@ Email: <input type=text name=email> <input type=submit name="sub" val
|
||||||
<li class="toctree-l2"><a class="reference internal" href="playbooks.html#running-operations-on-change">Running Operations On Change</a></li>
|
<li class="toctree-l2"><a class="reference internal" href="playbooks.html#running-operations-on-change">Running Operations On Change</a></li>
|
||||||
<li class="toctree-l2"><a class="reference internal" href="playbooks.html#include-files-and-reuse">Include Files And Reuse</a></li>
|
<li class="toctree-l2"><a class="reference internal" href="playbooks.html#include-files-and-reuse">Include Files And Reuse</a></li>
|
||||||
<li class="toctree-l2"><a class="reference internal" href="playbooks.html#executing-a-playbook">Executing A Playbook</a></li>
|
<li class="toctree-l2"><a class="reference internal" href="playbooks.html#executing-a-playbook">Executing A Playbook</a></li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="playbooks.html#tips-and-tricks">Tips and Tricks</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="playbooks2.html">Advanced Playbooks</a><ul>
|
<li class="toctree-l1"><a class="reference internal" href="playbooks2.html">Advanced Playbooks</a><ul>
|
||||||
|
@ -370,6 +375,7 @@ Email: <input type=text name=email> <input type=submit name="sub" val
|
||||||
<li class="toctree-l1"><a class="reference internal" href="bestpractices.html">Best Practices</a><ul>
|
<li class="toctree-l1"><a class="reference internal" href="bestpractices.html">Best Practices</a><ul>
|
||||||
<li class="toctree-l2"><a class="reference internal" href="bestpractices.html#group-by-roles">Group By Roles</a></li>
|
<li class="toctree-l2"><a class="reference internal" href="bestpractices.html#group-by-roles">Group By Roles</a></li>
|
||||||
<li class="toctree-l2"><a class="reference internal" href="bestpractices.html#directory-organization">Directory Organization</a></li>
|
<li class="toctree-l2"><a class="reference internal" href="bestpractices.html#directory-organization">Directory Organization</a></li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="bestpractices.html#bundling-ansible-modules-with-playbooks">Bundling Ansible Modules With Playbooks</a></li>
|
||||||
<li class="toctree-l2"><a class="reference internal" href="bestpractices.html#miscellaneous-tips">Miscellaneous Tips</a></li>
|
<li class="toctree-l2"><a class="reference internal" href="bestpractices.html#miscellaneous-tips">Miscellaneous Tips</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
@ -447,7 +453,7 @@ Puppet Labs, and is now with <a class="reference external" href="http://rpath.co
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
© Copyright 2012 Michael DeHaan.<br/>
|
© Copyright 2012 Michael DeHaan.<br/>
|
||||||
Last updated on Jun 19, 2012.<br/>
|
Last updated on Jul 04, 2012.<br/>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
|
@ -455,7 +455,7 @@ Stop by the mailing list to inquire about requirements.</p>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
© Copyright 2012 Michael DeHaan.<br/>
|
© Copyright 2012 Michael DeHaan.<br/>
|
||||||
Last updated on Jun 19, 2012.<br/>
|
Last updated on Jul 04, 2012.<br/>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
78
modules.html
78
modules.html
|
@ -149,6 +149,8 @@ s.parentNode.insertBefore(ga, s);
|
||||||
<span class="localtoc"><ul>
|
<span class="localtoc"><ul>
|
||||||
<li><a class="reference internal" href="#">Ansible Modules</a><ul>
|
<li><a class="reference internal" href="#">Ansible Modules</a><ul>
|
||||||
<li><a class="reference internal" href="#apt">apt</a></li>
|
<li><a class="reference internal" href="#apt">apt</a></li>
|
||||||
|
<li><a class="reference internal" href="#assemble">assemble</a></li>
|
||||||
|
<li><a class="reference internal" href="#authorized-key">authorized_key</a></li>
|
||||||
<li><a class="reference internal" href="#command">command</a></li>
|
<li><a class="reference internal" href="#command">command</a></li>
|
||||||
<li><a class="reference internal" href="#copy">copy</a></li>
|
<li><a class="reference internal" href="#copy">copy</a></li>
|
||||||
<li><a class="reference internal" href="#facter">facter</a></li>
|
<li><a class="reference internal" href="#facter">facter</a></li>
|
||||||
|
@ -159,7 +161,7 @@ s.parentNode.insertBefore(ga, s);
|
||||||
<li><a class="reference internal" href="#ohai">ohai</a></li>
|
<li><a class="reference internal" href="#ohai">ohai</a></li>
|
||||||
<li><a class="reference internal" href="#ping">ping</a></li>
|
<li><a class="reference internal" href="#ping">ping</a></li>
|
||||||
<li><a class="reference internal" href="#raw">raw</a></li>
|
<li><a class="reference internal" href="#raw">raw</a></li>
|
||||||
<li><a class="reference internal" href="#id9">service</a></li>
|
<li><a class="reference internal" href="#id11">service</a></li>
|
||||||
<li><a class="reference internal" href="#setup">setup</a></li>
|
<li><a class="reference internal" href="#setup">setup</a></li>
|
||||||
<li><a class="reference internal" href="#shell">shell</a></li>
|
<li><a class="reference internal" href="#shell">shell</a></li>
|
||||||
<li><a class="reference internal" href="#template">template</a></li>
|
<li><a class="reference internal" href="#template">template</a></li>
|
||||||
|
@ -257,8 +259,46 @@ apt pkg=foo=1.00 state=installed
|
||||||
apt pkg=nginx state=latest default-release=squeeze-backports update-cache=yes</pre>
|
apt pkg=nginx state=latest default-release=squeeze-backports update-cache=yes</pre>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="section" id="assemble">
|
||||||
|
<span id="id2"></span><h2>assemble<a class="headerlink" href="#assemble" title="Permalink to this headline">¶</a></h2>
|
||||||
|
<p>(new in 0.5) Assembles a configuration file from fragments. Often a particular program will take a single configuration file
|
||||||
|
and does not support a conf.d style structure where it is easy to build up the configuration from multiple sources.
|
||||||
|
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
|
||||||
|
“fragments”.</p>
|
||||||
|
<p><em>src</em>:</p>
|
||||||
|
<ul class="simple">
|
||||||
|
<li>An already existing directory full of source files.</li>
|
||||||
|
</ul>
|
||||||
|
<p><em>dest</em>:</p>
|
||||||
|
<ul class="simple">
|
||||||
|
<li>A file to create using the concatenation of all of the source files.</li>
|
||||||
|
</ul>
|
||||||
|
<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>
|
||||||
|
</div>
|
||||||
|
<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>
|
||||||
|
<p>(new in 0.5). Adds or removes an authorized key for a user from a remote host.</p>
|
||||||
|
<p><em>user</em>:</p>
|
||||||
|
<ul class="simple">
|
||||||
|
<li>Name of the user who access is being granted or remoted to.</li>
|
||||||
|
</ul>
|
||||||
|
<p><em>state</em>:</p>
|
||||||
|
<ul class="simple">
|
||||||
|
<li>Either ‘absent’ or ‘present’, this is whether the given key should be in the authorized keys file or not.</li>
|
||||||
|
</ul>
|
||||||
|
<p><em>key</em>:</p>
|
||||||
|
<ul class="simple">
|
||||||
|
<li>The actual key, as a string.</li>
|
||||||
|
</ul>
|
||||||
|
<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>
|
||||||
|
</div>
|
||||||
<div class="section" id="command">
|
<div class="section" id="command">
|
||||||
<span id="id2"></span><h2>command<a class="headerlink" href="#command" title="Permalink to this headline">¶</a></h2>
|
<span id="id4"></span><h2>command<a class="headerlink" href="#command" title="Permalink to this headline">¶</a></h2>
|
||||||
<p>The command module takes the command name followed by a list of
|
<p>The command module takes the command name followed by a list of
|
||||||
arguments, space delimited.</p>
|
arguments, space delimited.</p>
|
||||||
<p>If you want to run a command through the shell (say you are using
|
<p>If you want to run a command through the shell (say you are using
|
||||||
|
@ -281,7 +321,7 @@ following:</p>
|
||||||
<p>The <cite>creates=</cite> option will not be passed to the executable.</p>
|
<p>The <cite>creates=</cite> option will not be passed to the executable.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="copy">
|
<div class="section" id="copy">
|
||||||
<span id="id3"></span><h2>copy<a class="headerlink" href="#copy" title="Permalink to this headline">¶</a></h2>
|
<span id="id5"></span><h2>copy<a class="headerlink" href="#copy" title="Permalink to this headline">¶</a></h2>
|
||||||
<p>The copy module moves a file on the local box to remote locations. 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>
|
||||||
|
@ -300,7 +340,7 @@ absolute or relative path.</li>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="facter">
|
<div class="section" id="facter">
|
||||||
<span id="id4"></span><h2>facter<a class="headerlink" href="#facter" title="Permalink to this headline">¶</a></h2>
|
<span id="id6"></span><h2>facter<a class="headerlink" href="#facter" title="Permalink to this headline">¶</a></h2>
|
||||||
<p>Runs the discovery program ‘facter’ on the remote system, returning
|
<p>Runs the discovery program ‘facter’ on the remote system, returning
|
||||||
JSON data that can be useful for inventory purposes.</p>
|
JSON data that can be useful for inventory purposes.</p>
|
||||||
<p>Requires that ‘facter’ and ‘ruby-json’ be installed on the remote end.</p>
|
<p>Requires that ‘facter’ and ‘ruby-json’ be installed on the remote end.</p>
|
||||||
|
@ -387,7 +427,7 @@ file path=/some/path state=directory context=default</pre>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="git">
|
<div class="section" id="git">
|
||||||
<span id="id5"></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>
|
<p><em>repo</em>:</p>
|
||||||
<ul class="simple">
|
<ul class="simple">
|
||||||
|
@ -411,7 +451,7 @@ file path=/some/path state=directory context=default</pre>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="group">
|
<div class="section" id="group">
|
||||||
<span id="id6"></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>
|
<p><em>name</em>:</p>
|
||||||
<ul class="simple">
|
<ul class="simple">
|
||||||
|
@ -435,7 +475,7 @@ file path=/some/path state=directory context=default</pre>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="ohai">
|
<div class="section" id="ohai">
|
||||||
<span id="id7"></span><h2>ohai<a class="headerlink" href="#ohai" title="Permalink to this headline">¶</a></h2>
|
<span id="id9"></span><h2>ohai<a class="headerlink" href="#ohai" title="Permalink to this headline">¶</a></h2>
|
||||||
<p>Similar to the <a class="reference internal" href="#facter"><em>facter</em></a> module, this returns JSON inventory data.
|
<p>Similar to the <a class="reference internal" href="#facter"><em>facter</em></a> module, this returns JSON inventory data.
|
||||||
Ohai data is a bit more verbose and nested than facter.</p>
|
Ohai data is a bit more verbose and nested than facter.</p>
|
||||||
<p>Requires that ‘ohai’ be installed on the remote end.</p>
|
<p>Requires that ‘ohai’ be installed on the remote end.</p>
|
||||||
|
@ -445,7 +485,7 @@ support change hooks, nor does it make any changes on the system.</p>
|
||||||
<a class="reference internal" href="#setup"><em>setup</em></a> module behind the scenes instead.</p>
|
<a class="reference internal" href="#setup"><em>setup</em></a> module behind the scenes instead.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="ping">
|
<div class="section" id="ping">
|
||||||
<span id="id8"></span><h2>ping<a class="headerlink" href="#ping" title="Permalink to this headline">¶</a></h2>
|
<span id="id10"></span><h2>ping<a class="headerlink" href="#ping" title="Permalink to this headline">¶</a></h2>
|
||||||
<p>A trivial test module, this module always returns the integer <tt class="docutils literal"><span class="pre">1</span></tt> on
|
<p>A trivial test module, this module always returns the integer <tt class="docutils literal"><span class="pre">1</span></tt> on
|
||||||
successful contact.</p>
|
successful contact.</p>
|
||||||
<p>This module does not support change hooks and is informative only - it
|
<p>This module does not support change hooks and is informative only - it
|
||||||
|
@ -468,8 +508,8 @@ for this module.</p>
|
||||||
<div class="highlight-python"><pre>ansible newhost.example.com raw -a "yum install python-simplejson"</pre>
|
<div class="highlight-python"><pre>ansible newhost.example.com raw -a "yum install python-simplejson"</pre>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="id9">
|
<div class="section" id="id11">
|
||||||
<h2>service<a class="headerlink" href="#id9" 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>
|
<p><em>state</em>:</p>
|
||||||
<ul class="simple">
|
<ul class="simple">
|
||||||
|
@ -499,7 +539,7 @@ service name=httpd state=reloaded</pre>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="setup">
|
<div class="section" id="setup">
|
||||||
<span id="id10"></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>Writes a JSON file containing key/value data, for use in templating.
|
||||||
Call this once before using the <a class="reference internal" href="#template"><em>template</em></a> module. Playbooks
|
Call this once before using the <a class="reference internal" href="#template"><em>template</em></a> module. Playbooks
|
||||||
will execute this module automatically as the first step in each play
|
will execute this module automatically as the first step in each play
|
||||||
|
@ -592,7 +632,7 @@ on your remote systems.</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="shell">
|
<div class="section" id="shell">
|
||||||
<span id="id11"></span><h2>shell<a class="headerlink" href="#shell" title="Permalink to this headline">¶</a></h2>
|
<span id="id13"></span><h2>shell<a class="headerlink" href="#shell" title="Permalink to this headline">¶</a></h2>
|
||||||
<p>The shell module takes the command name followed by a list of
|
<p>The shell module takes the command name followed by a list of
|
||||||
arguments, space delimited. It is almost exactly like the command module
|
arguments, space delimited. It is almost exactly like the command module
|
||||||
but runs the command through the user’s configured shell on the remote node.</p>
|
but runs the command through the user’s configured shell on the remote node.</p>
|
||||||
|
@ -610,7 +650,7 @@ command was running.</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="template">
|
<div class="section" id="template">
|
||||||
<span id="id12"></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. Call the <a class="reference internal" href="#setup"><em>setup</em></a> module
|
||||||
prior to usage if you are not running from a playbook. In addition to the options
|
prior to usage if you are not running from a playbook. In addition to the options
|
||||||
listed below, the arguments available to the <cite>file</cite> and <cite>copy</cite> modules can also be passed
|
listed below, the arguments available to the <cite>file</cite> and <cite>copy</cite> modules can also be passed
|
||||||
|
@ -630,7 +670,7 @@ be a relative or absolute path.</li>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="user">
|
<div class="section" id="user">
|
||||||
<span id="id13"></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>
|
<p><em>name</em>:</p>
|
||||||
<ul class="simple">
|
<ul class="simple">
|
||||||
|
@ -664,6 +704,10 @@ be a relative or absolute path.</li>
|
||||||
<ul class="simple">
|
<ul class="simple">
|
||||||
<li>Whether to create the user’s home directory. Takes ‘yes’, or ‘no’. The default is ‘yes’.</li>
|
<li>Whether to create the user’s home directory. Takes ‘yes’, or ‘no’. The default is ‘yes’.</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
<p><em>home=</em>:</p>
|
||||||
|
<ul class="simple">
|
||||||
|
<li>Specifies where the user’s home directory should be, if not in /home/$username.</li>
|
||||||
|
</ul>
|
||||||
<p><em>password</em>:</p>
|
<p><em>password</em>:</p>
|
||||||
<ul class="simple">
|
<ul class="simple">
|
||||||
<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>
|
<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>
|
||||||
|
@ -691,7 +735,7 @@ user name=mdehaan state=absent force=yes</pre>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="virt">
|
<div class="section" id="virt">
|
||||||
<span id="id14"></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>
|
<p><em>guest</em>:</p>
|
||||||
|
@ -728,7 +772,7 @@ ansible host -m virt -a "command=virttype"</pre>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="yum">
|
<div class="section" id="yum">
|
||||||
<span id="id15"></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>
|
<p><em>pkg</em>:</p>
|
||||||
<ul class="simple">
|
<ul class="simple">
|
||||||
|
@ -789,7 +833,7 @@ yum pkg=httpd state=installed</pre>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
© Copyright 2012 Michael DeHaan.<br/>
|
© Copyright 2012 Michael DeHaan.<br/>
|
||||||
Last updated on Jun 19, 2012.<br/>
|
Last updated on Jul 04, 2012.<br/>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
|
@ -234,6 +234,9 @@ with the aforementioned bracket headers in the inventory file:</p>
|
||||||
<div class="highlight-python"><pre>webservers
|
<div class="highlight-python"><pre>webservers
|
||||||
webservers:dbservers</pre>
|
webservers:dbservers</pre>
|
||||||
</div>
|
</div>
|
||||||
|
<p>In 0.5 and later, you can exclude groups as well, for instance, all webservers not in Phoenix:</p>
|
||||||
|
<div class="highlight-python"><pre>webservers:!phoenix</pre>
|
||||||
|
</div>
|
||||||
<p>Individual host names (or IPs), but not groups, can also be referenced using
|
<p>Individual host names (or IPs), but not groups, can also be referenced using
|
||||||
wildcards:</p>
|
wildcards:</p>
|
||||||
<div class="highlight-python"><pre>*.example.com
|
<div class="highlight-python"><pre>*.example.com
|
||||||
|
@ -246,8 +249,7 @@ wildcards:</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="host-variables">
|
<div class="section" id="host-variables">
|
||||||
<h2>Host Variables<a class="headerlink" href="#host-variables" title="Permalink to this headline">¶</a></h2>
|
<h2>Host Variables<a class="headerlink" href="#host-variables" title="Permalink to this headline">¶</a></h2>
|
||||||
<p>Using the 0.4 branch of Ansible, it is easy to assign variables to hosts that will be used
|
<p>It is easy to assign variables to hosts that will be used later in playbooks:</p>
|
||||||
later in playbooks:</p>
|
|
||||||
<div class="highlight-python"><pre>[atlanta]
|
<div class="highlight-python"><pre>[atlanta]
|
||||||
host1 http_port=80 maxRequestsPerChild=808
|
host1 http_port=80 maxRequestsPerChild=808
|
||||||
host2 http_port=303 maxRequestsPerChild=909</pre>
|
host2 http_port=303 maxRequestsPerChild=909</pre>
|
||||||
|
@ -255,7 +257,7 @@ host2 http_port=303 maxRequestsPerChild=909</pre>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="group-variables">
|
<div class="section" id="group-variables">
|
||||||
<h2>Group Variables<a class="headerlink" href="#group-variables" title="Permalink to this headline">¶</a></h2>
|
<h2>Group Variables<a class="headerlink" href="#group-variables" title="Permalink to this headline">¶</a></h2>
|
||||||
<p>Using the 0.4 branch of Ansible, variables can also be applied to an entire group at once:</p>
|
<p>Variables can also be applied to an entire group at once:</p>
|
||||||
<div class="highlight-python"><pre>[atlanta]
|
<div class="highlight-python"><pre>[atlanta]
|
||||||
host1
|
host1
|
||||||
host2
|
host2
|
||||||
|
@ -297,7 +299,7 @@ southeast</pre>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="yaml-inventory-format">
|
<div class="section" id="yaml-inventory-format">
|
||||||
<h2>YAML Inventory Format<a class="headerlink" href="#yaml-inventory-format" title="Permalink to this headline">¶</a></h2>
|
<h2>YAML Inventory Format<a class="headerlink" href="#yaml-inventory-format" title="Permalink to this headline">¶</a></h2>
|
||||||
<p>For people using 0.3, or those that prefer to use it, the inventory file can also be expressed in
|
<p>For that prefer to use it, the inventory file can also be expressed in
|
||||||
YAML:</p>
|
YAML:</p>
|
||||||
<div class="highlight-python"><pre>---
|
<div class="highlight-python"><pre>---
|
||||||
|
|
||||||
|
@ -334,6 +336,8 @@ YAML:</p>
|
||||||
vars:
|
vars:
|
||||||
- asdf: 1234</pre>
|
- asdf: 1234</pre>
|
||||||
</div>
|
</div>
|
||||||
|
<p>Tip: If you ever have two python interpreters on a system, set a variable called ‘ansible_python_interpreter’ to
|
||||||
|
the Python interpreter path you would like to use. (This is available in version 0.5 and later)</p>
|
||||||
<p>Tip: Be sure to start your YAML file with the YAML record designator <tt class="docutils literal"><span class="pre">---</span></tt>.</p>
|
<p>Tip: Be sure to start your YAML file with the YAML record designator <tt class="docutils literal"><span class="pre">---</span></tt>.</p>
|
||||||
<div class="admonition-see-also admonition seealso">
|
<div class="admonition-see-also admonition seealso">
|
||||||
<p class="first admonition-title">See also</p>
|
<p class="first admonition-title">See also</p>
|
||||||
|
@ -366,7 +370,7 @@ YAML:</p>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
© Copyright 2012 Michael DeHaan.<br/>
|
© Copyright 2012 Michael DeHaan.<br/>
|
||||||
Last updated on Jun 19, 2012.<br/>
|
Last updated on Jul 04, 2012.<br/>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
|
@ -158,6 +158,7 @@ s.parentNode.insertBefore(ga, s);
|
||||||
<li><a class="reference internal" href="#running-operations-on-change">Running Operations On Change</a></li>
|
<li><a class="reference internal" href="#running-operations-on-change">Running Operations On Change</a></li>
|
||||||
<li><a class="reference internal" href="#include-files-and-reuse">Include Files And Reuse</a></li>
|
<li><a class="reference internal" href="#include-files-and-reuse">Include Files And Reuse</a></li>
|
||||||
<li><a class="reference internal" href="#executing-a-playbook">Executing A Playbook</a></li>
|
<li><a class="reference internal" href="#executing-a-playbook">Executing A Playbook</a></li>
|
||||||
|
<li><a class="reference internal" href="#tips-and-tricks">Tips and Tricks</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -271,7 +272,7 @@ Just <cite>Control-C</cite> to kill it and run it again with <cite>-K</cite>.</p
|
||||||
<div class="highlight-python"><pre>$varname or ${varname}</pre>
|
<div class="highlight-python"><pre>$varname or ${varname}</pre>
|
||||||
</div>
|
</div>
|
||||||
<p>The later is useful in the event you need to do something like ${other}_concatenated_value.</p>
|
<p>The later is useful in the event you need to do something like ${other}_concatenated_value.</p>
|
||||||
<p>In templates, the full power of the Jinja2 templating language is also available, which looks like this:</p>
|
<p>The full power of the Jinja2 templating language is also available (note: in 0.4, this is only true inside of templates), which looks like this:</p>
|
||||||
<div class="highlight-python"><pre>{{ varname }}</pre>
|
<div class="highlight-python"><pre>{{ varname }}</pre>
|
||||||
</div>
|
</div>
|
||||||
<p>The Jinja2 documentation provides information about how to construct loops and conditionals for those
|
<p>The Jinja2 documentation provides information about how to construct loops and conditionals for those
|
||||||
|
@ -431,6 +432,16 @@ restructure your playbook to be more class/role oriented.</p>
|
||||||
Let’s run a playbook using a parallelism level of 10:</p>
|
Let’s run a playbook using a parallelism level of 10:</p>
|
||||||
<div class="highlight-python"><pre>ansible-playbook playbook.yml -f 10</pre>
|
<div class="highlight-python"><pre>ansible-playbook playbook.yml -f 10</pre>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="section" id="tips-and-tricks">
|
||||||
|
<h2>Tips and Tricks<a class="headerlink" href="#tips-and-tricks" title="Permalink to this headline">¶</a></h2>
|
||||||
|
<p>Look at the bottom of the playbook execution for a summary of the nodes that were executed
|
||||||
|
and how they performed. General failures and fatal “unreachable” communication attempts are
|
||||||
|
kept seperate in the counts.</p>
|
||||||
|
<p>If you ever want to see detailed output from successful modules as well as unsuccessful ones,
|
||||||
|
use the ‘–verbose’ flag. This is available in Ansible 0.5 and later.</p>
|
||||||
|
<p>Also, in version 0.5 and later, Ansible playbook output is vastly upgraded if the cowsay
|
||||||
|
package is installed. Try it!</p>
|
||||||
<div class="admonition-see-also admonition seealso">
|
<div class="admonition-see-also admonition seealso">
|
||||||
<p class="first admonition-title">See also</p>
|
<p class="first admonition-title">See also</p>
|
||||||
<dl class="last docutils">
|
<dl class="last docutils">
|
||||||
|
@ -472,7 +483,7 @@ Let’s run a playbook using a parallelism level of 10:</p>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
© Copyright 2012 Michael DeHaan.<br/>
|
© Copyright 2012 Michael DeHaan.<br/>
|
||||||
Last updated on Jun 19, 2012.<br/>
|
Last updated on Jul 04, 2012.<br/>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
|
@ -222,13 +222,20 @@ want to reference data from must be included in either the current play or any p
|
||||||
<div class="section" id="magic-variables">
|
<div class="section" id="magic-variables">
|
||||||
<h2>Magic Variables<a class="headerlink" href="#magic-variables" title="Permalink to this headline">¶</a></h2>
|
<h2>Magic Variables<a class="headerlink" href="#magic-variables" title="Permalink to this headline">¶</a></h2>
|
||||||
<p>Some variables made available to hosts don’t come from definitions in a playbook, the inventory file, or discovery from the system. There are only two of these, and are used in special cases that many users won’t need.</p>
|
<p>Some variables made available to hosts don’t come from definitions in a playbook, the inventory file, or discovery from the system. There are only two of these, and are used in special cases that many users won’t need.</p>
|
||||||
<p><cite>groups</cite> is a list (array) of all the groups the current host is in. This can be used in templates using Jinja2
|
<p><em>group_names</em> is a list (array) of all the groups the current host is in. This can be used in templates using Jinja2
|
||||||
syntax to make template source files that vary based on the group membership (or role) of the host:</p>
|
syntax to make template source files that vary based on the group membership (or role) of the host:</p>
|
||||||
<div class="highlight-python"><pre>{% if 'webserver' in groups %}
|
<div class="highlight-python"><pre>{% if 'webserver' in group_names %}
|
||||||
# some part of a configuration file that only applies to webservers
|
# some part of a configuration file that only applies to webservers
|
||||||
{% endif %}</pre>
|
{% endif %}</pre>
|
||||||
</div>
|
</div>
|
||||||
<p><cite>inventory_hostname</cite> is the name of the hostname as configured in Ansible’s inventory host file. This can
|
<p><em>groups</em> is a list of all the groups (and hosts) in the inventory. This can be used to enumerate all hosts within a group.
|
||||||
|
For example:</p>
|
||||||
|
<div class="highlight-python"><pre>{% for host in groups['app_servers'] %}
|
||||||
|
# something that applies to all app servers.
|
||||||
|
{% endfor %}</pre>
|
||||||
|
</div>
|
||||||
|
<p>Use cases include pointing a frontend proxy server to all of the app servers, setting up the correct firewall rules between servers, etc.</p>
|
||||||
|
<p><em>inventory_hostname</em> is the name of the hostname as configured in Ansible’s inventory host file. This can
|
||||||
be useful for when you don’t want to rely on the discovered hostname <cite>ansible_hostname</cite> or for other mysterious
|
be useful for when you don’t want to rely on the discovered hostname <cite>ansible_hostname</cite> or for other mysterious
|
||||||
reasons. Don’t worry about it unless you think you need it.</p>
|
reasons. Don’t worry about it unless you think you need it.</p>
|
||||||
</div>
|
</div>
|
||||||
|
@ -501,7 +508,7 @@ logs from ansible-pull runs would be an excellent way to gather and analyze remo
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
© Copyright 2012 Michael DeHaan.<br/>
|
© Copyright 2012 Michael DeHaan.<br/>
|
||||||
Last updated on Jun 19, 2012.<br/>
|
Last updated on Jul 04, 2012.<br/>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
|
@ -73,7 +73,7 @@ Example action from Ansible :doc:`playbooks`::
|
||||||
apt pkg=foo=1.00 state=installed
|
apt pkg=foo=1.00 state=installed
|
||||||
apt pkg=nginx state=latest default-release=squeeze-backports update-cache=yes
|
apt pkg=nginx state=latest default-release=squeeze-backports update-cache=yes
|
||||||
|
|
||||||
. _assemble:
|
.. _assemble:
|
||||||
|
|
||||||
assemble
|
assemble
|
||||||
````````
|
````````
|
||||||
|
@ -97,7 +97,7 @@ Example action from Ansible :doc:`playbooks`::
|
||||||
assemble src=/etc/someapp/fragments dest=/etc/someapp/someapp.conf
|
assemble src=/etc/someapp/fragments dest=/etc/someapp/someapp.conf
|
||||||
|
|
||||||
|
|
||||||
_authorized_key:
|
.. _authorized_key:
|
||||||
|
|
||||||
authorized_key
|
authorized_key
|
||||||
``````````````
|
``````````````
|
||||||
|
|
|
@ -207,7 +207,7 @@ s.parentNode.insertBefore(ga, s);
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
© Copyright 2012 Michael DeHaan.<br/>
|
© Copyright 2012 Michael DeHaan.<br/>
|
||||||
Last updated on Jun 19, 2012.<br/>
|
Last updated on Jul 04, 2012.<br/>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue