fix rst + docs rebuild
This commit is contained in:
parent
f81000c127
commit
85cedf52ef
14 changed files with 143 additions and 67 deletions
|
@ -273,7 +273,7 @@ languages:
|
|||
</p>
|
||||
<p>
|
||||
© Copyright 2012 Michael DeHaan.<br/>
|
||||
Last updated on May 06, 2012.<br/>
|
||||
Last updated on May 10, 2012.<br/>
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
|
8
api.html
8
api.html
|
@ -268,7 +268,7 @@ of these options via an external inventory system.</p>
|
|||
<p>If you are familiar with Puppet terminology, this concept is basically the same as ‘external nodes’, with the slight difference that it also defines which hosts are managed.</p>
|
||||
<div class="section" id="script-conventions">
|
||||
<h3>Script Conventions<a class="headerlink" href="#script-conventions" title="Permalink to this headline">¶</a></h3>
|
||||
<p>When the external node script is called with no arguments, the script must return a JSON hash/dictionary of all the groups to be managed, with a list of each host/IP as the value for each hash/dictionary element, like so:</p>
|
||||
<p>When the external node script is called with the single argument ‘–list’, the script must return a JSON hash/dictionary of all the groups to be managed, with a list of each host/IP as the value for each hash/dictionary element, like so:</p>
|
||||
<div class="highlight-python"><div class="highlight"><pre><span class="p">{</span>
|
||||
<span class="s">'databases'</span> <span class="p">:</span> <span class="p">[</span> <span class="s">'host1.example.com'</span><span class="p">,</span> <span class="s">'host2.example.com'</span> <span class="p">],</span>
|
||||
<span class="s">'webservers'</span> <span class="p">:</span> <span class="p">[</span> <span class="s">'host2.example.com'</span><span class="p">,</span> <span class="s">'host3.example.com'</span> <span class="p">],</span>
|
||||
|
@ -276,8 +276,8 @@ of these options via an external inventory system.</p>
|
|||
<span class="p">}</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>When called with a single argument, the name of a host from above, the script must return either an empty JSON
|
||||
hash/dictionary, or a list of key/value variables to make available to templates. Returning variables is optional,
|
||||
<p>When called with the arguments ‘–host <hostname>’ (where <hostname> is a host from above), the script must return either an empty JSON
|
||||
hash/dictionary, or a list of key/value variables to make available to templates or playbooks. Returning variables is optional,
|
||||
if the script does not wish to do this, returning an empty hash/dictionary is the way to go:</p>
|
||||
<div class="highlight-python"><div class="highlight"><pre><span class="p">{</span>
|
||||
<span class="s">'favcolor'</span> <span class="p">:</span> <span class="s">'red'</span><span class="p">,</span>
|
||||
|
@ -357,7 +357,7 @@ a conf.d file appropriately or something similar. Who knows?</p>
|
|||
</p>
|
||||
<p>
|
||||
© Copyright 2012 Michael DeHaan.<br/>
|
||||
Last updated on May 06, 2012.<br/>
|
||||
Last updated on May 10, 2012.<br/>
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
|
|
@ -194,21 +194,28 @@ set up SSH-agent so it can remember our credentials:</p>
|
|||
<div class="highlight-python"><pre>ssh-agent bash
|
||||
ssh-add ~/.ssh/id_rsa.pub</pre>
|
||||
</div>
|
||||
<p>Now to run the command on all servers in a group, in this case, ‘atlanta’:</p>
|
||||
<p>If you don’t want to use ssh-agent and want to instead SSH with a password instead of keys, you can with
|
||||
–ask-pass (-k), but it’s much better to just use ssh-agent.</p>
|
||||
<p>Now to run the command on all servers in a group, in this case, ‘atlanta’, in 10 parallel forks:</p>
|
||||
<div class="highlight-python"><pre>ansible atlanta -a "/sbin/reboot" -f 10</pre>
|
||||
</div>
|
||||
<p>If you want to run commands as a different user than root:</p>
|
||||
<p>If you want to run commands as a different user than root, it looks like this:</p>
|
||||
<div class="highlight-python"><pre>ansible atlanta -a "/usr/bin/foo" -u yourname</pre>
|
||||
</div>
|
||||
<p>If you want to run commands through sudo:</p>
|
||||
<div class="highlight-python"><pre>ansible atlanta -a "/usr/bin/foo" -u yourname --sudo [--ask-sudo-pass]</pre>
|
||||
</div>
|
||||
<p>Use –ask-sudo-pass (-K) if you are not using passwordless sudo.</p>
|
||||
<p>Use –ask-sudo-pass (-K) if you are not using passwordless sudo. This will interactively prompt
|
||||
you for the password to use. Use of passwordless sudo makes things easier to automate, but it’s
|
||||
not required.</p>
|
||||
<p>It is also possible to sudo to a user other than root using –sudo-user (-U):</p>
|
||||
<div class="highlight-python"><pre>ansible atlanta -a "/usr/bin/foo" -u yourname -U otheruser [--ask-sudo-pass]</pre>
|
||||
</div>
|
||||
<p>Ok, so those are basics. If you didn’t read about patterns and groups yet, go back and read <a class="reference internal" href="patterns.html"><em>The Inventory File, Patterns, and Groups</em></a>.</p>
|
||||
<p>The -f 10 in the above specifies the usage of 10 simultaneous processes. Normally commands also take
|
||||
a <cite>-m</cite> for module name, but the default module name is ‘command’, so we didn’t need to specify that
|
||||
here. We’ll use <cite>-m</cite> later to run some other <a class="reference internal" href="modules.html"><em>Ansible Modules</em></a>.</p>
|
||||
<p>The command module requires absolute paths and does not support shell variables. If we want to
|
||||
all of the time. We’ll use <cite>-m</cite> in later examples to run some other <a class="reference internal" href="modules.html"><em>Ansible Modules</em></a>.</p>
|
||||
<p>Note that the command module requires absolute paths and does not support shell variables. If we want to
|
||||
execute a module using the shell, we can do those things, and also use pipe and redirection operators.
|
||||
Read more about the differences on the <a class="reference internal" href="modules.html"><em>Ansible Modules</em></a> page. The shell
|
||||
module looks like this:</p>
|
||||
|
@ -373,7 +380,7 @@ a simplified syntax for this.</p>
|
|||
</p>
|
||||
<p>
|
||||
© Copyright 2012 Michael DeHaan.<br/>
|
||||
Last updated on May 06, 2012.<br/>
|
||||
Last updated on May 10, 2012.<br/>
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
|
2
faq.html
2
faq.html
|
@ -379,7 +379,7 @@ tasks – whether for a QA sytem, build system, or anything you can think of
|
|||
</p>
|
||||
<p>
|
||||
© Copyright 2012 Michael DeHaan.<br/>
|
||||
Last updated on May 06, 2012.<br/>
|
||||
Last updated on May 10, 2012.<br/>
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
|
|
@ -188,7 +188,7 @@ s.parentNode.insertBefore(ga, s);
|
|||
</p>
|
||||
<p>
|
||||
© Copyright 2012 Michael DeHaan.<br/>
|
||||
Last updated on May 06, 2012.<br/>
|
||||
Last updated on May 10, 2012.<br/>
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
|
|
@ -215,10 +215,13 @@ also need:</p>
|
|||
</div>
|
||||
<div class="section" id="getting-ansible">
|
||||
<h2>Getting Ansible<a class="headerlink" href="#getting-ansible" title="Permalink to this headline">¶</a></h2>
|
||||
<p>As the project is still pretty new, you will probably want to clone
|
||||
the git checkout, so you can keep up with all of the latest features,
|
||||
and also easily contribute back to the project (if you want).</p>
|
||||
<p>If you are interested in using all the latest features, you may wish to keep up to date
|
||||
with the development branch of the git checkout. This also makes it easiest to contribute
|
||||
back to the project.</p>
|
||||
<p>Instructions for installing from source are below.</p>
|
||||
<p>Ansible’s release cycles are about one month long. Due to this
|
||||
short release cycle, any bugs will generally be fixed in the next release versus maintaining
|
||||
backports on the stable branch.</p>
|
||||
<p>You may also wish to follow the <a class="reference external" href="https://github.com/ansible/ansible">Github project</a> if
|
||||
you have a github account. This is also where we keep the issue tracker for sharing
|
||||
bugs and feature ideas.</p>
|
||||
|
@ -227,6 +230,7 @@ bugs and feature ideas.</p>
|
|||
<p>Ansible is trivially easy to run from a checkout, root permissions are not required
|
||||
to use it:</p>
|
||||
<div class="highlight-python"><pre>$ git clone git://github.com/ansible/ansible.git
|
||||
$ git checkout -t origin/devel
|
||||
$ cd ./ansible
|
||||
$ source ./hacking/env-setup</pre>
|
||||
</div>
|
||||
|
@ -243,14 +247,19 @@ $ export ANSIBLE_HOSTS=~/ansible_hosts</pre>
|
|||
<p>If you are not working from a distribution where Ansible is packaged yet, you can install Ansible
|
||||
using “make install”. This is done through <cite>python-distutils</cite>:</p>
|
||||
<div class="highlight-python"><pre>$ git clone git://github.com/ansible/ansible.git
|
||||
$ git checkout -t origin/devel
|
||||
$ cd ./ansible
|
||||
$ sudo make install</pre>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="via-rpm">
|
||||
<h3>Via RPM<a class="headerlink" href="#via-rpm" title="Permalink to this headline">¶</a></h3>
|
||||
<p>In the near future, pre-built packages will be available through your
|
||||
distribution. Until that time, you can use the <tt class="docutils literal"><span class="pre">make</span> <span class="pre">rpm</span></tt> command to
|
||||
<p>RPMs for the last Ansible release are available for <a class="reference external" href="http://fedoraproject.org/wiki/EPEL">EPEL</a> 6 and currently supported
|
||||
Fedora distributions.</p>
|
||||
<blockquote>
|
||||
<div># install the epel-release RPM if needed on CentOS, RHEL, or Scientific Linux
|
||||
$ sudo yum install ansible</div></blockquote>
|
||||
<p>You can also use the <tt class="docutils literal"><span class="pre">make</span> <span class="pre">rpm</span></tt> command to
|
||||
build an RPM you can distribute and install:</p>
|
||||
<div class="highlight-python"><pre>$ git clone git://github.com/ansible/ansible.git
|
||||
$ cd ./ansible
|
||||
|
@ -265,14 +274,15 @@ same version. This is perfectly safe to do.</p>
|
|||
<div class="section" id="debian-gentoo-arch-others">
|
||||
<h3>Debian, Gentoo, Arch, Others<a class="headerlink" href="#debian-gentoo-arch-others" title="Permalink to this headline">¶</a></h3>
|
||||
<p>Gentoo eBuilds are available <a class="reference external" href="https://github.com/uu/ubuilds">here</a></p>
|
||||
<p>Debian package recipes are in progress – see the source checkout, in the packaging/debian
|
||||
directory.</p>
|
||||
<p>Debian package recipes can be built from the source checkout, run:</p>
|
||||
<div class="highlight-python"><pre>make debian</pre>
|
||||
</div>
|
||||
<p>An Arch PKGBUILD is available on <a class="reference external" href="https://aur.archlinux.org/packages.php?ID=58621">AUR</a>
|
||||
If you have python3 installed on Arch, you probably want to symlink python to python2.:</p>
|
||||
<div class="highlight-python"><pre>sudo ln -sf /usr/bin/python2 /usr/bin/python</pre>
|
||||
</div>
|
||||
<p>If you would like to package Ansible for Homebrew, BSD, or others,
|
||||
please stop by the mailing list and say hi.</p>
|
||||
please stop by the mailing list and say hi!</p>
|
||||
</div>
|
||||
<div class="section" id="tagged-releases">
|
||||
<h3>Tagged Releases<a class="headerlink" href="#tagged-releases" title="Permalink to this headline">¶</a></h3>
|
||||
|
@ -281,8 +291,6 @@ project page:</p>
|
|||
<ul class="simple">
|
||||
<li><a class="reference external" href="https://github.com/ansible/ansible/downloads">Ansible/downloads</a></li>
|
||||
</ul>
|
||||
<p>At this point in Ansible’s development, running or building from checkout is preferred
|
||||
if you want access to all of the latest modules and improvements.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="your-first-commands">
|
||||
|
@ -341,7 +349,7 @@ explore, but you already have a fully working infrastructure!</p>
|
|||
</p>
|
||||
<p>
|
||||
© Copyright 2012 Michael DeHaan.<br/>
|
||||
Last updated on May 06, 2012.<br/>
|
||||
Last updated on May 10, 2012.<br/>
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
|
|
@ -296,7 +296,7 @@ Email: <input type=text name=email> <input type=submit name="sub" val
|
|||
<li class="toctree-l2"><a class="reference internal" href="patterns.html#selecting-targets">Selecting Targets</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="patterns.html#host-variables">Host Variables</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="patterns.html#group-variables">Group Variables</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="patterns.html#groups-of-groups">Groups of Groups</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="patterns.html#groups-of-groups-and-group-variables">Groups of Groups, and Group Variables</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="patterns.html#yaml-inventory-format">YAML Inventory Format</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
@ -321,7 +321,8 @@ Email: <input type=text name=email> <input type=submit name="sub" val
|
|||
<li class="toctree-l2"><a class="reference internal" href="modules.html#group">group</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#service">service</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#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#template">template</a></li>
|
||||
|
@ -375,6 +376,7 @@ Email: <input type=text name=email> <input type=submit name="sub" val
|
|||
<li class="toctree-l2"><a class="reference internal" href="moduledev.html#tutorial">Tutorial</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="moduledev.html#testing-modules">Testing Modules</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="moduledev.html#reading-input">Reading Input</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="moduledev.html#module-provided-facts">Module Provided ‘Facts’</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="moduledev.html#common-pitfalls">Common Pitfalls</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="moduledev.html#conventions">Conventions</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="moduledev.html#shorthand-vs-json">Shorthand Vs JSON</a></li>
|
||||
|
@ -432,7 +434,7 @@ Puppet Labs, and is now with <a class="reference external" href="http://rpath.co
|
|||
</p>
|
||||
<p>
|
||||
© Copyright 2012 Michael DeHaan.<br/>
|
||||
Last updated on May 06, 2012.<br/>
|
||||
Last updated on May 10, 2012.<br/>
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
|
|
@ -149,6 +149,7 @@ s.parentNode.insertBefore(ga, s);
|
|||
<li><a class="reference internal" href="#tutorial">Tutorial</a></li>
|
||||
<li><a class="reference internal" href="#testing-modules">Testing Modules</a></li>
|
||||
<li><a class="reference internal" href="#reading-input">Reading Input</a></li>
|
||||
<li><a class="reference internal" href="#module-provided-facts">Module Provided ‘Facts’</a></li>
|
||||
<li><a class="reference internal" href="#common-pitfalls">Common Pitfalls</a></li>
|
||||
<li><a class="reference internal" href="#conventions">Conventions</a></li>
|
||||
<li><a class="reference internal" href="#shorthand-vs-json">Shorthand Vs JSON</a></li>
|
||||
|
@ -328,10 +329,32 @@ a lot shorter than this:</p>
|
|||
<div class="highlight-python"><pre>ansible/hacking/test-module ./time time=\"March 14 12:23\"</pre>
|
||||
</div>
|
||||
<p>This should return something like:</p>
|
||||
<div class="highlight-python"><div class="highlight"><pre><span class="p">{</span><span class="s">"changed"</span><span class="p">:</span> <span class="n">true</span><span class="p">,</span> <span class="s">"time"</span><span class="p">:</span> <span class="s">"2012-03-14 12:23:00.000307"</span><span class="p">}</span>
|
||||
<div class="highlight-python"><div class="highlight"><pre><span class="p">{</span><span class="s">"changed"</span><span class="p">:</span> <span class="bp">True</span><span class="p">,</span> <span class="s">"time"</span><span class="p">:</span> <span class="s">"2012-03-14 12:23:00.000307"</span><span class="p">}</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="module-provided-facts">
|
||||
<h2>Module Provided ‘Facts’<a class="headerlink" href="#module-provided-facts" title="Permalink to this headline">¶</a></h2>
|
||||
<p>The ‘setup’ module that ships with Ansible provides many variables about a system that can be used in playbooks
|
||||
and templates. However, it’s possible to also add your own facts without modifying the system module. To do
|
||||
this, just have the module return a <cite>ansible_facts</cite> key, like so, along with other return data. This requires
|
||||
Ansible 0.4 and later:</p>
|
||||
<div class="highlight-python"><pre>{
|
||||
"changed" : True,
|
||||
"rc" : 5,
|
||||
"ansible_facts" : {
|
||||
"leptons" : 5000
|
||||
"colors" : {
|
||||
"red" : "FF0000",
|
||||
"white" : "FFFFFF"
|
||||
}
|
||||
}
|
||||
}</pre>
|
||||
</div>
|
||||
<p>These ‘facts’ will be available to all statements called after that module (but not before) in the playbook.
|
||||
A good idea might be make a module called ‘site_facts’ and always call it at the top of each playbook, though
|
||||
we’re always open to improving the selection of core facts in Ansible as well.</p>
|
||||
</div>
|
||||
<div class="section" id="common-pitfalls">
|
||||
<h2>Common Pitfalls<a class="headerlink" href="#common-pitfalls" title="Permalink to this headline">¶</a></h2>
|
||||
<p>If writing a module in Python and you have managed nodes running
|
||||
|
@ -430,7 +453,7 @@ Stop by the mailing list to inquire about requirements.</p>
|
|||
</p>
|
||||
<p>
|
||||
© Copyright 2012 Michael DeHaan.<br/>
|
||||
Last updated on May 06, 2012.<br/>
|
||||
Last updated on May 10, 2012.<br/>
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
|
57
modules.html
57
modules.html
|
@ -156,7 +156,8 @@ s.parentNode.insertBefore(ga, s);
|
|||
<li><a class="reference internal" href="#group">group</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="#service">service</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="#setup">setup</a></li>
|
||||
<li><a class="reference internal" href="#shell">shell</a></li>
|
||||
<li><a class="reference internal" href="#template">template</a></li>
|
||||
|
@ -225,11 +226,11 @@ noted, any given module does support change hooks.</p>
|
|||
<p>Manages apt-packages (such as for Debian/Ubuntu).</p>
|
||||
<p><em>pkg</em>:</p>
|
||||
<ul class="simple">
|
||||
<li>A package name or package specifier with version, like foo=1.0</li>
|
||||
<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>
|
||||
</ul>
|
||||
<p><em>state</em>:</p>
|
||||
<ul class="simple">
|
||||
<li>Can be either ‘installed’, ‘removed’, or ‘latest’. The default is ‘installed’.</li>
|
||||
<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>
|
||||
</ul>
|
||||
<p><em>update-cache</em>:</p>
|
||||
<ul class="simple">
|
||||
|
@ -390,7 +391,7 @@ file path=/some/path state=directory context=default</pre>
|
|||
<p>Deploys software (or files) from git checkouts.</p>
|
||||
<p><em>repo</em>:</p>
|
||||
<ul class="simple">
|
||||
<li>git or http protocol address of the repo to checkout.</li>
|
||||
<li>git, ssh, or http protocol address of the git repo to checkout.</li>
|
||||
</ul>
|
||||
<p><em>dest</em>:</p>
|
||||
<ul class="simple">
|
||||
|
@ -401,6 +402,10 @@ file path=/some/path state=directory context=default</pre>
|
|||
<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>
|
||||
</ul>
|
||||
<p><em>branch</em>:</p>
|
||||
<ul class="simple">
|
||||
<li>(new in 0.4) Which branch name to checkout. Defaults to ‘master’.</li>
|
||||
</ul>
|
||||
<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>
|
||||
|
@ -420,6 +425,10 @@ file path=/some/path state=directory context=default</pre>
|
|||
<ul class="simple">
|
||||
<li>either ‘absent’, or ‘present’. ‘present’ is the default.</li>
|
||||
</ul>
|
||||
<p><em>system</em>:</p>
|
||||
<ul class="simple">
|
||||
<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>
|
||||
</ul>
|
||||
<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>
|
||||
<div class="highlight-python"><pre>group name=somegroup state=present</pre>
|
||||
|
@ -443,8 +452,24 @@ successful contact.</p>
|
|||
takes no parameters & does not support change hooks, nor does it make
|
||||
any changes on the system.</p>
|
||||
</div>
|
||||
<div class="section" id="service">
|
||||
<span id="id9"></span><h2>service<a class="headerlink" href="#service" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="section" id="raw">
|
||||
<span id="service"></span><h2>raw<a class="headerlink" href="#raw" title="Permalink to this headline">¶</a></h2>
|
||||
<p>Executes a low-down and dirty SSH command, not going through the module subsystem.
|
||||
This module is new in Ansible 0.4.</p>
|
||||
<p>This is useful and should only be done in two cases. The first case is installing
|
||||
python-simplejson on older (python 2.4 and before) hosts that need it as a dependency
|
||||
to run modules, since nearly all core modules require it. Another is speaking to any
|
||||
devices such as routers that do not have any Python installed. In any other case,
|
||||
using the ‘shell’ or ‘command’ module is much more appropriate.</p>
|
||||
<p>Arguments given to ‘raw’ are run directly through the configured remote shell and
|
||||
only output is returned. There is no error detection or change handler support
|
||||
for this module.</p>
|
||||
<p>Example from <cite>/usr/bin/ansible</cite> to bootstrap a legacy python 2.4 host:</p>
|
||||
<blockquote>
|
||||
<div>ansible newhost.example.com raw -a “yum install python-simplejson”</div></blockquote>
|
||||
</div>
|
||||
<div class="section" id="id9">
|
||||
<h2>service<a class="headerlink" href="#id9" title="Permalink to this headline">¶</a></h2>
|
||||
<p>Controls services on remote machines.</p>
|
||||
<p><em>state</em>:</p>
|
||||
<ul class="simple">
|
||||
|
@ -452,6 +477,15 @@ any changes on the system.</p>
|
|||
Started/stopped are idempotent actions that will not run commands
|
||||
unless necessary. <tt class="docutils literal"><span class="pre">restarted</span></tt> will always bounce the service.</li>
|
||||
</ul>
|
||||
<p><em>enabled</em>:</p>
|
||||
<ul class="simple">
|
||||
<li>(new in 0.4) Whether the service should start on boot. Either ‘yes’ or ‘no’.
|
||||
Uses chkconfig or updates-rc.d as appropriate.</li>
|
||||
</ul>
|
||||
<p><em>list</em>:</p>
|
||||
<ul class="simple">
|
||||
<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>
|
||||
</ul>
|
||||
<p><em>name</em>:</p>
|
||||
<ul class="simple">
|
||||
<li>The name of the service.</li>
|
||||
|
@ -636,6 +670,10 @@ be a relative or absolute path.</li>
|
|||
<ul class="simple">
|
||||
<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>
|
||||
</ul>
|
||||
<p><em>system</em>:</p>
|
||||
<ul class="simple">
|
||||
<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>
|
||||
</ul>
|
||||
<p><em>force</em>:</p>
|
||||
<ul class="simple">
|
||||
<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>
|
||||
|
@ -696,13 +734,14 @@ ansible host -m virt -a "command=virttype"</pre>
|
|||
</ul>
|
||||
<p><em>state</em>:</p>
|
||||
<ul class="simple">
|
||||
<li>Can be either ‘installed’, ‘latest’, or ‘removed’. The default is ‘installed’.</li>
|
||||
<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>
|
||||
</ul>
|
||||
<p><em>list</em>:</p>
|
||||
<ul class="simple">
|
||||
<li>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.</li>
|
||||
‘available’, ‘repos’, or any package specifier. (This is more intended for
|
||||
use with /usr/bin/ansible or the API, not playbooks.)</li>
|
||||
</ul>
|
||||
<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
|
||||
|
@ -748,7 +787,7 @@ yum pkg=httpd state=installed</pre>
|
|||
</p>
|
||||
<p>
|
||||
© Copyright 2012 Michael DeHaan.<br/>
|
||||
Last updated on May 06, 2012.<br/>
|
||||
Last updated on May 10, 2012.<br/>
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
|
|
@ -150,7 +150,7 @@ s.parentNode.insertBefore(ga, s);
|
|||
<li><a class="reference internal" href="#selecting-targets">Selecting Targets</a></li>
|
||||
<li><a class="reference internal" href="#host-variables">Host Variables</a></li>
|
||||
<li><a class="reference internal" href="#group-variables">Group Variables</a></li>
|
||||
<li><a class="reference internal" href="#groups-of-groups">Groups of Groups</a></li>
|
||||
<li><a class="reference internal" href="#groups-of-groups-and-group-variables">Groups of Groups, and Group Variables</a></li>
|
||||
<li><a class="reference internal" href="#yaml-inventory-format">YAML Inventory Format</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
@ -240,10 +240,6 @@ wildcards:</p>
|
|||
<p>It’s also ok to mix wildcard patterns and groups at the same time:</p>
|
||||
<div class="highlight-python"><pre>one*.com:dbservers</pre>
|
||||
</div>
|
||||
<div class="admonition note">
|
||||
<p class="first admonition-title">Note</p>
|
||||
<p class="last">It is not possible to target a host not in the inventory file, unless using playbooks with –override-hosts. More on that later. This is a safety feature.</p>
|
||||
</div>
|
||||
<p>Easy enough. See <a class="reference internal" href="examples.html"><em>Command Line Examples</em></a> and then <a class="reference internal" href="playbooks.html"><em>Playbooks</em></a> for how to do things to selected hosts.</p>
|
||||
</div>
|
||||
<div class="section" id="host-variables">
|
||||
|
@ -267,30 +263,32 @@ ntp_server=ntp.atlanta.example.com
|
|||
proxy=proxy.atlanta.example.com</pre>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="groups-of-groups">
|
||||
<h2>Groups of Groups<a class="headerlink" href="#groups-of-groups" title="Permalink to this headline">¶</a></h2>
|
||||
<p>Using the 0.4 branch of Ansible, it is possible to make groups of groups:</p>
|
||||
<div class="highlight-python"><pre>[atlanta]
|
||||
<div class="section" id="groups-of-groups-and-group-variables">
|
||||
<h2>Groups of Groups, and Group Variables<a class="headerlink" href="#groups-of-groups-and-group-variables" title="Permalink to this headline">¶</a></h2>
|
||||
<p>Using Ansible 0.4, it is possible to make groups of groups and assign
|
||||
variables to groups. These variables can be used by /usr/bin/ansible-playbook, but not
|
||||
/usr/bin/ansible.</p>
|
||||
<blockquote>
|
||||
<div><p>[atlanta]
|
||||
host1
|
||||
host2</p>
|
||||
<p>[raleigh]
|
||||
host2
|
||||
|
||||
[raleigh]
|
||||
host2
|
||||
host3
|
||||
|
||||
[southeast:children]
|
||||
host3</p>
|
||||
<p>[southeast:children]
|
||||
atlanta
|
||||
raleigh
|
||||
|
||||
[southeast:vars]
|
||||
raleigh</p>
|
||||
<p>[southeast:vars]
|
||||
some_server=foo.southeast.example.com
|
||||
|
||||
[usa:children]
|
||||
halon_system_timeout=30
|
||||
self_destruct_countdown=60
|
||||
escape_pods=2</p>
|
||||
<p>[usa:children]
|
||||
southeast
|
||||
northeast
|
||||
southwest
|
||||
southeast</pre>
|
||||
</div>
|
||||
southeast</p>
|
||||
</div></blockquote>
|
||||
</div>
|
||||
<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>
|
||||
|
@ -363,7 +361,7 @@ YAML:</p>
|
|||
</p>
|
||||
<p>
|
||||
© Copyright 2012 Michael DeHaan.<br/>
|
||||
Last updated on May 06, 2012.<br/>
|
||||
Last updated on May 10, 2012.<br/>
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
|
|
@ -388,7 +388,7 @@ things you can do with playbooks.</p>
|
|||
for assuring the configuration of a system by putting a playbook on a crontab. This may also be used
|
||||
to run a playbook inside a OS installer, such as an Anaconda kickstart.</p>
|
||||
<p>To run an entire playbook locally, just set the “hosts:” line to “hosts:127.0.0.1” and then run the playbook like so:</p>
|
||||
<div class="highlight-python"><pre>playbook playbook.yml --connection=local</pre>
|
||||
<div class="highlight-python"><pre>ansible-playbook playbook.yml --connection=local</pre>
|
||||
</div>
|
||||
<p>Alternatively, a local connection can be used in a single playbook play, even if other plays in the playbook
|
||||
use the default remote connection type:</p>
|
||||
|
@ -719,7 +719,7 @@ Let’s run a playbook using a parallelism level of 10:</p>
|
|||
</p>
|
||||
<p>
|
||||
© Copyright 2012 Michael DeHaan.<br/>
|
||||
Last updated on May 06, 2012.<br/>
|
||||
Last updated on May 10, 2012.<br/>
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
|
|
@ -44,8 +44,7 @@ Manages apt-packages (such as for Debian/Ubuntu).
|
|||
|
||||
*pkg*:
|
||||
|
||||
* A package name or package specifier with version, like `foo`, or `foo=1.0` to
|
||||
install a specific version of the foo package.
|
||||
* A package name or package specifier with version, like `foo`, or `foo=1.0` to install a specific version of the foo package.
|
||||
|
||||
*state*:
|
||||
|
||||
|
|
|
@ -205,7 +205,7 @@ s.parentNode.insertBefore(ga, s);
|
|||
</p>
|
||||
<p>
|
||||
© Copyright 2012 Michael DeHaan.<br/>
|
||||
Last updated on May 06, 2012.<br/>
|
||||
Last updated on May 10, 2012.<br/>
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue