Commit 26800d5d by Tim Bielawa
parents cdfb64ce f3a0eb4b
...@@ -20,6 +20,7 @@ __docformat__ = 'restructuredtext' ...@@ -20,6 +20,7 @@ __docformat__ = 'restructuredtext'
import os import os
import sys import sys
import traceback
from sphinx.application import Sphinx from sphinx.application import Sphinx
from os import path from os import path
...@@ -68,12 +69,7 @@ class SphinxBuilder(object): ...@@ -68,12 +69,7 @@ class SphinxBuilder(object):
# print "Run 'make htmlman' to recreate the problem." # print "Run 'make htmlman' to recreate the problem."
#print "Your docs are now in %s" % outdir #print "Your docs are now in %s" % outdir
except ImportError, ie: except ImportError, ie:
print >> sys.stderr, "You don't seem to have the following which" traceback.print_exc()
print >> sys.stderr, "are required to make documentation:"
print >> sys.stderr, "\tsphinx.application.Sphinx"
print >> sys.stderr, "This is usually available from the python-sphinx package"
print >> sys.stderr, "=== Error message received while attempting to build==="
print >> sys.stderr, ie
except Exception, ex: except Exception, ex:
print >> sys.stderr, "FAIL! exiting ... (%s)" % ex print >> sys.stderr, "FAIL! exiting ... (%s)" % ex
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>YAML Scripts &mdash; Ansible v0.0.1 documentation</title> <title>YAML Format &mdash; Ansible v0.0.1 documentation</title>
<link rel="stylesheet" href="_static/default.css" type="text/css" /> <link rel="stylesheet" href="_static/default.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" /> <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript"> <script type="text/javascript">
...@@ -23,8 +23,8 @@ ...@@ -23,8 +23,8 @@
<script type="text/javascript" src="_static/underscore.js"></script> <script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script> <script type="text/javascript" src="_static/doctools.js"></script>
<link rel="top" title="Ansible v0.0.1 documentation" href="index.html" /> <link rel="top" title="Ansible v0.0.1 documentation" href="index.html" />
<link rel="next" title="Patterns" href="patterns.html" /> <link rel="next" title="Playbooks: Ansible for Deployment, Configuration Management, and Orchestration" href="playbooks.html" />
<link rel="prev" title="Getting Started" href="gettingstarted.html" /> <link rel="prev" title="Ansible Modules" href="modules.html" />
</head> </head>
<body> <body>
<div class="related"> <div class="related">
...@@ -34,10 +34,10 @@ ...@@ -34,10 +34,10 @@
<a href="genindex.html" title="General Index" <a href="genindex.html" title="General Index"
accesskey="I">index</a></li> accesskey="I">index</a></li>
<li class="right" > <li class="right" >
<a href="patterns.html" title="Patterns" <a href="playbooks.html" title="Playbooks: Ansible for Deployment, Configuration Management, and Orchestration"
accesskey="N">next</a> |</li> accesskey="N">next</a> |</li>
<li class="right" > <li class="right" >
<a href="gettingstarted.html" title="Getting Started" <a href="modules.html" title="Ansible Modules"
accesskey="P">previous</a> |</li> accesskey="P">previous</a> |</li>
<li><a href="index.html">Ansible v0.0.1 documentation</a> &raquo;</li> <li><a href="index.html">Ansible v0.0.1 documentation</a> &raquo;</li>
</ul> </ul>
...@@ -48,18 +48,20 @@ ...@@ -48,18 +48,20 @@
<div class="bodywrapper"> <div class="bodywrapper">
<div class="body"> <div class="body">
<div class="section" id="yaml-scripts"> <div class="section" id="yaml-format">
<h1>YAML Scripts<a class="headerlink" href="#yaml-scripts" title="Permalink to this headline"></a></h1> <h1>YAML Format<a class="headerlink" href="#yaml-format" title="Permalink to this headline"></a></h1>
<p>This page provides a basic overview of correct YAML syntax.</p> <p>This page provides a basic overview of correct YAML syntax, which is how Ansible
playbooks (our configuration management language) are expressed.
You may also wish to read playbook examples and will quickly pick this up from those.</p>
<div class="section" id="yaml-basics"> <div class="section" id="yaml-basics">
<h2>YAML Basics<a class="headerlink" href="#yaml-basics" title="Permalink to this headline"></a></h2> <h2>YAML Basics<a class="headerlink" href="#yaml-basics" title="Permalink to this headline"></a></h2>
<p>For <cite>ansible</cite>, every YAML script must be a list at it&#8217;s root-most <p>For <cite>ansible</cite>, every YAML file must be a list at it&#8217;s root-most
element. Each item in the list is a dictionary. These dictionaries element. Each item in the list is a dictionary. These dictionaries
represent all the options you can use to write a <cite>ansible</cite> script. In represent all the options you can use to write an <cite>ansible</cite> file. In
addition, all YAML files (regardless of their association with addition, all YAML files (regardless of their association with
<cite>ansible</cite> or not) should start with <tt class="docutils literal"><span class="pre">---</span></tt>.</p> <cite>ansible</cite> or not) should start with <tt class="docutils literal"><span class="pre">---</span></tt>.</p>
<p>In YAML a list can be represented in two ways. In one way all members <p>In YAML a list can be represented in two ways. In one way all members
of a list are lines beginning at the same indentation level starting of a list are lines beginning at the same indenta`tion level starting
with a <tt class="docutils literal"><span class="pre">-</span></tt> character:</p> with a <tt class="docutils literal"><span class="pre">-</span></tt> character:</p>
<div class="highlight-python"><pre>--- <div class="highlight-python"><pre>---
# A list of tasty fruits # A list of tasty fruits
...@@ -111,7 +113,7 @@ languages: ...@@ -111,7 +113,7 @@ languages:
dotnet: Lame</pre> dotnet: Lame</pre>
</div> </div>
<p>That&#8217;s all you really need to know about YAML to get started writing <p>That&#8217;s all you really need to know about YAML to get started writing
<cite>Ansible</cite> scripts.</p> <cite>Ansible</cite> playbooks.</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">
...@@ -130,18 +132,18 @@ languages: ...@@ -130,18 +132,18 @@ languages:
<div class="sphinxsidebarwrapper"> <div class="sphinxsidebarwrapper">
<h3><a href="index.html">Table Of Contents</a></h3> <h3><a href="index.html">Table Of Contents</a></h3>
<ul> <ul>
<li><a class="reference internal" href="#">YAML Scripts</a><ul> <li><a class="reference internal" href="#">YAML Format</a><ul>
<li><a class="reference internal" href="#yaml-basics">YAML Basics</a></li> <li><a class="reference internal" href="#yaml-basics">YAML Basics</a></li>
</ul> </ul>
</li> </li>
</ul> </ul>
<h4>Previous topic</h4> <h4>Previous topic</h4>
<p class="topless"><a href="gettingstarted.html" <p class="topless"><a href="modules.html"
title="previous chapter">Getting Started</a></p> title="previous chapter">Ansible Modules</a></p>
<h4>Next topic</h4> <h4>Next topic</h4>
<p class="topless"><a href="patterns.html" <p class="topless"><a href="playbooks.html"
title="next chapter">Patterns</a></p> title="next chapter">Playbooks: Ansible for Deployment, Configuration Management, and Orchestration</a></p>
<h3>This Page</h3> <h3>This Page</h3>
<ul class="this-page-menu"> <ul class="this-page-menu">
<li><a href="_sources/YAMLScripts.txt" <li><a href="_sources/YAMLScripts.txt"
...@@ -150,7 +152,7 @@ languages: ...@@ -150,7 +152,7 @@ languages:
<div id="searchbox" style="display: none"> <div id="searchbox" style="display: none">
<h3>Quick search</h3> <h3>Quick search</h3>
<form class="search" action="search.html" method="get"> <form class="search" action="search.html" method="get">
<input type="text" name="q" size="18" /> <input type="text" name="q" />
<input type="submit" value="Go" /> <input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" /> <input type="hidden" name="area" value="default" />
...@@ -171,18 +173,18 @@ languages: ...@@ -171,18 +173,18 @@ languages:
<a href="genindex.html" title="General Index" <a href="genindex.html" title="General Index"
>index</a></li> >index</a></li>
<li class="right" > <li class="right" >
<a href="patterns.html" title="Patterns" <a href="playbooks.html" title="Playbooks: Ansible for Deployment, Configuration Management, and Orchestration"
>next</a> |</li> >next</a> |</li>
<li class="right" > <li class="right" >
<a href="gettingstarted.html" title="Getting Started" <a href="modules.html" title="Ansible Modules"
>previous</a> |</li> >previous</a> |</li>
<li><a href="index.html">Ansible v0.0.1 documentation</a> &raquo;</li> <li><a href="index.html">Ansible v0.0.1 documentation</a> &raquo;</li>
</ul> </ul>
</div> </div>
<div class="footer"> <div class="footer">
&copy; Copyright 2012 Michael DeHaan. &copy; Copyright 2012 Michael DeHaan.
Last updated on Mar 07, 2012. Last updated on Mar 09, 2012.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.7. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.8.
</div> </div>
</body> </body>
</html> </html>
\ No newline at end of file
YAML Scripts YAML Format
============ ===========
This page provides a basic overview of correct YAML syntax.
This page provides a basic overview of correct YAML syntax, which is how Ansible
playbooks (our configuration management language) are expressed.
You may also wish to read playbook examples and will quickly pick this up from those.
YAML Basics YAML Basics
----------- -----------
For `ansible`, every YAML script must be a list at it's root-most For `ansible`, every YAML file must be a list at it's root-most
element. Each item in the list is a dictionary. These dictionaries element. Each item in the list is a dictionary. These dictionaries
represent all the options you can use to write a `ansible` script. In represent all the options you can use to write an `ansible` file. In
addition, all YAML files (regardless of their association with addition, all YAML files (regardless of their association with
`ansible` or not) should start with ``---``. `ansible` or not) should start with ``---``.
In YAML a list can be represented in two ways. In one way all members In YAML a list can be represented in two ways. In one way all members
of a list are lines beginning at the same indentation level starting of a list are lines beginning at the same indenta`tion level starting
with a ``-`` character:: with a ``-`` character::
--- ---
...@@ -74,7 +75,7 @@ Finally, you can combine these data structures:: ...@@ -74,7 +75,7 @@ Finally, you can combine these data structures::
dotnet: Lame dotnet: Lame
That's all you really need to know about YAML to get started writing That's all you really need to know about YAML to get started writing
`Ansible` scripts. `Ansible` playbooks.
.. seealso:: .. seealso::
......
API Using the Python API
=== ====================
Lorem ipsum dolor sit amet, consectetur adipiscing elit. In dignissim The Python API is very powerful, and is how the ansible CLI and ansible-playbook
placerat nibh, non feugiat risus varius vitae. Donec eu libero are implemented.
lectus. Ut non orci felis, eget mattis mauris. Etiam ut tellus in
magna porta venenatis. Quisque scelerisque, sem non ultrices bibendum, It's pretty simple::
dolor diam rutrum lectus, sed luctus neque neque vitae eros. Vivamus
mattis, ipsum ut bibendum gravida, lectus arcu venenatis elit, vitae import ansible.runner
luctus diam leo sit amet ligula. Nunc egestas justo in nulla sagittis
ut suscipit sapien gravida. Morbi id dui nibh. Nullam diam massa, runner = ansible.runner.Runner(
rhoncus a dignissim non, adipiscing vel arcu. Quisque ultricies module_name='ping',
tincidunt purus ut sodales. Quisque scelerisque dapibus purus quis module_args='',
egestas. Maecenas sagittis porttitor adipiscing. Duis eu magna pattern='web*',
sem. Donec arcu felis, faucibus et malesuada non, blandit vitae forks=10
metus. Fusce nec sapien dolor. )
datastructure = runner.run()
Aenean ac fermentum nisl. Integer leo sem, rutrum nec dictum at,
pretium quis sapien. Duis felis metus, sodales sit amet gravida in, The run method returns results per host, grouped by whether they
pretium ut arcu. Nulla ligula quam, aliquam sit amet sollicitudin could be contacted or not. Return types are module specific, as
eget, molestie tincidunt ipsum. Nulla leo nunc, mattis sed auctor at, expressed in the 'ansible-modules' documentation.::
suscipit ut metus. Suspendisse hendrerit, justo sagittis malesuada
molestie, nisi nunc placerat libero, vel vulputate elit tellus et {
augue. Phasellus tempor lectus ac nisi aliquam faucibus. Donec feugiat "dark" : {
egestas nibh id mattis. In hac habitasse platea dictumst. Ut accumsan "web1.example.com" : "failure message"
lorem eget leo dictum viverra. }
"contacted" : {
Quisque egestas lorem sit amet felis tincidunt adipiscing. Aenean "web2.example.com" : 1
ornare fermentum accumsan. Aenean eu mauris arcu, id pulvinar }
quam. Suspendisse nec massa vel augue laoreet ultricies in convallis }
dolor. Mauris sodales porta enim, non ultricies dolor luctus
in. Phasellus eu tortor lectus, vel porttitor nulla. Mauris vulputate, A module can return any type of JSON data it wants, so Ansible can
erat id scelerisque lobortis, nibh ipsum tristique elit, ac viverra be used as a framework to rapidly build powerful applications and scripts.
arcu sem a ante. Praesent nec metus vestibulum augue eleifend
suscipit. In feugiat, sem nec dignissim consequat, velit tortor Detailed API Example
scelerisque metus, sit amet mollis nisl sem eu nibh. Quisque in nibh ````````````````````
turpis. Proin ac nisi ligula, a pretium augue.
The following script prints out the uptime information for all hosts::
In nibh eros, laoreet id interdum vel, sodales sed tortor. Sed
ullamcorper, sem vel mattis consectetur, nibh turpis molestie nisl, #!/usr/bin/python
eget lobortis mi magna sed metus. Cras justo est, tempus quis
adipiscing ut, hendrerit convallis sem. Mauris ullamcorper, sapien et import ansible.runner
luctus iaculis, urna elit egestas ipsum, et tristique enim risus vitae import sys
nunc. Vivamus aliquet lorem eu urna pulvinar hendrerit malesuada nunc
sollicitudin. Cras in mi rhoncus quam egestas dignissim vel sit amet # construct the ansible runner and execute on all hosts
lacus. Maecenas interdum viverra laoreet. Quisque elementum results = ansible.runner.Runner(
sollicitudin ullamcorper. pattern='*', forks=10,
module_name='command', module_args=['/usr/bin/uptime'],
Pellentesque mauris sem, malesuada at lobortis in, porta eget ).run()
urna. Duis aliquet quam eget risus elementum quis auctor ligula
gravida. Phasellus et ullamcorper libero. Nam elementum ultricies if results is None:
tellus, in sagittis magna aliquet quis. Ut sit amet tellus id erat print "No hosts found"
tristique lobortis. Suspendisse est enim, tristique eu convallis id, sys.exit(1)
rutrum nec lacus. Fusce iaculis diam non felis rutrum lobortis. Proin
hendrerit mi tincidunt dui fermentum placerat. print "UP ***********"
for (hostname, result) in results['contacted'].items():
if not 'failed' in result:
print "%s >>> %s" % (hostname, result['stdout'])
print "FAILED *******"
for (hostname, result) in results['contacted'].items():
if 'failed' in result:
print "%s >>> %s" % (hostname, result['msg'])
print "DOWN *********"
for (hostname, result) in results['dark'].items():
print "%s >>> %s" % (hostname, result)
Advanced programmers may also wish to read the source to ansible itself, for
it uses the Runner() API (with all available options) to implement the
command line tools ``ansible`` and ``ansible-playbook``.
Communicate Communicate and Get Involved
=========== ===========================
Lorem ipsum dolor sit amet, consectetur adipiscing elit. In dignissim * Join the `ansible-project mailing list <http://groups.google.com/group/ansible-project>`_ on Google Groups
placerat nibh, non feugiat risus varius vitae. Donec eu libero * Join `#ansible <irc://irc.freenode.net/#ansible>`_ on the `freenode IRC network <http://freenode.net/>`_
lectus. Ut non orci felis, eget mattis mauris. Etiam ut tellus in * Visit the `project page <https://github.com/ansible/ansible>`_ on Github
magna porta venenatis. Quisque scelerisque, sem non ultrices bibendum,
dolor diam rutrum lectus, sed luctus neque neque vitae eros. Vivamus
mattis, ipsum ut bibendum gravida, lectus arcu venenatis elit, vitae
luctus diam leo sit amet ligula. Nunc egestas justo in nulla sagittis
ut suscipit sapien gravida. Morbi id dui nibh. Nullam diam massa,
rhoncus a dignissim non, adipiscing vel arcu. Quisque ultricies
tincidunt purus ut sodales. Quisque scelerisque dapibus purus quis
egestas. Maecenas sagittis porttitor adipiscing. Duis eu magna
sem. Donec arcu felis, faucibus et malesuada non, blandit vitae
metus. Fusce nec sapien dolor.
Aenean ac fermentum nisl. Integer leo sem, rutrum nec dictum at, - View the `issue tracker <https://github.com/ansible/ansible/issues>`_
pretium quis sapien. Duis felis metus, sodales sit amet gravida in,
pretium ut arcu. Nulla ligula quam, aliquam sit amet sollicitudin
eget, molestie tincidunt ipsum. Nulla leo nunc, mattis sed auctor at,
suscipit ut metus. Suspendisse hendrerit, justo sagittis malesuada
molestie, nisi nunc placerat libero, vel vulputate elit tellus et
augue. Phasellus tempor lectus ac nisi aliquam faucibus. Donec feugiat
egestas nibh id mattis. In hac habitasse platea dictumst. Ut accumsan
lorem eget leo dictum viverra.
Quisque egestas lorem sit amet felis tincidunt adipiscing. Aenean
ornare fermentum accumsan. Aenean eu mauris arcu, id pulvinar
quam. Suspendisse nec massa vel augue laoreet ultricies in convallis
dolor. Mauris sodales porta enim, non ultricies dolor luctus
in. Phasellus eu tortor lectus, vel porttitor nulla. Mauris vulputate,
erat id scelerisque lobortis, nibh ipsum tristique elit, ac viverra
arcu sem a ante. Praesent nec metus vestibulum augue eleifend
suscipit. In feugiat, sem nec dignissim consequat, velit tortor
scelerisque metus, sit amet mollis nisl sem eu nibh. Quisque in nibh
turpis. Proin ac nisi ligula, a pretium augue.
In nibh eros, laoreet id interdum vel, sodales sed tortor. Sed
ullamcorper, sem vel mattis consectetur, nibh turpis molestie nisl,
eget lobortis mi magna sed metus. Cras justo est, tempus quis
adipiscing ut, hendrerit convallis sem. Mauris ullamcorper, sapien et
luctus iaculis, urna elit egestas ipsum, et tristique enim risus vitae
nunc. Vivamus aliquet lorem eu urna pulvinar hendrerit malesuada nunc
sollicitudin. Cras in mi rhoncus quam egestas dignissim vel sit amet
lacus. Maecenas interdum viverra laoreet. Quisque elementum
sollicitudin ullamcorper.
Pellentesque mauris sem, malesuada at lobortis in, porta eget
urna. Duis aliquet quam eget risus elementum quis auctor ligula
gravida. Phasellus et ullamcorper libero. Nam elementum ultricies
tellus, in sagittis magna aliquet quis. Ut sit amet tellus id erat
tristique lobortis. Suspendisse est enim, tristique eu convallis id,
rutrum nec lacus. Fusce iaculis diam non felis rutrum lobortis. Proin
hendrerit mi tincidunt dui fermentum placerat.
Examples Command Line Examples
======== =====================
Examples 1 The following examples show how to use `/usr/bin/ansible` for running ad-hoc tasks.
`````````` Start here. For configuration management and deployments, you'll want to pick up on
using `/usr/bin/ansible-playbook` -- the concepts port over directly.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. In dignissim
placerat nibh, non feugiat risus varius vitae. Donec eu libero .. seealso::
lectus. Ut non orci felis, eget mattis mauris. Etiam ut tellus in
magna porta venenatis. Quisque scelerisque, sem non ultrices bibendum, :doc:`modules`
dolor diam rutrum lectus, sed luctus neque neque vitae eros. Vivamus A list of available modules
mattis, ipsum ut bibendum gravida, lectus arcu venenatis elit, vitae :doc:`playbooks`
luctus diam leo sit amet ligula. Nunc egestas justo in nulla sagittis Alternative ways to use ansible
ut suscipit sapien gravida. Morbi id dui nibh. Nullam diam massa,
rhoncus a dignissim non, adipiscing vel arcu. Quisque ultricies
tincidunt purus ut sodales. Quisque scelerisque dapibus purus quis Parallelism and Shell Commands
egestas. Maecenas sagittis porttitor adipiscing. Duis eu magna ``````````````````````````````
sem. Donec arcu felis, faucibus et malesuada non, blandit vitae
metus. Fusce nec sapien dolor. Let's use ansible's command line tool to reboot all web servers in Atlanta, 10 at a time::
ssh-agent bash
Examples 2 ssh-add ~/.ssh/id_rsa.pub
``````````
ansible atlanta -a "/sbin/reboot" -f 10
Aenean ac fermentum nisl. Integer leo sem, rutrum nec dictum at,
pretium quis sapien. Duis felis metus, sodales sit amet gravida in, The -f 10 specifies the usage of 10 simultaneous processes.
pretium ut arcu. Nulla ligula quam, aliquam sit amet sollicitudin
eget, molestie tincidunt ipsum. Nulla leo nunc, mattis sed auctor at, Note that other than the command module, ansible modules do not work like simple scripts. They make the remote system look like you state, and run the commands neccessary to get it there. This is commonly refered to
suscipit ut metus. Suspendisse hendrerit, justo sagittis malesuada as 'idempotency'.
molestie, nisi nunc placerat libero, vel vulputate elit tellus et
augue. Phasellus tempor lectus ac nisi aliquam faucibus. Donec feugiat File Transfer & Templating
egestas nibh id mattis. In hac habitasse platea dictumst. Ut accumsan ``````````````````````````
lorem eget leo dictum viverra.
Ansible can SCP lots of files to multiple machines in parallel, and optionally use them as template sources.
Examples 3
`````````` To just transfer a file directly to many different servers::
Quisque egestas lorem sit amet felis tincidunt adipiscing. Aenean ansible atlanta copy -a "/etc/hosts /tmp/hosts"
ornare fermentum accumsan. Aenean eu mauris arcu, id pulvinar
quam. Suspendisse nec massa vel augue laoreet ultricies in convallis To use templating, first run the setup module to put the template variables you would like to use on the remote host. Then use the template module to write the files using the templates. Templates are written in Jinja2 format. Playbooks (covered elsewhere in the documentation) will run the setup module for you, making this even simpler.::
dolor. Mauris sodales porta enim, non ultricies dolor luctus
in. Phasellus eu tortor lectus, vel porttitor nulla. Mauris vulputate, ansible webservers -m setup -a "favcolor=red ntp_server=192.168.1.1"
erat id scelerisque lobortis, nibh ipsum tristique elit, ac viverra ansible webservers -m template -a "src=/srv/motd.j2 dest=/etc/motd"
arcu sem a ante. Praesent nec metus vestibulum augue eleifend ansible webservers -m template -a "src=/srv/ntp.j2 dest=/etc/ntp.conf"
suscipit. In feugiat, sem nec dignissim consequat, velit tortor
scelerisque metus, sit amet mollis nisl sem eu nibh. Quisque in nibh Need something like the fqdn in a template? If facter or ohai are installed, data from these projects will also be made available to the template engine, using 'facter' and 'ohai' prefixes for each.
turpis. Proin ac nisi ligula, a pretium augue.
Deploying From Source Control
Examples 3 `````````````````````````````
``````````
Deploy your webapp straight from git::
In nibh eros, laoreet id interdum vel, sodales sed tortor. Sed
ullamcorper, sem vel mattis consectetur, nibh turpis molestie nisl, ansible webservers -m git -a "repo=git://foo dest=/srv/myapp version=HEAD"
eget lobortis mi magna sed metus. Cras justo est, tempus quis
adipiscing ut, hendrerit convallis sem. Mauris ullamcorper, sapien et Since ansible modules can notify change handlers (see 'Playbooks') it is possible to tell ansible to run specific tasks when the code is updated, such as deploying Perl/Python/PHP/Ruby directly from git and then restarting apache.
luctus iaculis, urna elit egestas ipsum, et tristique enim risus vitae
nunc. Vivamus aliquet lorem eu urna pulvinar hendrerit malesuada nunc Managing Services
sollicitudin. Cras in mi rhoncus quam egestas dignissim vel sit amet `````````````````
lacus. Maecenas interdum viverra laoreet. Quisque elementum
sollicitudin ullamcorper. Ensure a service is started on all webservers::
Examples 4 ansible webservers -m service name=httpd state=started
``````````
Alternatively, restart a service on all webservers::
Pellentesque mauris sem, malesuada at lobortis in, porta eget
urna. Duis aliquet quam eget risus elementum quis auctor ligula ansible webservers -m service name=httpd state=restarted
gravida. Phasellus et ullamcorper libero. Nam elementum ultricies
tellus, in sagittis magna aliquet quis. Ut sit amet tellus id erat Time Limited Background Operations
tristique lobortis. Suspendisse est enim, tristique eu convallis id, ``````````````````````````````````
rutrum nec lacus. Fusce iaculis diam non felis rutrum lobortis. Proin
hendrerit mi tincidunt dui fermentum placerat. Long running operations can be backgrounded, and their status can be checked on later. The same job ID is given to the same task on all hosts, so you won't lose track. Polling support is pending in the command line.::
ansible all -B 3600 -a "/usr/bin/long_running_operation --do-stuff"
ansible all -n job_status -a jid=123456789
Any module other than 'copy' or 'template' can be backgrounded. Typically you'll be backgrounding shell
commands or software upgrades only.
After the time limit (in seconds) runs out (-B), the process on the remote nodes will be killed.
Getting Started Getting Started
=============== ===============
How to ansible How to download ansible and get started using it
.. seealso:: .. seealso::
:doc:`YAMLScripts` :doc:`examples`
Complete documentation of the YAML syntax `ansible` understands. Examples of basic commands
:doc:`playbooks`
Learning ansible's configuration management language
What you need
------------- Requirements
````````````
Lorem ipsum dolor sit amet, consectetur adipiscing elit. In dignissim
placerat nibh, non feugiat risus varius vitae. Donec eu libero Requirements for Ansible are extremely minimal.
lectus. Ut non orci felis, eget mattis mauris. Etiam ut tellus in
magna porta venenatis. Quisque scelerisque, sem non ultrices bibendum, If you are running python 2.6 on the **overlord** machine (the machine that you'll be talking to the other machines from), you will need:
dolor diam rutrum lectus, sed luctus neque neque vitae eros. Vivamus
mattis, ipsum ut bibendum gravida, lectus arcu venenatis elit, vitae * ``paramiko``
luctus diam leo sit amet ligula. Nunc egestas justo in nulla sagittis * ``PyYAML``
ut suscipit sapien gravida. Morbi id dui nibh. Nullam diam massa, * ``python-jinja2`` (for playbooks)
rhoncus a dignissim non, adipiscing vel arcu. Quisque ultricies
tincidunt purus ut sodales. Quisque scelerisque dapibus purus quis If you are running less than Python 2.6, you will also need:
egestas. Maecenas sagittis porttitor adipiscing. Duis eu magna
sem. Donec arcu felis, faucibus et malesuada non, blandit vitae * The Python 2.4 or 2.5 backport of the ``multiprocessing`` module
metus. Fusce nec sapien dolor.
- `Installation and Testing Instructions <http://code.google.com/p/python-multiprocessing/wiki/Install>`_
Aenean ac fermentum nisl. Integer leo sem, rutrum nec dictum at,
pretium quis sapien. Duis felis metus, sodales sit amet gravida in, * ``simplejson``
pretium ut arcu. Nulla ligula quam, aliquam sit amet sollicitudin
eget, molestie tincidunt ipsum. Nulla leo nunc, mattis sed auctor at, On the managed nodes, to use templating, you will need:
suscipit ut metus. Suspendisse hendrerit, justo sagittis malesuada
molestie, nisi nunc placerat libero, vel vulputate elit tellus et * ``python-jinja2`` (you can install this with ansible)
augue. Phasellus tempor lectus ac nisi aliquam faucibus. Donec feugiat
egestas nibh id mattis. In hac habitasse platea dictumst. Ut accumsan Developer Requirements
lorem eget leo dictum viverra. ``````````````````````
Quisque egestas lorem sit amet felis tincidunt adipiscing. Aenean For developers, you may wish to have:
ornare fermentum accumsan. Aenean eu mauris arcu, id pulvinar
quam. Suspendisse nec massa vel augue laoreet ultricies in convallis * ``asciidoc`` (for building manpage documentation)
dolor. Mauris sodales porta enim, non ultricies dolor luctus * ``python-sphinx`` (for building content for the ansible.github.com project only)
in. Phasellus eu tortor lectus, vel porttitor nulla. Mauris vulputate,
erat id scelerisque lobortis, nibh ipsum tristique elit, ac viverra
arcu sem a ante. Praesent nec metus vestibulum augue eleifend Getting Ansible
suscipit. In feugiat, sem nec dignissim consequat, velit tortor ```````````````
scelerisque metus, sit amet mollis nisl sem eu nibh. Quisque in nibh
turpis. Proin ac nisi ligula, a pretium augue. Tagged releases are available as tar.gz files from the Ansible github
project page:
In nibh eros, laoreet id interdum vel, sodales sed tortor. Sed
ullamcorper, sem vel mattis consectetur, nibh turpis molestie nisl, * `Ansible/downloads <https://github.com/ansible/ansible/downloads>`_
eget lobortis mi magna sed metus. Cras justo est, tempus quis
adipiscing ut, hendrerit convallis sem. Mauris ullamcorper, sapien et You can also clone the git repository yourself and install Ansible in
luctus iaculis, urna elit egestas ipsum, et tristique enim risus vitae one of two ways:
nunc. Vivamus aliquet lorem eu urna pulvinar hendrerit malesuada nunc
sollicitudin. Cras in mi rhoncus quam egestas dignissim vel sit amet
lacus. Maecenas interdum viverra laoreet. Quisque elementum Python Distutils
sollicitudin ullamcorper. ++++++++++++++++
Pellentesque mauris sem, malesuada at lobortis in, porta eget You can also install Ansible using Python Distutils::
urna. Duis aliquet quam eget risus elementum quis auctor ligula
gravida. Phasellus et ullamcorper libero. Nam elementum ultricies $ git clone git://github.com/ansible/ansible.git
tellus, in sagittis magna aliquet quis. Ut sit amet tellus id erat $ cd ./ansible
tristique lobortis. Suspendisse est enim, tristique eu convallis id, $ sudo make install
rutrum nec lacus. Fusce iaculis diam non felis rutrum lobortis. Proin
hendrerit mi tincidunt dui fermentum placerat. Via RPM
+++++++
In the near future, pre-built RPMs will be available through your distribution. Until that time you
can use the ``make rpm`` command::
$ git clone git://github.com/ansible/ansible.git
$ cd ./ansible
$ make rpm
$ sudo rpm -Uvh ~/rpmbuild/RPMS/noarch/ansible-1.0-1.noarch.rpm
Your first commands
```````````````````
Edit /etc/ansible/hosts and put one or more remote systems in it, for which you have your SSH
key in ``authorized_keys``::
192.168.1.50
aserver.example.org
bserver.example.org
Set up SSH agent to avoid retyping passwords::
ssh-agent bash
ssh-add ~/.ssh/id_rsa
Now ping all your nodes::
ansible all -m ping
Now run a live command on all of your nodes::
ansible all /bin/echo hello
Congratulations. You've just contacted your nodes with Ansible. It's now time to read some
of the more real-world examples, and explore what you can do with different modules, as well
as the Ansible playbooks language. Ansible is not just about running commands, but you already
have a working infrastructure!
...@@ -5,102 +5,49 @@ ...@@ -5,102 +5,49 @@
Ansible Ansible
======= =======
Ansible is a extra-simple tool/API for doing 'parallel remote things' Ansible is a radically simple deployment, configuration, and command execution framework.
over SSH -- whether executing commands, running "modules", or Other tools in this space have been too complicated for too long, require too much bootstrapping,
executing larger 'playbooks' that can serve as a configuration and have too much learning curve. Ansible is dead simple and painless to extend. For comparison, Puppet and Chef have about 60k lines of code. Ansible's core is a little over 1000 lines.
management or deployment system.
Ansible isn't just for configuration -- it's also great for Ad-Hoc tasks,
While `Func installation <http://fedorahosted.org/func>`_ which I quickly firing off commands against nodes. Where Ansible excels though, is expressing complex multi-node deployment processes, executing complex sequences of commands on different hosts through "playbooks".
co-wrote, aspired to avoid using SSH and have it's own daemon
infrastructure, Ansible aspires to be quite different and more Extending ansible does not require programming in any particular language -- you can write modules
minimal, but still able to grow more modularly over time. This is as scripts or programs that return simple JSON. It's also trivially easy to just execute
based on talking to a lot of users of various tools and wishing to useful shell commands.
eliminate problems with connectivity and long running daemons, or not
picking tool `X` because they preferred to code in `Y`. Further, Why use Ansible versus something else? (Puppet, Chef, Fabric, Capistrano,
playbooks take things a whole step further, building the config and mCollective, Func, SaltStack, etc?) Ansible will have far less code, it
deployment system I always wanted to build. will be (by extension) more correct, and it will be the easiest thing to hack on and
Why use Ansible versus something else? (Fabric, Capistrano,
mCollective, Func, SaltStack, etc?) It will have far less code, it
will be more correct, and it will be the easiest thing to hack on and
use you'll ever see -- regardless of your favorite language of choice. use you'll ever see -- regardless of your favorite language of choice.
Want to only code plugins in bash or clojure? Ansible doesn't care.
The docs will fit on one page and the source will be blindingly
obvious.
Systems management doesn't have to be complicated. Ansible's docs will remain
short & simple, and the source will be blindingly obvious.
Design Principles
````````````````` Design Goals
````````````
* Dead simple setup * Dead simple setup
* Super fast & parallel by default * Super fast & parallel by default
* No server or client daemons; use existing SSHd * No server or client daemons; use existing SSHd out of the box
* No additional software required on client boxes * No additional software required on client boxes
* Modules can be written in ANY language * Modules can be written in ANY language
* Awesome API for creating very powerful distributed scripts * Awesome API for creating very powerful distributed scripts
* Be usable as non-root * Be very usable as non-root
* Create the easiest config management system to use, ever. * Create the easiest config management system to use, ever.
Communicate and Get Involved
````````````````````````````
Requirements Your ideas and contributions are welcome. We're also happy to help you with questions about Ansible.
````````````
Requirements are extremely minimal.
If you are running python 2.6 on the **overlord** machine, you will
need:
* ``paramiko``
* ``PyYAML``
* ``python-jinja2`` (for playbooks)
* ``Asciidoc`` (for building documentation)
If you are running less than Python 2.6, you will also need:
* The Python 2.4 or 2.5 backport of the ``multiprocessing`` module
- `Installation and Testing Instructions <http://code.google.com/p/python-multiprocessing/wiki/Install>`_
* ``simplejson``
On the managed nodes, to use templating, you will need:
* ``python-jinja2`` (you can install this with ansible)
Getting Ansible
```````````````
Tagged releases are available as tar.gz files from the Ansible github
project page:
* `Ansible/downloads <https://github.com/ansible/ansible/downloads>`_
You can also clone the git repository yourself and install Ansible in * Join the `ansible-project mailing list <http://groups.google.com/group/ansible-project>`_ on Google Groups
one of two ways: * Join `#ansible <irc://irc.freenode.net/#ansible>`_ on the `freenode IRC network <http://freenode.net/>`_
* Visit the `project page <https://github.com/ansible/ansible>`_ on Github
Python Distutils
++++++++++++++++
You can install Ansible using Python Distutils::
$ git clone git://github.com/ansible/ansible.git
$ cd ./ansible
$ sudo make install
Via RPM
+++++++
In the future, pre-built RPMs may be available. Until that time you - View the `issue tracker <https://github.com/ansible/ansible/issues>`_
can use the ``make rpm`` command::
$ git clone git://github.com/ansible/ansible.git
$ cd ./ansible
$ make rpm
$ sudo rpm -Uvh ~/rpmbuild/RPMS/noarch/ansible-1.0-1.noarch.rpm
Contents Contents
======== ========
...@@ -109,21 +56,22 @@ Contents ...@@ -109,21 +56,22 @@ Contents
:maxdepth: 3 :maxdepth: 3
gettingstarted gettingstarted
YAMLScripts
patterns patterns
examples
modules modules
YAMLScripts
playbooks playbooks
examples
api api
communicate
man man
About the Author
````````````````
Communicate or Get Involved Ansible was originally developed by Michael DeHaan, a Raleigh, NC based software developer and architect.
=========================== He created other popular DevOps programs such as Cobbler, the popular Linux install server.
Cobbler is used to deploy mission critical systems all over the planet, in industries
ranging from massively multiplayer gaming, core internet infrastructure, finance,
chip design, and more. Michael also helped co-author of Func, a precursor to Ansible, which is used
to orchestrate systems in lots of diverse places. He's worked on systems software for
IBM, Motorola, Red Hat's Emerging Technologies Group, Puppet Labs, and rPath.
* Join the `ansible-project mailing list <http://groups.google.com/group/ansible-project>`_ on Google Groups
* Join `#ansible <irc://irc.freenode.net/#ansible>`_ on the `freenode IRC network <http://freenode.net/>`_
* Visit the `project page <https://github.com/ansible/ansible>`_ on Github
- View the `issue tracker <https://github.com/ansible/ansible/issues>`_
...@@ -3,19 +3,10 @@ ...@@ -3,19 +3,10 @@
Man Pages Man Pages
========= =========
Ansile ships with a handfull of manpages to help you on your journey. Ansible's manpage lists available command line options.
ansible(1) ansible(1)
---------- ----------
* `View ansible.1 <man/ansible.1.html>`_ * `View ansible.1 <man/ansible.1.html>`_
ansible-modules(5)
------------------
* `View ansible-modules.5 <man/ansible-modules.5.html>`_
ansible-playbook(5)
-------------------
* `View ansible-playbook.5 <man/ansible-playbook.5.html>`_
Modules Ansible Modules
======= ===============
Lorem ipsum dolor sit amet, consectetur adipiscing elit. In dignissim Ansible ships with a number of modules that can be executed directly on remote hosts or through
placerat nibh, non feugiat risus varius vitae. Donec eu libero ansible playbooks.
lectus. Ut non orci felis, eget mattis mauris. Etiam ut tellus in
magna porta venenatis. Quisque scelerisque, sem non ultrices bibendum, .. seealso::
dolor diam rutrum lectus, sed luctus neque neque vitae eros. Vivamus
mattis, ipsum ut bibendum gravida, lectus arcu venenatis elit, vitae :doc:`examples`
luctus diam leo sit amet ligula. Nunc egestas justo in nulla sagittis Examples of using modules in /usr/bin/ansible
ut suscipit sapien gravida. Morbi id dui nibh. Nullam diam massa, :doc:`playbooks`
rhoncus a dignissim non, adipiscing vel arcu. Quisque ultricies Examples of using modules with /usr/bin/ansible-playbook
tincidunt purus ut sodales. Quisque scelerisque dapibus purus quis :doc:`api`
egestas. Maecenas sagittis porttitor adipiscing. Duis eu magna Examples of using modules with the Python API
sem. Donec arcu felis, faucibus et malesuada non, blandit vitae
metus. Fusce nec sapien dolor. Nearly all modules take key=value parameters. Some modules take no parameters, and the command
module just takes arguments for the command you want to run.
Aenean ac fermentum nisl. Integer leo sem, rutrum nec dictum at,
pretium quis sapien. Duis felis metus, sodales sit amet gravida in, All modules return JSON format data, thoug if you are using the command line or playbooks, you
pretium ut arcu. Nulla ligula quam, aliquam sit amet sollicitudin don't really need to know much about that.
eget, molestie tincidunt ipsum. Nulla leo nunc, mattis sed auctor at,
suscipit ut metus. Suspendisse hendrerit, justo sagittis malesuada Most modules other than command are idempotent, meaning they will seek to avoid changes
molestie, nisi nunc placerat libero, vel vulputate elit tellus et unless a change needs to be made. When using ansible playbooks, these modules can
augue. Phasellus tempor lectus ac nisi aliquam faucibus. Donec feugiat trigger change events. Unless otherwise noted, all modules support change hooks.
egestas nibh id mattis. In hac habitasse platea dictumst. Ut accumsan
lorem eget leo dictum viverra. Stock modules:
Quisque egestas lorem sit amet felis tincidunt adipiscing. Aenean command
ornare fermentum accumsan. Aenean eu mauris arcu, id pulvinar ```````
quam. Suspendisse nec massa vel augue laoreet ultricies in convallis
dolor. Mauris sodales porta enim, non ultricies dolor luctus The command module takes the command name followed by a list of arguments, space delimited.
in. Phasellus eu tortor lectus, vel porttitor nulla. Mauris vulputate, This is the only module that does not use key=value style parameters.
erat id scelerisque lobortis, nibh ipsum tristique elit, ac viverra
arcu sem a ante. Praesent nec metus vestibulum augue eleifend Example usage::
suscipit. In feugiat, sem nec dignissim consequat, velit tortor
scelerisque metus, sit amet mollis nisl sem eu nibh. Quisque in nibh /sbin/shutdown -t now
turpis. Proin ac nisi ligula, a pretium augue.
The given shell command will be executed on all selected nodes.
In nibh eros, laoreet id interdum vel, sodales sed tortor. Sed
ullamcorper, sem vel mattis consectetur, nibh turpis molestie nisl, This module does not support change hooks and returns the return code from the program as well as timing information about how long the command was running for.
eget lobortis mi magna sed metus. Cras justo est, tempus quis
adipiscing ut, hendrerit convallis sem. Mauris ullamcorper, sapien et
luctus iaculis, urna elit egestas ipsum, et tristique enim risus vitae copy
nunc. Vivamus aliquet lorem eu urna pulvinar hendrerit malesuada nunc ````
sollicitudin. Cras in mi rhoncus quam egestas dignissim vel sit amet
lacus. Maecenas interdum viverra laoreet. Quisque elementum The copy module moves a file on the local box to remote locations.
sollicitudin ullamcorper.
*src*::
Pellentesque mauris sem, malesuada at lobortis in, porta eget
urna. Duis aliquet quam eget risus elementum quis auctor ligula Local path to a file to copy to the remote server. This can be an absolute or relative path.
gravida. Phasellus et ullamcorper libero. Nam elementum ultricies
tellus, in sagittis magna aliquet quis. Ut sit amet tellus id erat
tristique lobortis. Suspendisse est enim, tristique eu convallis id, *dest*::
rutrum nec lacus. Fusce iaculis diam non felis rutrum lobortis. Proin
hendrerit mi tincidunt dui fermentum placerat. Remote absolute path where the file should end up.
This module also returns md5sum information about the resultant file.
facter
``````
Runs the discovery program 'facter' on the remote system, returning
JSON data that can be useful for inventory purposes.
Requires that 'facter' and 'ruby-json' be installed on the remote end.
This module is informative only - it takes no parameters & does not support change hooks,
nor does it make any changes on the system. Playbooks do not actually use
this module, they use the 'setup' module behind the scenes.
git
```
Deploys software (or files) from git checkouts.
*repo*::
git or http protocol address of the repo to checkout
*dest*::
where to check it out, an absolute directory path
*version*::
what version to check out -- either the git SHA, the literal string 'HEAD', or a tag name
ohai
````
Similar to the facter module, this returns JSON inventory data. Ohai
data is a bit more verbose and nested than facter.
Requires that 'ohai' be installed on the remote end.
This module is information only - it takes no parameters & does not
support change hooks, nor does it make any changes on the system.
Playbooks should not call the ohai module, playbooks call the 'setup'
module behind the scenes instead.
ping
````
A trivial test module, this module always returns the integer '1' on
successful contact.
This module does not support change hooks and is informative only - it takes no parameters & does not
support change hooks, nor does it make any changes on the system.
service
```````
Controls services on remote machines.
*state*
Values are 'started', 'stopped', or 'restarted'. Started/stopped
are idempotent actions that will not run commands unless neccessary.
'restarted' will always bounce the service
*name*
The name of the service
setup
`````
Writes a JSON file containing key/value data, for use in templating.
Call this once before using the template modules. Playbooks will
execute this module automatically as the first step in each play using
the variables section, so it is unneccessary to make explicit calls to
setup within a playbook.
If facter or ohai are installed, variables from these programs will also
be snapshotted into the JSON file for usage in templating. These variables
are prefixed with 'facter_' and 'ohai_" so it's easy to tell their source.
All variables are then bubbled up to the caller.
*anything*
any other parameters can be named basically anything, and set a key=value
pair in the JSON file for use in templating.
template
````````
Templates a file out to a remote server. Call the setup module prior to usage.
*src*
path of a Jinja2 formatted template on the local server. This can be a relative
or absolute path.
*dest*
location to render the template on the remote server
This module also returns md5sum information about the resultant file.
Writing your own modules
````````````````````````
To write your own modules, simply follow the convention of those already available in
/usr/share/ansible. Modules must return JSON but can be written in any language.
Modules should return hashes, but hashes can be nested.
To support change hooks, modules should return hashes with a changed: True/False
element at the top level::
{
'changed' : True,
'something' : 42
}
Modules can also choose to indicate a failure scenario by returning a top level 'failure'
element with a True value, and a 'msg' element describing the nature of the failure.
Other return values are up to the module.
{
'failure' : True,
'msg' : "here is what happened..."
}
When shipping modules, drop them in /usr/share/ansible, or specify the module path to the
command line tool or API. It is easy to test modules by running them directly on
the command line, passing them arguments just like they would be passed with ansible.
Patterns The Inventory File, Patterns, and Groups
======== ========================================
Lorem ipsum dolor sit amet, consectetur adipiscing elit. In dignissim How to select hosts you wish to manage
placerat nibh, non feugiat risus varius vitae. Donec eu libero
lectus. Ut non orci felis, eget mattis mauris. Etiam ut tellus in .. seealso::
magna porta venenatis. Quisque scelerisque, sem non ultrices bibendum,
dolor diam rutrum lectus, sed luctus neque neque vitae eros. Vivamus :doc:`examples`
mattis, ipsum ut bibendum gravida, lectus arcu venenatis elit, vitae Examples of basic commands
luctus diam leo sit amet ligula. Nunc egestas justo in nulla sagittis :doc:`playbooks`
ut suscipit sapien gravida. Morbi id dui nibh. Nullam diam massa, Learning ansible's configuration management language
rhoncus a dignissim non, adipiscing vel arcu. Quisque ultricies
tincidunt purus ut sodales. Quisque scelerisque dapibus purus quis Inventory File Format
egestas. Maecenas sagittis porttitor adipiscing. Duis eu magna +++++++++++++++++++++
sem. Donec arcu felis, faucibus et malesuada non, blandit vitae
metus. Fusce nec sapien dolor. Ansible works against multiple systems in your infrastructure at the
same time. It does this by selecting portions of systems listed in Ansible's inventory file,
Aenean ac fermentum nisl. Integer leo sem, rutrum nec dictum at, which defaults to /etc/ansible/hosts, and looks like this::
pretium quis sapien. Duis felis metus, sodales sit amet gravida in,
pretium ut arcu. Nulla ligula quam, aliquam sit amet sollicitudin mail.example.com
eget, molestie tincidunt ipsum. Nulla leo nunc, mattis sed auctor at,
suscipit ut metus. Suspendisse hendrerit, justo sagittis malesuada [webservers]
molestie, nisi nunc placerat libero, vel vulputate elit tellus et foo.example.com
augue. Phasellus tempor lectus ac nisi aliquam faucibus. Donec feugiat bar.example.com
egestas nibh id mattis. In hac habitasse platea dictumst. Ut accumsan
lorem eget leo dictum viverra. [dbservers]
one.example.com
Quisque egestas lorem sit amet felis tincidunt adipiscing. Aenean two.example.com
ornare fermentum accumsan. Aenean eu mauris arcu, id pulvinar three.example.com
quam. Suspendisse nec massa vel augue laoreet ultricies in convallis
dolor. Mauris sodales porta enim, non ultricies dolor luctus
in. Phasellus eu tortor lectus, vel porttitor nulla. Mauris vulputate, Selecting Targets
erat id scelerisque lobortis, nibh ipsum tristique elit, ac viverra +++++++++++++++++
arcu sem a ante. Praesent nec metus vestibulum augue eleifend
suscipit. In feugiat, sem nec dignissim consequat, velit tortor These patterns target all hosts in the inventory file::
scelerisque metus, sit amet mollis nisl sem eu nibh. Quisque in nibh
turpis. Proin ac nisi ligula, a pretium augue. all
*
In nibh eros, laoreet id interdum vel, sodales sed tortor. Sed
ullamcorper, sem vel mattis consectetur, nibh turpis molestie nisl, It is also possible to address specific hosts::
eget lobortis mi magna sed metus. Cras justo est, tempus quis
adipiscing ut, hendrerit convallis sem. Mauris ullamcorper, sapien et one.example.com
luctus iaculis, urna elit egestas ipsum, et tristique enim risus vitae one.example.com:two.example.com
nunc. Vivamus aliquet lorem eu urna pulvinar hendrerit malesuada nunc
sollicitudin. Cras in mi rhoncus quam egestas dignissim vel sit amet
lacus. Maecenas interdum viverra laoreet. Quisque elementum The following patterns address one or more groups, which are denoted with the bracket
sollicitudin ullamcorper. headers in the inventory file::
Pellentesque mauris sem, malesuada at lobortis in, porta eget webservers
urna. Duis aliquet quam eget risus elementum quis auctor ligula webservers:dbservers
gravida. Phasellus et ullamcorper libero. Nam elementum ultricies
tellus, in sagittis magna aliquet quis. Ut sit amet tellus id erat Individual hosts, but not groups, can also be referenced using wildcards:
tristique lobortis. Suspendisse est enim, tristique eu convallis id,
rutrum nec lacus. Fusce iaculis diam non felis rutrum lobortis. Proin *.example.com
hendrerit mi tincidunt dui fermentum placerat. *.com
It's also ok to mix wildcard patterns and groups at the same time::
one*.com:dbservers
NOTE: It is not possible to target a host not in the inventory file.
...@@ -79,6 +79,14 @@ div.sphinxsidebar input { ...@@ -79,6 +79,14 @@ div.sphinxsidebar input {
font-size: 1em; font-size: 1em;
} }
div.sphinxsidebar input[type="text"] {
width: 170px;
}
div.sphinxsidebar input[type="submit"] {
width: 30px;
}
img { img {
border: 0; border: 0;
} }
...@@ -236,7 +244,6 @@ img.align-center, .figure.align-center, object.align-center { ...@@ -236,7 +244,6 @@ img.align-center, .figure.align-center, object.align-center {
} }
.align-center { .align-center {
clear: both;
text-align: center; text-align: center;
} }
......
...@@ -363,10 +363,13 @@ var Search = { ...@@ -363,10 +363,13 @@ var Search = {
var fullname = (prefix ? prefix + '.' : '') + name; var fullname = (prefix ? prefix + '.' : '') + name;
if (fullname.toLowerCase().indexOf(object) > -1) { if (fullname.toLowerCase().indexOf(object) > -1) {
match = objects[prefix][name]; match = objects[prefix][name];
descr = objnames[match[1]] + _(', in ') + titles[match[0]]; descr = objnames[match[1]][2] + _(', in ') + titles[match[0]];
// XXX the generated anchors are not generally correct anchor = match[3];
// XXX there may be custom prefixes if (anchor == '')
result = [filenames[match[0]], fullname, '#'+fullname, descr]; anchor = fullname;
else if (anchor == '-')
anchor = objnames[match[1]][1] + '-' + fullname;
result = [filenames[match[0]], fullname, '#'+anchor, descr];
switch (match[2]) { switch (match[2]) {
case 1: objectResults.push(result); break; case 1: objectResults.push(result); break;
case 0: importantResults.push(result); break; case 0: importantResults.push(result); break;
...@@ -489,7 +492,7 @@ var Search = { ...@@ -489,7 +492,7 @@ var Search = {
listItem.slideDown(5, function() { listItem.slideDown(5, function() {
displayNextItem(); displayNextItem();
}); });
}); }, "text");
} else { } else {
// no source available, just display title // no source available, just display title
Search.output.append(listItem); Search.output.append(listItem);
......
<!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>Communicate &mdash; Ansible v0.0.1 documentation</title>
<link rel="stylesheet" href="_static/default.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '',
VERSION: '0.0.1',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<link rel="top" title="Ansible v0.0.1 documentation" href="index.html" />
<link rel="next" title="Man Pages" href="man.html" />
<link rel="prev" title="API" href="api.html" />
</head>
<body>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="man.html" title="Man Pages"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="api.html" title="API"
accesskey="P">previous</a> |</li>
<li><a href="index.html">Ansible v0.0.1 documentation</a> &raquo;</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="section" id="communicate">
<h1>Communicate<a class="headerlink" href="#communicate" title="Permalink to this headline"></a></h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. In dignissim
placerat nibh, non feugiat risus varius vitae. Donec eu libero
lectus. Ut non orci felis, eget mattis mauris. Etiam ut tellus in
magna porta venenatis. Quisque scelerisque, sem non ultrices bibendum,
dolor diam rutrum lectus, sed luctus neque neque vitae eros. Vivamus
mattis, ipsum ut bibendum gravida, lectus arcu venenatis elit, vitae
luctus diam leo sit amet ligula. Nunc egestas justo in nulla sagittis
ut suscipit sapien gravida. Morbi id dui nibh. Nullam diam massa,
rhoncus a dignissim non, adipiscing vel arcu. Quisque ultricies
tincidunt purus ut sodales. Quisque scelerisque dapibus purus quis
egestas. Maecenas sagittis porttitor adipiscing. Duis eu magna
sem. Donec arcu felis, faucibus et malesuada non, blandit vitae
metus. Fusce nec sapien dolor.</p>
<p>Aenean ac fermentum nisl. Integer leo sem, rutrum nec dictum at,
pretium quis sapien. Duis felis metus, sodales sit amet gravida in,
pretium ut arcu. Nulla ligula quam, aliquam sit amet sollicitudin
eget, molestie tincidunt ipsum. Nulla leo nunc, mattis sed auctor at,
suscipit ut metus. Suspendisse hendrerit, justo sagittis malesuada
molestie, nisi nunc placerat libero, vel vulputate elit tellus et
augue. Phasellus tempor lectus ac nisi aliquam faucibus. Donec feugiat
egestas nibh id mattis. In hac habitasse platea dictumst. Ut accumsan
lorem eget leo dictum viverra.</p>
<p>Quisque egestas lorem sit amet felis tincidunt adipiscing. Aenean
ornare fermentum accumsan. Aenean eu mauris arcu, id pulvinar
quam. Suspendisse nec massa vel augue laoreet ultricies in convallis
dolor. Mauris sodales porta enim, non ultricies dolor luctus
in. Phasellus eu tortor lectus, vel porttitor nulla. Mauris vulputate,
erat id scelerisque lobortis, nibh ipsum tristique elit, ac viverra
arcu sem a ante. Praesent nec metus vestibulum augue eleifend
suscipit. In feugiat, sem nec dignissim consequat, velit tortor
scelerisque metus, sit amet mollis nisl sem eu nibh. Quisque in nibh
turpis. Proin ac nisi ligula, a pretium augue.</p>
<p>In nibh eros, laoreet id interdum vel, sodales sed tortor. Sed
ullamcorper, sem vel mattis consectetur, nibh turpis molestie nisl,
eget lobortis mi magna sed metus. Cras justo est, tempus quis
adipiscing ut, hendrerit convallis sem. Mauris ullamcorper, sapien et
luctus iaculis, urna elit egestas ipsum, et tristique enim risus vitae
nunc. Vivamus aliquet lorem eu urna pulvinar hendrerit malesuada nunc
sollicitudin. Cras in mi rhoncus quam egestas dignissim vel sit amet
lacus. Maecenas interdum viverra laoreet. Quisque elementum
sollicitudin ullamcorper.</p>
<p>Pellentesque mauris sem, malesuada at lobortis in, porta eget
urna. Duis aliquet quam eget risus elementum quis auctor ligula
gravida. Phasellus et ullamcorper libero. Nam elementum ultricies
tellus, in sagittis magna aliquet quis. Ut sit amet tellus id erat
tristique lobortis. Suspendisse est enim, tristique eu convallis id,
rutrum nec lacus. Fusce iaculis diam non felis rutrum lobortis. Proin
hendrerit mi tincidunt dui fermentum placerat.</p>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<h4>Previous topic</h4>
<p class="topless"><a href="api.html"
title="previous chapter">API</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="man.html"
title="next chapter">Man Pages</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/communicate.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
<h3>Quick search</h3>
<form class="search" action="search.html" method="get">
<input type="text" name="q" size="18" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="man.html" title="Man Pages"
>next</a> |</li>
<li class="right" >
<a href="api.html" title="API"
>previous</a> |</li>
<li><a href="index.html">Ansible v0.0.1 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">
&copy; Copyright 2012 Michael DeHaan.
Last updated on Mar 07, 2012.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.7.
</div>
</body>
</html>
\ No newline at end of file
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
<div id="searchbox" style="display: none"> <div id="searchbox" style="display: none">
<h3>Quick search</h3> <h3>Quick search</h3>
<form class="search" action="search.html" method="get"> <form class="search" action="search.html" method="get">
<input type="text" name="q" size="18" /> <input type="text" name="q" />
<input type="submit" value="Go" /> <input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" /> <input type="hidden" name="area" value="default" />
...@@ -84,8 +84,8 @@ ...@@ -84,8 +84,8 @@
</div> </div>
<div class="footer"> <div class="footer">
&copy; Copyright 2012 Michael DeHaan. &copy; Copyright 2012 Michael DeHaan.
Last updated on Mar 07, 2012. Last updated on Mar 09, 2012.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.7. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.8.
</div> </div>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
<script type="text/javascript" src="_static/underscore.js"></script> <script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script> <script type="text/javascript" src="_static/doctools.js"></script>
<link rel="top" title="Ansible v0.0.1 documentation" href="index.html" /> <link rel="top" title="Ansible v0.0.1 documentation" href="index.html" />
<link rel="prev" title="Communicate" href="communicate.html" /> <link rel="prev" title="Using the Python API" href="api.html" />
</head> </head>
<body> <body>
<div class="related"> <div class="related">
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
<a href="genindex.html" title="General Index" <a href="genindex.html" title="General Index"
accesskey="I">index</a></li> accesskey="I">index</a></li>
<li class="right" > <li class="right" >
<a href="communicate.html" title="Communicate" <a href="api.html" title="Using the Python API"
accesskey="P">previous</a> |</li> accesskey="P">previous</a> |</li>
<li><a href="index.html">Ansible v0.0.1 documentation</a> &raquo;</li> <li><a href="index.html">Ansible v0.0.1 documentation</a> &raquo;</li>
</ul> </ul>
...@@ -46,25 +46,13 @@ ...@@ -46,25 +46,13 @@
<div class="section" id="man-pages"> <div class="section" id="man-pages">
<span id="man"></span><h1>Man Pages<a class="headerlink" href="#man-pages" title="Permalink to this headline"></a></h1> <span id="man"></span><h1>Man Pages<a class="headerlink" href="#man-pages" title="Permalink to this headline"></a></h1>
<p>Ansile ships with a handfull of manpages to help you on your journey.</p> <p>Ansible&#8217;s manpage lists available command line options.</p>
<div class="section" id="ansible-1"> <div class="section" id="ansible-1">
<h2>ansible(1)<a class="headerlink" href="#ansible-1" title="Permalink to this headline"></a></h2> <h2>ansible(1)<a class="headerlink" href="#ansible-1" title="Permalink to this headline"></a></h2>
<ul class="simple"> <ul class="simple">
<li><a class="reference external" href="man/ansible.1.html">View ansible.1</a></li> <li><a class="reference external" href="man/ansible.1.html">View ansible.1</a></li>
</ul> </ul>
</div> </div>
<div class="section" id="ansible-modules-5">
<h2>ansible-modules(5)<a class="headerlink" href="#ansible-modules-5" title="Permalink to this headline"></a></h2>
<ul class="simple">
<li><a class="reference external" href="man/ansible-modules.5.html">View ansible-modules.5</a></li>
</ul>
</div>
<div class="section" id="ansible-playbook-5">
<h2>ansible-playbook(5)<a class="headerlink" href="#ansible-playbook-5" title="Permalink to this headline"></a></h2>
<ul class="simple">
<li><a class="reference external" href="man/ansible-playbook.5.html">View ansible-playbook.5</a></li>
</ul>
</div>
</div> </div>
...@@ -77,15 +65,13 @@ ...@@ -77,15 +65,13 @@
<ul> <ul>
<li><a class="reference internal" href="#">Man Pages</a><ul> <li><a class="reference internal" href="#">Man Pages</a><ul>
<li><a class="reference internal" href="#ansible-1">ansible(1)</a></li> <li><a class="reference internal" href="#ansible-1">ansible(1)</a></li>
<li><a class="reference internal" href="#ansible-modules-5">ansible-modules(5)</a></li>
<li><a class="reference internal" href="#ansible-playbook-5">ansible-playbook(5)</a></li>
</ul> </ul>
</li> </li>
</ul> </ul>
<h4>Previous topic</h4> <h4>Previous topic</h4>
<p class="topless"><a href="communicate.html" <p class="topless"><a href="api.html"
title="previous chapter">Communicate</a></p> title="previous chapter">Using the Python API</a></p>
<h3>This Page</h3> <h3>This Page</h3>
<ul class="this-page-menu"> <ul class="this-page-menu">
<li><a href="_sources/man.txt" <li><a href="_sources/man.txt"
...@@ -94,7 +80,7 @@ ...@@ -94,7 +80,7 @@
<div id="searchbox" style="display: none"> <div id="searchbox" style="display: none">
<h3>Quick search</h3> <h3>Quick search</h3>
<form class="search" action="search.html" method="get"> <form class="search" action="search.html" method="get">
<input type="text" name="q" size="18" /> <input type="text" name="q" />
<input type="submit" value="Go" /> <input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" /> <input type="hidden" name="area" value="default" />
...@@ -115,15 +101,15 @@ ...@@ -115,15 +101,15 @@
<a href="genindex.html" title="General Index" <a href="genindex.html" title="General Index"
>index</a></li> >index</a></li>
<li class="right" > <li class="right" >
<a href="communicate.html" title="Communicate" <a href="api.html" title="Using the Python API"
>previous</a> |</li> >previous</a> |</li>
<li><a href="index.html">Ansible v0.0.1 documentation</a> &raquo;</li> <li><a href="index.html">Ansible v0.0.1 documentation</a> &raquo;</li>
</ul> </ul>
</div> </div>
<div class="footer"> <div class="footer">
&copy; Copyright 2012 Michael DeHaan. &copy; Copyright 2012 Michael DeHaan.
Last updated on Mar 07, 2012. Last updated on Mar 09, 2012.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.7. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.8.
</div> </div>
</body> </body>
</html> </html>
\ No newline at end of file
<?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-modules</title><link rel="stylesheet" type="text/css" href="./docbook-xsl.css" /><meta name="generator" content="DocBook XSL Stylesheets V1.76.1" /></head><body><div xml:lang="en" class="refentry" title="ansible-modules" lang="en"><a id="id327073"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>ansible-modules — stock modules shipped with ansible</p></div><div class="refsect1" title="DESCRIPTION"><a id="_description"></a><h2>DESCRIPTION</h2><p>Ansible ships with a number of modules that can be executed directly on remote hosts or through <html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>ansible-modules</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-modules" lang="en"><a id="id373277"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>ansible-modules — stock modules shipped with ansible</p></div><div class="refsect1" title="DESCRIPTION"><a id="_description"></a><h2>DESCRIPTION</h2><p>Ansible ships with a number of modules that can be executed directly on remote hosts or through
ansible playbooks.</p></div><div class="refsect1" title="IDEMPOTENCE"><a id="_idempotence"></a><h2>IDEMPOTENCE</h2><p>Most modules other than command are idempotent, meaning they will seek to avoid changes ansible playbooks.</p></div><div class="refsect1" title="IDEMPOTENCE"><a id="_idempotence"></a><h2>IDEMPOTENCE</h2><p>Most modules other than command are idempotent, meaning they will seek to avoid changes
unless a change needs to be made. When using ansible playbooks, these modules can unless a change needs to be made. When using ansible playbooks, these modules can
trigger change events, as described in <span class="strong"><strong>ansible-playbooks</strong></span>(5).</p><p>Unless otherwise noted, all modules support change hooks.</p></div><div class="refsect1" title="command"><a id="_command"></a><h2>command</h2><p>The command module takes the command name followed by a list of arguments, space delimited. trigger change events, as described in <span class="strong"><strong>ansible-playbooks</strong></span>(5).</p><p>Unless otherwise noted, all modules support change hooks.</p></div><div class="refsect1" title="command"><a id="_command"></a><h2>command</h2><p>The command module takes the command name followed by a list of arguments, space delimited.
......
<?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-modules</title><link rel="stylesheet" type="text/css" href="./docbook-xsl.css" /><meta name="generator" content="DocBook XSL Stylesheets V1.76.1" /></head><body><div xml:lang="en" class="refentry" title="ansible-modules" lang="en"><a id="id458930"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>ansible-playbook — format and function of an ansible playbook file</p></div><div class="refsect1" title="DESCRIPTION"><a id="_description"></a><h2>DESCRIPTION</h2><p>Ansible ships with <span class="emphasis"><em>ansible-playbook</em></span>, a tool for running playbooks. <html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>ansible-modules</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-modules" lang="en"><a id="id303952"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>ansible-playbook — format and function of an ansible playbook file</p></div><div class="refsect1" title="DESCRIPTION"><a id="_description"></a><h2>DESCRIPTION</h2><p>Ansible ships with <span class="emphasis"><em>ansible-playbook</em></span>, a tool for running playbooks.
Playbooks can represent frequent tasks, desired system configurations, Playbooks can represent frequent tasks, desired system configurations,
or deployment processes.</p></div><div class="refsect1" title="FORMAT"><a id="_format"></a><h2>FORMAT</h2><p>Playbooks are written in YAML.</p></div><div class="refsect1" title="EXAMPLE"><a id="_example"></a><h2>EXAMPLE</h2><p>See:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"> or deployment processes.</p></div><div class="refsect1" title="FORMAT"><a id="_format"></a><h2>FORMAT</h2><p>Playbooks are written in YAML.</p></div><div class="refsect1" title="EXAMPLE"><a id="_example"></a><h2>EXAMPLE</h2><p>See:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
<a class="ulink" href="https://github.com/mpdehaan/ansible/blob/master/examples/playbook.yml" target="_top">https://github.com/mpdehaan/ansible/blob/master/examples/playbook.yml</a> <a class="ulink" href="https://github.com/mpdehaan/ansible/blob/master/examples/playbook.yml" target="_top">https://github.com/mpdehaan/ansible/blob/master/examples/playbook.yml</a>
......
<?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" type="text/css" href="./docbook-xsl.css" /><meta name="generator" content="DocBook XSL Stylesheets V1.76.1" /></head><body><div xml:lang="en" class="refentry" title="ansible" lang="en"><a id="id355813"></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 &lt;host-pattern&gt; [-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="id547970"></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 &lt;host-pattern&gt; [-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>
......
...@@ -90,8 +90,8 @@ ...@@ -90,8 +90,8 @@
</div> </div>
<div class="footer"> <div class="footer">
&copy; Copyright 2012 Michael DeHaan. &copy; Copyright 2012 Michael DeHaan.
Last updated on Mar 07, 2012. Last updated on Mar 09, 2012.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.7. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.8.
</div> </div>
</body> </body>
</html> </html>
\ No newline at end of file
YAML Scripts YAML Format
============ ===========
This page provides a basic overview of correct YAML syntax.
This page provides a basic overview of correct YAML syntax, which is how Ansible
playbooks (our configuration management language) are expressed.
You may also wish to read playbook examples and will quickly pick this up from those.
YAML Basics YAML Basics
----------- -----------
For `ansible`, every YAML script must be a list at it's root-most For `ansible`, every YAML file must be a list at it's root-most
element. Each item in the list is a dictionary. These dictionaries element. Each item in the list is a dictionary. These dictionaries
represent all the options you can use to write a `ansible` script. In represent all the options you can use to write an `ansible` file. In
addition, all YAML files (regardless of their association with addition, all YAML files (regardless of their association with
`ansible` or not) should start with ``---``. `ansible` or not) should start with ``---``.
In YAML a list can be represented in two ways. In one way all members In YAML a list can be represented in two ways. In one way all members
of a list are lines beginning at the same indentation level starting of a list are lines beginning at the same indenta`tion level starting
with a ``-`` character:: with a ``-`` character::
--- ---
...@@ -74,7 +75,7 @@ Finally, you can combine these data structures:: ...@@ -74,7 +75,7 @@ Finally, you can combine these data structures::
dotnet: Lame dotnet: Lame
That's all you really need to know about YAML to get started writing That's all you really need to know about YAML to get started writing
`Ansible` scripts. `Ansible` playbooks.
.. seealso:: .. seealso::
......
API Using the Python API
=== ====================
Lorem ipsum dolor sit amet, consectetur adipiscing elit. In dignissim The Python API is very powerful, and is how the ansible CLI and ansible-playbook
placerat nibh, non feugiat risus varius vitae. Donec eu libero are implemented.
lectus. Ut non orci felis, eget mattis mauris. Etiam ut tellus in
magna porta venenatis. Quisque scelerisque, sem non ultrices bibendum, It's pretty simple::
dolor diam rutrum lectus, sed luctus neque neque vitae eros. Vivamus
mattis, ipsum ut bibendum gravida, lectus arcu venenatis elit, vitae import ansible.runner
luctus diam leo sit amet ligula. Nunc egestas justo in nulla sagittis
ut suscipit sapien gravida. Morbi id dui nibh. Nullam diam massa, runner = ansible.runner.Runner(
rhoncus a dignissim non, adipiscing vel arcu. Quisque ultricies module_name='ping',
tincidunt purus ut sodales. Quisque scelerisque dapibus purus quis module_args='',
egestas. Maecenas sagittis porttitor adipiscing. Duis eu magna pattern='web*',
sem. Donec arcu felis, faucibus et malesuada non, blandit vitae forks=10
metus. Fusce nec sapien dolor. )
datastructure = runner.run()
Aenean ac fermentum nisl. Integer leo sem, rutrum nec dictum at,
pretium quis sapien. Duis felis metus, sodales sit amet gravida in, The run method returns results per host, grouped by whether they
pretium ut arcu. Nulla ligula quam, aliquam sit amet sollicitudin could be contacted or not. Return types are module specific, as
eget, molestie tincidunt ipsum. Nulla leo nunc, mattis sed auctor at, expressed in the 'ansible-modules' documentation.::
suscipit ut metus. Suspendisse hendrerit, justo sagittis malesuada
molestie, nisi nunc placerat libero, vel vulputate elit tellus et {
augue. Phasellus tempor lectus ac nisi aliquam faucibus. Donec feugiat "dark" : {
egestas nibh id mattis. In hac habitasse platea dictumst. Ut accumsan "web1.example.com" : "failure message"
lorem eget leo dictum viverra. }
"contacted" : {
Quisque egestas lorem sit amet felis tincidunt adipiscing. Aenean "web2.example.com" : 1
ornare fermentum accumsan. Aenean eu mauris arcu, id pulvinar }
quam. Suspendisse nec massa vel augue laoreet ultricies in convallis }
dolor. Mauris sodales porta enim, non ultricies dolor luctus
in. Phasellus eu tortor lectus, vel porttitor nulla. Mauris vulputate, A module can return any type of JSON data it wants, so Ansible can
erat id scelerisque lobortis, nibh ipsum tristique elit, ac viverra be used as a framework to rapidly build powerful applications and scripts.
arcu sem a ante. Praesent nec metus vestibulum augue eleifend
suscipit. In feugiat, sem nec dignissim consequat, velit tortor Detailed API Example
scelerisque metus, sit amet mollis nisl sem eu nibh. Quisque in nibh ````````````````````
turpis. Proin ac nisi ligula, a pretium augue.
The following script prints out the uptime information for all hosts::
In nibh eros, laoreet id interdum vel, sodales sed tortor. Sed
ullamcorper, sem vel mattis consectetur, nibh turpis molestie nisl, #!/usr/bin/python
eget lobortis mi magna sed metus. Cras justo est, tempus quis
adipiscing ut, hendrerit convallis sem. Mauris ullamcorper, sapien et import ansible.runner
luctus iaculis, urna elit egestas ipsum, et tristique enim risus vitae import sys
nunc. Vivamus aliquet lorem eu urna pulvinar hendrerit malesuada nunc
sollicitudin. Cras in mi rhoncus quam egestas dignissim vel sit amet # construct the ansible runner and execute on all hosts
lacus. Maecenas interdum viverra laoreet. Quisque elementum results = ansible.runner.Runner(
sollicitudin ullamcorper. pattern='*', forks=10,
module_name='command', module_args=['/usr/bin/uptime'],
Pellentesque mauris sem, malesuada at lobortis in, porta eget ).run()
urna. Duis aliquet quam eget risus elementum quis auctor ligula
gravida. Phasellus et ullamcorper libero. Nam elementum ultricies if results is None:
tellus, in sagittis magna aliquet quis. Ut sit amet tellus id erat print "No hosts found"
tristique lobortis. Suspendisse est enim, tristique eu convallis id, sys.exit(1)
rutrum nec lacus. Fusce iaculis diam non felis rutrum lobortis. Proin
hendrerit mi tincidunt dui fermentum placerat. print "UP ***********"
for (hostname, result) in results['contacted'].items():
if not 'failed' in result:
print "%s >>> %s" % (hostname, result['stdout'])
print "FAILED *******"
for (hostname, result) in results['contacted'].items():
if 'failed' in result:
print "%s >>> %s" % (hostname, result['msg'])
print "DOWN *********"
for (hostname, result) in results['dark'].items():
print "%s >>> %s" % (hostname, result)
Advanced programmers may also wish to read the source to ansible itself, for
it uses the Runner() API (with all available options) to implement the
command line tools ``ansible`` and ``ansible-playbook``.
Communicate
===========
Lorem ipsum dolor sit amet, consectetur adipiscing elit. In dignissim
placerat nibh, non feugiat risus varius vitae. Donec eu libero
lectus. Ut non orci felis, eget mattis mauris. Etiam ut tellus in
magna porta venenatis. Quisque scelerisque, sem non ultrices bibendum,
dolor diam rutrum lectus, sed luctus neque neque vitae eros. Vivamus
mattis, ipsum ut bibendum gravida, lectus arcu venenatis elit, vitae
luctus diam leo sit amet ligula. Nunc egestas justo in nulla sagittis
ut suscipit sapien gravida. Morbi id dui nibh. Nullam diam massa,
rhoncus a dignissim non, adipiscing vel arcu. Quisque ultricies
tincidunt purus ut sodales. Quisque scelerisque dapibus purus quis
egestas. Maecenas sagittis porttitor adipiscing. Duis eu magna
sem. Donec arcu felis, faucibus et malesuada non, blandit vitae
metus. Fusce nec sapien dolor.
Aenean ac fermentum nisl. Integer leo sem, rutrum nec dictum at,
pretium quis sapien. Duis felis metus, sodales sit amet gravida in,
pretium ut arcu. Nulla ligula quam, aliquam sit amet sollicitudin
eget, molestie tincidunt ipsum. Nulla leo nunc, mattis sed auctor at,
suscipit ut metus. Suspendisse hendrerit, justo sagittis malesuada
molestie, nisi nunc placerat libero, vel vulputate elit tellus et
augue. Phasellus tempor lectus ac nisi aliquam faucibus. Donec feugiat
egestas nibh id mattis. In hac habitasse platea dictumst. Ut accumsan
lorem eget leo dictum viverra.
Quisque egestas lorem sit amet felis tincidunt adipiscing. Aenean
ornare fermentum accumsan. Aenean eu mauris arcu, id pulvinar
quam. Suspendisse nec massa vel augue laoreet ultricies in convallis
dolor. Mauris sodales porta enim, non ultricies dolor luctus
in. Phasellus eu tortor lectus, vel porttitor nulla. Mauris vulputate,
erat id scelerisque lobortis, nibh ipsum tristique elit, ac viverra
arcu sem a ante. Praesent nec metus vestibulum augue eleifend
suscipit. In feugiat, sem nec dignissim consequat, velit tortor
scelerisque metus, sit amet mollis nisl sem eu nibh. Quisque in nibh
turpis. Proin ac nisi ligula, a pretium augue.
In nibh eros, laoreet id interdum vel, sodales sed tortor. Sed
ullamcorper, sem vel mattis consectetur, nibh turpis molestie nisl,
eget lobortis mi magna sed metus. Cras justo est, tempus quis
adipiscing ut, hendrerit convallis sem. Mauris ullamcorper, sapien et
luctus iaculis, urna elit egestas ipsum, et tristique enim risus vitae
nunc. Vivamus aliquet lorem eu urna pulvinar hendrerit malesuada nunc
sollicitudin. Cras in mi rhoncus quam egestas dignissim vel sit amet
lacus. Maecenas interdum viverra laoreet. Quisque elementum
sollicitudin ullamcorper.
Pellentesque mauris sem, malesuada at lobortis in, porta eget
urna. Duis aliquet quam eget risus elementum quis auctor ligula
gravida. Phasellus et ullamcorper libero. Nam elementum ultricies
tellus, in sagittis magna aliquet quis. Ut sit amet tellus id erat
tristique lobortis. Suspendisse est enim, tristique eu convallis id,
rutrum nec lacus. Fusce iaculis diam non felis rutrum lobortis. Proin
hendrerit mi tincidunt dui fermentum placerat.
Examples Command Line Examples
======== =====================
Examples 1 The following examples show how to use `/usr/bin/ansible` for running ad-hoc tasks.
`````````` Start here. For configuration management and deployments, you'll want to pick up on
using `/usr/bin/ansible-playbook` -- the concepts port over directly.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. In dignissim
placerat nibh, non feugiat risus varius vitae. Donec eu libero .. seealso::
lectus. Ut non orci felis, eget mattis mauris. Etiam ut tellus in
magna porta venenatis. Quisque scelerisque, sem non ultrices bibendum, :doc:`modules`
dolor diam rutrum lectus, sed luctus neque neque vitae eros. Vivamus A list of available modules
mattis, ipsum ut bibendum gravida, lectus arcu venenatis elit, vitae :doc:`playbooks`
luctus diam leo sit amet ligula. Nunc egestas justo in nulla sagittis Alternative ways to use ansible
ut suscipit sapien gravida. Morbi id dui nibh. Nullam diam massa,
rhoncus a dignissim non, adipiscing vel arcu. Quisque ultricies
tincidunt purus ut sodales. Quisque scelerisque dapibus purus quis Parallelism and Shell Commands
egestas. Maecenas sagittis porttitor adipiscing. Duis eu magna ``````````````````````````````
sem. Donec arcu felis, faucibus et malesuada non, blandit vitae
metus. Fusce nec sapien dolor. Let's use ansible's command line tool to reboot all web servers in Atlanta, 10 at a time::
ssh-agent bash
Examples 2 ssh-add ~/.ssh/id_rsa.pub
``````````
ansible atlanta -a "/sbin/reboot" -f 10
Aenean ac fermentum nisl. Integer leo sem, rutrum nec dictum at,
pretium quis sapien. Duis felis metus, sodales sit amet gravida in, The -f 10 specifies the usage of 10 simultaneous processes.
pretium ut arcu. Nulla ligula quam, aliquam sit amet sollicitudin
eget, molestie tincidunt ipsum. Nulla leo nunc, mattis sed auctor at, Note that other than the command module, ansible modules do not work like simple scripts. They make the remote system look like you state, and run the commands neccessary to get it there. This is commonly refered to
suscipit ut metus. Suspendisse hendrerit, justo sagittis malesuada as 'idempotency'.
molestie, nisi nunc placerat libero, vel vulputate elit tellus et
augue. Phasellus tempor lectus ac nisi aliquam faucibus. Donec feugiat File Transfer & Templating
egestas nibh id mattis. In hac habitasse platea dictumst. Ut accumsan ``````````````````````````
lorem eget leo dictum viverra.
Ansible can SCP lots of files to multiple machines in parallel, and optionally use them as template sources.
Examples 3
`````````` To just transfer a file directly to many different servers::
Quisque egestas lorem sit amet felis tincidunt adipiscing. Aenean ansible atlanta copy -a "/etc/hosts /tmp/hosts"
ornare fermentum accumsan. Aenean eu mauris arcu, id pulvinar
quam. Suspendisse nec massa vel augue laoreet ultricies in convallis To use templating, first run the setup module to put the template variables you would like to use on the remote host. Then use the template module to write the files using the templates. Templates are written in Jinja2 format. Playbooks (covered elsewhere in the documentation) will run the setup module for you, making this even simpler.::
dolor. Mauris sodales porta enim, non ultricies dolor luctus
in. Phasellus eu tortor lectus, vel porttitor nulla. Mauris vulputate, ansible webservers -m setup -a "favcolor=red ntp_server=192.168.1.1"
erat id scelerisque lobortis, nibh ipsum tristique elit, ac viverra ansible webservers -m template -a "src=/srv/motd.j2 dest=/etc/motd"
arcu sem a ante. Praesent nec metus vestibulum augue eleifend ansible webservers -m template -a "src=/srv/ntp.j2 dest=/etc/ntp.conf"
suscipit. In feugiat, sem nec dignissim consequat, velit tortor
scelerisque metus, sit amet mollis nisl sem eu nibh. Quisque in nibh Need something like the fqdn in a template? If facter or ohai are installed, data from these projects will also be made available to the template engine, using 'facter' and 'ohai' prefixes for each.
turpis. Proin ac nisi ligula, a pretium augue.
Deploying From Source Control
Examples 3 `````````````````````````````
``````````
Deploy your webapp straight from git::
In nibh eros, laoreet id interdum vel, sodales sed tortor. Sed
ullamcorper, sem vel mattis consectetur, nibh turpis molestie nisl, ansible webservers -m git -a "repo=git://foo dest=/srv/myapp version=HEAD"
eget lobortis mi magna sed metus. Cras justo est, tempus quis
adipiscing ut, hendrerit convallis sem. Mauris ullamcorper, sapien et Since ansible modules can notify change handlers (see 'Playbooks') it is possible to tell ansible to run specific tasks when the code is updated, such as deploying Perl/Python/PHP/Ruby directly from git and then restarting apache.
luctus iaculis, urna elit egestas ipsum, et tristique enim risus vitae
nunc. Vivamus aliquet lorem eu urna pulvinar hendrerit malesuada nunc Managing Services
sollicitudin. Cras in mi rhoncus quam egestas dignissim vel sit amet `````````````````
lacus. Maecenas interdum viverra laoreet. Quisque elementum
sollicitudin ullamcorper. Ensure a service is started on all webservers::
Examples 4 ansible webservers -m service name=httpd state=started
``````````
Alternatively, restart a service on all webservers::
Pellentesque mauris sem, malesuada at lobortis in, porta eget
urna. Duis aliquet quam eget risus elementum quis auctor ligula ansible webservers -m service name=httpd state=restarted
gravida. Phasellus et ullamcorper libero. Nam elementum ultricies
tellus, in sagittis magna aliquet quis. Ut sit amet tellus id erat Time Limited Background Operations
tristique lobortis. Suspendisse est enim, tristique eu convallis id, ``````````````````````````````````
rutrum nec lacus. Fusce iaculis diam non felis rutrum lobortis. Proin
hendrerit mi tincidunt dui fermentum placerat. Long running operations can be backgrounded, and their status can be checked on later. The same job ID is given to the same task on all hosts, so you won't lose track. Polling support is pending in the command line.::
ansible all -B 3600 -a "/usr/bin/long_running_operation --do-stuff"
ansible all -n job_status -a jid=123456789
Any module other than 'copy' or 'template' can be backgrounded. Typically you'll be backgrounding shell
commands or software upgrades only.
After the time limit (in seconds) runs out (-B), the process on the remote nodes will be killed.
Getting Started Getting Started
=============== ===============
How to ansible How to download ansible and get started using it
.. seealso:: .. seealso::
:doc:`YAMLScripts` :doc:`examples`
Complete documentation of the YAML syntax `ansible` understands. Examples of basic commands
:doc:`playbooks`
Learning ansible's configuration management language
What you need
------------- Requirements
````````````
Lorem ipsum dolor sit amet, consectetur adipiscing elit. In dignissim
placerat nibh, non feugiat risus varius vitae. Donec eu libero Requirements for Ansible are extremely minimal.
lectus. Ut non orci felis, eget mattis mauris. Etiam ut tellus in
magna porta venenatis. Quisque scelerisque, sem non ultrices bibendum, If you are running python 2.6 on the **overlord** machine (the machine that you'll be talking to the other machines from), you will need:
dolor diam rutrum lectus, sed luctus neque neque vitae eros. Vivamus
mattis, ipsum ut bibendum gravida, lectus arcu venenatis elit, vitae * ``paramiko``
luctus diam leo sit amet ligula. Nunc egestas justo in nulla sagittis * ``PyYAML``
ut suscipit sapien gravida. Morbi id dui nibh. Nullam diam massa, * ``python-jinja2`` (for playbooks)
rhoncus a dignissim non, adipiscing vel arcu. Quisque ultricies
tincidunt purus ut sodales. Quisque scelerisque dapibus purus quis If you are running less than Python 2.6, you will also need:
egestas. Maecenas sagittis porttitor adipiscing. Duis eu magna
sem. Donec arcu felis, faucibus et malesuada non, blandit vitae * The Python 2.4 or 2.5 backport of the ``multiprocessing`` module
metus. Fusce nec sapien dolor.
- `Installation and Testing Instructions <http://code.google.com/p/python-multiprocessing/wiki/Install>`_
Aenean ac fermentum nisl. Integer leo sem, rutrum nec dictum at,
pretium quis sapien. Duis felis metus, sodales sit amet gravida in, * ``simplejson``
pretium ut arcu. Nulla ligula quam, aliquam sit amet sollicitudin
eget, molestie tincidunt ipsum. Nulla leo nunc, mattis sed auctor at, On the managed nodes, to use templating, you will need:
suscipit ut metus. Suspendisse hendrerit, justo sagittis malesuada
molestie, nisi nunc placerat libero, vel vulputate elit tellus et * ``python-jinja2`` (you can install this with ansible)
augue. Phasellus tempor lectus ac nisi aliquam faucibus. Donec feugiat
egestas nibh id mattis. In hac habitasse platea dictumst. Ut accumsan Developer Requirements
lorem eget leo dictum viverra. ``````````````````````
Quisque egestas lorem sit amet felis tincidunt adipiscing. Aenean For developers, you may wish to have:
ornare fermentum accumsan. Aenean eu mauris arcu, id pulvinar
quam. Suspendisse nec massa vel augue laoreet ultricies in convallis * ``asciidoc`` (for building manpage documentation)
dolor. Mauris sodales porta enim, non ultricies dolor luctus * ``python-sphinx`` (for building content for the ansible.github.com project only)
in. Phasellus eu tortor lectus, vel porttitor nulla. Mauris vulputate,
erat id scelerisque lobortis, nibh ipsum tristique elit, ac viverra
arcu sem a ante. Praesent nec metus vestibulum augue eleifend Getting Ansible
suscipit. In feugiat, sem nec dignissim consequat, velit tortor ```````````````
scelerisque metus, sit amet mollis nisl sem eu nibh. Quisque in nibh
turpis. Proin ac nisi ligula, a pretium augue. Tagged releases are available as tar.gz files from the Ansible github
project page:
In nibh eros, laoreet id interdum vel, sodales sed tortor. Sed
ullamcorper, sem vel mattis consectetur, nibh turpis molestie nisl, * `Ansible/downloads <https://github.com/ansible/ansible/downloads>`_
eget lobortis mi magna sed metus. Cras justo est, tempus quis
adipiscing ut, hendrerit convallis sem. Mauris ullamcorper, sapien et You can also clone the git repository yourself and install Ansible in
luctus iaculis, urna elit egestas ipsum, et tristique enim risus vitae one of two ways:
nunc. Vivamus aliquet lorem eu urna pulvinar hendrerit malesuada nunc
sollicitudin. Cras in mi rhoncus quam egestas dignissim vel sit amet
lacus. Maecenas interdum viverra laoreet. Quisque elementum Python Distutils
sollicitudin ullamcorper. ++++++++++++++++
Pellentesque mauris sem, malesuada at lobortis in, porta eget You can also install Ansible using Python Distutils::
urna. Duis aliquet quam eget risus elementum quis auctor ligula
gravida. Phasellus et ullamcorper libero. Nam elementum ultricies $ git clone git://github.com/ansible/ansible.git
tellus, in sagittis magna aliquet quis. Ut sit amet tellus id erat $ cd ./ansible
tristique lobortis. Suspendisse est enim, tristique eu convallis id, $ sudo make install
rutrum nec lacus. Fusce iaculis diam non felis rutrum lobortis. Proin
hendrerit mi tincidunt dui fermentum placerat. Via RPM
+++++++
In the near future, pre-built RPMs will be available through your distribution. Until that time you
can use the ``make rpm`` command::
$ git clone git://github.com/ansible/ansible.git
$ cd ./ansible
$ make rpm
$ sudo rpm -Uvh ~/rpmbuild/RPMS/noarch/ansible-1.0-1.noarch.rpm
Your first commands
```````````````````
Edit /etc/ansible/hosts and put one or more remote systems in it, for which you have your SSH
key in ``authorized_keys``::
192.168.1.50
aserver.example.org
bserver.example.org
Set up SSH agent to avoid retyping passwords::
ssh-agent bash
ssh-add ~/.ssh/id_rsa
Now ping all your nodes::
ansible all -m ping
Now run a live command on all of your nodes::
ansible all /bin/echo hello
Congratulations. You've just contacted your nodes with Ansible. It's now time to read some
of the more real-world examples, and explore what you can do with different modules, as well
as the Ansible playbooks language. Ansible is not just about running commands, but you already
have a working infrastructure!
...@@ -5,102 +5,49 @@ ...@@ -5,102 +5,49 @@
Ansible Ansible
======= =======
Ansible is a extra-simple tool/API for doing 'parallel remote things' Ansible is a radically simple deployment, configuration, and command execution framework.
over SSH -- whether executing commands, running "modules", or Other tools in this space have been too complicated for too long, require too much bootstrapping,
executing larger 'playbooks' that can serve as a configuration and have too much learning curve. Ansible is dead simple and painless to extend. For comparison, Puppet and Chef have about 60k lines of code. Ansible's core is a little over 1000 lines.
management or deployment system.
Ansible isn't just for configuration -- it's also great for Ad-Hoc tasks,
While `Func installation <http://fedorahosted.org/func>`_ which I quickly firing off commands against nodes. Where Ansible excels though, is expressing complex multi-node deployment processes, executing complex sequences of commands on different hosts through "playbooks".
co-wrote, aspired to avoid using SSH and have it's own daemon
infrastructure, Ansible aspires to be quite different and more Extending ansible does not require programming in any particular language -- you can write modules
minimal, but still able to grow more modularly over time. This is as scripts or programs that return simple JSON. It's also trivially easy to just execute
based on talking to a lot of users of various tools and wishing to useful shell commands.
eliminate problems with connectivity and long running daemons, or not
picking tool `X` because they preferred to code in `Y`. Further, Why use Ansible versus something else? (Puppet, Chef, Fabric, Capistrano,
playbooks take things a whole step further, building the config and mCollective, Func, SaltStack, etc?) Ansible will have far less code, it
deployment system I always wanted to build. will be (by extension) more correct, and it will be the easiest thing to hack on and
Why use Ansible versus something else? (Fabric, Capistrano,
mCollective, Func, SaltStack, etc?) It will have far less code, it
will be more correct, and it will be the easiest thing to hack on and
use you'll ever see -- regardless of your favorite language of choice. use you'll ever see -- regardless of your favorite language of choice.
Want to only code plugins in bash or clojure? Ansible doesn't care.
The docs will fit on one page and the source will be blindingly
obvious.
Systems management doesn't have to be complicated. Ansible's docs will remain
short & simple, and the source will be blindingly obvious.
Design Principles
````````````````` Design Goals
````````````
* Dead simple setup * Dead simple setup
* Super fast & parallel by default * Super fast & parallel by default
* No server or client daemons; use existing SSHd * No server or client daemons; use existing SSHd out of the box
* No additional software required on client boxes * No additional software required on client boxes
* Modules can be written in ANY language * Modules can be written in ANY language
* Awesome API for creating very powerful distributed scripts * Awesome API for creating very powerful distributed scripts
* Be usable as non-root * Be very usable as non-root
* Create the easiest config management system to use, ever. * Create the easiest config management system to use, ever.
Communicate and Get Involved
````````````````````````````
Requirements Your ideas and contributions are welcome. We're also happy to help you with questions about Ansible.
````````````
Requirements are extremely minimal.
If you are running python 2.6 on the **overlord** machine, you will
need:
* ``paramiko``
* ``PyYAML``
* ``python-jinja2`` (for playbooks)
* ``Asciidoc`` (for building documentation)
If you are running less than Python 2.6, you will also need:
* The Python 2.4 or 2.5 backport of the ``multiprocessing`` module
- `Installation and Testing Instructions <http://code.google.com/p/python-multiprocessing/wiki/Install>`_
* ``simplejson``
On the managed nodes, to use templating, you will need:
* ``python-jinja2`` (you can install this with ansible)
Getting Ansible
```````````````
Tagged releases are available as tar.gz files from the Ansible github
project page:
* `Ansible/downloads <https://github.com/ansible/ansible/downloads>`_
You can also clone the git repository yourself and install Ansible in * Join the `ansible-project mailing list <http://groups.google.com/group/ansible-project>`_ on Google Groups
one of two ways: * Join `#ansible <irc://irc.freenode.net/#ansible>`_ on the `freenode IRC network <http://freenode.net/>`_
* Visit the `project page <https://github.com/ansible/ansible>`_ on Github
Python Distutils
++++++++++++++++
You can install Ansible using Python Distutils::
$ git clone git://github.com/ansible/ansible.git
$ cd ./ansible
$ sudo make install
Via RPM
+++++++
In the future, pre-built RPMs may be available. Until that time you - View the `issue tracker <https://github.com/ansible/ansible/issues>`_
can use the ``make rpm`` command::
$ git clone git://github.com/ansible/ansible.git
$ cd ./ansible
$ make rpm
$ sudo rpm -Uvh ~/rpmbuild/RPMS/noarch/ansible-1.0-1.noarch.rpm
Contents Contents
======== ========
...@@ -109,21 +56,22 @@ Contents ...@@ -109,21 +56,22 @@ Contents
:maxdepth: 3 :maxdepth: 3
gettingstarted gettingstarted
YAMLScripts
patterns patterns
examples
modules modules
YAMLScripts
playbooks playbooks
examples
api api
communicate
man man
About the Author
````````````````
Communicate or Get Involved Ansible was originally developed by Michael DeHaan, a Raleigh, NC based software developer and architect.
=========================== He created other popular DevOps programs such as Cobbler, the popular Linux install server.
Cobbler is used to deploy mission critical systems all over the planet, in industries
ranging from massively multiplayer gaming, core internet infrastructure, finance,
chip design, and more. Michael also helped co-author of Func, a precursor to Ansible, which is used
to orchestrate systems in lots of diverse places. He's worked on systems software for
IBM, Motorola, Red Hat's Emerging Technologies Group, Puppet Labs, and rPath.
* Join the `ansible-project mailing list <http://groups.google.com/group/ansible-project>`_ on Google Groups
* Join `#ansible <irc://irc.freenode.net/#ansible>`_ on the `freenode IRC network <http://freenode.net/>`_
* Visit the `project page <https://github.com/ansible/ansible>`_ on Github
- View the `issue tracker <https://github.com/ansible/ansible/issues>`_
...@@ -3,19 +3,10 @@ ...@@ -3,19 +3,10 @@
Man Pages Man Pages
========= =========
Ansile ships with a handfull of manpages to help you on your journey. Ansible's manpage lists available command line options.
ansible(1) ansible(1)
---------- ----------
* `View ansible.1 <man/ansible.1.html>`_ * `View ansible.1 <man/ansible.1.html>`_
ansible-modules(5)
------------------
* `View ansible-modules.5 <man/ansible-modules.5.html>`_
ansible-playbook(5)
-------------------
* `View ansible-playbook.5 <man/ansible-playbook.5.html>`_
Modules Ansible Modules
======= ===============
Lorem ipsum dolor sit amet, consectetur adipiscing elit. In dignissim Ansible ships with a number of modules that can be executed directly on remote hosts or through
placerat nibh, non feugiat risus varius vitae. Donec eu libero ansible playbooks.
lectus. Ut non orci felis, eget mattis mauris. Etiam ut tellus in
magna porta venenatis. Quisque scelerisque, sem non ultrices bibendum, .. seealso::
dolor diam rutrum lectus, sed luctus neque neque vitae eros. Vivamus
mattis, ipsum ut bibendum gravida, lectus arcu venenatis elit, vitae :doc:`examples`
luctus diam leo sit amet ligula. Nunc egestas justo in nulla sagittis Examples of using modules in /usr/bin/ansible
ut suscipit sapien gravida. Morbi id dui nibh. Nullam diam massa, :doc:`playbooks`
rhoncus a dignissim non, adipiscing vel arcu. Quisque ultricies Examples of using modules with /usr/bin/ansible-playbook
tincidunt purus ut sodales. Quisque scelerisque dapibus purus quis :doc:`api`
egestas. Maecenas sagittis porttitor adipiscing. Duis eu magna Examples of using modules with the Python API
sem. Donec arcu felis, faucibus et malesuada non, blandit vitae
metus. Fusce nec sapien dolor. Nearly all modules take key=value parameters. Some modules take no parameters, and the command
module just takes arguments for the command you want to run.
Aenean ac fermentum nisl. Integer leo sem, rutrum nec dictum at,
pretium quis sapien. Duis felis metus, sodales sit amet gravida in, All modules return JSON format data, thoug if you are using the command line or playbooks, you
pretium ut arcu. Nulla ligula quam, aliquam sit amet sollicitudin don't really need to know much about that.
eget, molestie tincidunt ipsum. Nulla leo nunc, mattis sed auctor at,
suscipit ut metus. Suspendisse hendrerit, justo sagittis malesuada Most modules other than command are idempotent, meaning they will seek to avoid changes
molestie, nisi nunc placerat libero, vel vulputate elit tellus et unless a change needs to be made. When using ansible playbooks, these modules can
augue. Phasellus tempor lectus ac nisi aliquam faucibus. Donec feugiat trigger change events. Unless otherwise noted, all modules support change hooks.
egestas nibh id mattis. In hac habitasse platea dictumst. Ut accumsan
lorem eget leo dictum viverra. Stock modules:
Quisque egestas lorem sit amet felis tincidunt adipiscing. Aenean command
ornare fermentum accumsan. Aenean eu mauris arcu, id pulvinar ```````
quam. Suspendisse nec massa vel augue laoreet ultricies in convallis
dolor. Mauris sodales porta enim, non ultricies dolor luctus The command module takes the command name followed by a list of arguments, space delimited.
in. Phasellus eu tortor lectus, vel porttitor nulla. Mauris vulputate, This is the only module that does not use key=value style parameters.
erat id scelerisque lobortis, nibh ipsum tristique elit, ac viverra
arcu sem a ante. Praesent nec metus vestibulum augue eleifend Example usage::
suscipit. In feugiat, sem nec dignissim consequat, velit tortor
scelerisque metus, sit amet mollis nisl sem eu nibh. Quisque in nibh /sbin/shutdown -t now
turpis. Proin ac nisi ligula, a pretium augue.
The given shell command will be executed on all selected nodes.
In nibh eros, laoreet id interdum vel, sodales sed tortor. Sed
ullamcorper, sem vel mattis consectetur, nibh turpis molestie nisl, This module does not support change hooks and returns the return code from the program as well as timing information about how long the command was running for.
eget lobortis mi magna sed metus. Cras justo est, tempus quis
adipiscing ut, hendrerit convallis sem. Mauris ullamcorper, sapien et
luctus iaculis, urna elit egestas ipsum, et tristique enim risus vitae copy
nunc. Vivamus aliquet lorem eu urna pulvinar hendrerit malesuada nunc ````
sollicitudin. Cras in mi rhoncus quam egestas dignissim vel sit amet
lacus. Maecenas interdum viverra laoreet. Quisque elementum The copy module moves a file on the local box to remote locations.
sollicitudin ullamcorper.
*src*::
Pellentesque mauris sem, malesuada at lobortis in, porta eget
urna. Duis aliquet quam eget risus elementum quis auctor ligula Local path to a file to copy to the remote server. This can be an absolute or relative path.
gravida. Phasellus et ullamcorper libero. Nam elementum ultricies
tellus, in sagittis magna aliquet quis. Ut sit amet tellus id erat
tristique lobortis. Suspendisse est enim, tristique eu convallis id, *dest*::
rutrum nec lacus. Fusce iaculis diam non felis rutrum lobortis. Proin
hendrerit mi tincidunt dui fermentum placerat. Remote absolute path where the file should end up.
This module also returns md5sum information about the resultant file.
facter
``````
Runs the discovery program 'facter' on the remote system, returning
JSON data that can be useful for inventory purposes.
Requires that 'facter' and 'ruby-json' be installed on the remote end.
This module is informative only - it takes no parameters & does not support change hooks,
nor does it make any changes on the system. Playbooks do not actually use
this module, they use the 'setup' module behind the scenes.
git
```
Deploys software (or files) from git checkouts.
*repo*::
git or http protocol address of the repo to checkout
*dest*::
where to check it out, an absolute directory path
*version*::
what version to check out -- either the git SHA, the literal string 'HEAD', or a tag name
ohai
````
Similar to the facter module, this returns JSON inventory data. Ohai
data is a bit more verbose and nested than facter.
Requires that 'ohai' be installed on the remote end.
This module is information only - it takes no parameters & does not
support change hooks, nor does it make any changes on the system.
Playbooks should not call the ohai module, playbooks call the 'setup'
module behind the scenes instead.
ping
````
A trivial test module, this module always returns the integer '1' on
successful contact.
This module does not support change hooks and is informative only - it takes no parameters & does not
support change hooks, nor does it make any changes on the system.
service
```````
Controls services on remote machines.
*state*
Values are 'started', 'stopped', or 'restarted'. Started/stopped
are idempotent actions that will not run commands unless neccessary.
'restarted' will always bounce the service
*name*
The name of the service
setup
`````
Writes a JSON file containing key/value data, for use in templating.
Call this once before using the template modules. Playbooks will
execute this module automatically as the first step in each play using
the variables section, so it is unneccessary to make explicit calls to
setup within a playbook.
If facter or ohai are installed, variables from these programs will also
be snapshotted into the JSON file for usage in templating. These variables
are prefixed with 'facter_' and 'ohai_" so it's easy to tell their source.
All variables are then bubbled up to the caller.
*anything*
any other parameters can be named basically anything, and set a key=value
pair in the JSON file for use in templating.
template
````````
Templates a file out to a remote server. Call the setup module prior to usage.
*src*
path of a Jinja2 formatted template on the local server. This can be a relative
or absolute path.
*dest*
location to render the template on the remote server
This module also returns md5sum information about the resultant file.
Writing your own modules
````````````````````````
To write your own modules, simply follow the convention of those already available in
/usr/share/ansible. Modules must return JSON but can be written in any language.
Modules should return hashes, but hashes can be nested.
To support change hooks, modules should return hashes with a changed: True/False
element at the top level::
{
'changed' : True,
'something' : 42
}
Modules can also choose to indicate a failure scenario by returning a top level 'failure'
element with a True value, and a 'msg' element describing the nature of the failure.
Other return values are up to the module.
{
'failure' : True,
'msg' : "here is what happened..."
}
When shipping modules, drop them in /usr/share/ansible, or specify the module path to the
command line tool or API. It is easy to test modules by running them directly on
the command line, passing them arguments just like they would be passed with ansible.
Patterns The Inventory File, Patterns, and Groups
======== ========================================
Lorem ipsum dolor sit amet, consectetur adipiscing elit. In dignissim How to select hosts you wish to manage
placerat nibh, non feugiat risus varius vitae. Donec eu libero
lectus. Ut non orci felis, eget mattis mauris. Etiam ut tellus in .. seealso::
magna porta venenatis. Quisque scelerisque, sem non ultrices bibendum,
dolor diam rutrum lectus, sed luctus neque neque vitae eros. Vivamus :doc:`examples`
mattis, ipsum ut bibendum gravida, lectus arcu venenatis elit, vitae Examples of basic commands
luctus diam leo sit amet ligula. Nunc egestas justo in nulla sagittis :doc:`playbooks`
ut suscipit sapien gravida. Morbi id dui nibh. Nullam diam massa, Learning ansible's configuration management language
rhoncus a dignissim non, adipiscing vel arcu. Quisque ultricies
tincidunt purus ut sodales. Quisque scelerisque dapibus purus quis Inventory File Format
egestas. Maecenas sagittis porttitor adipiscing. Duis eu magna +++++++++++++++++++++
sem. Donec arcu felis, faucibus et malesuada non, blandit vitae
metus. Fusce nec sapien dolor. Ansible works against multiple systems in your infrastructure at the
same time. It does this by selecting portions of systems listed in Ansible's inventory file,
Aenean ac fermentum nisl. Integer leo sem, rutrum nec dictum at, which defaults to /etc/ansible/hosts, and looks like this::
pretium quis sapien. Duis felis metus, sodales sit amet gravida in,
pretium ut arcu. Nulla ligula quam, aliquam sit amet sollicitudin mail.example.com
eget, molestie tincidunt ipsum. Nulla leo nunc, mattis sed auctor at,
suscipit ut metus. Suspendisse hendrerit, justo sagittis malesuada [webservers]
molestie, nisi nunc placerat libero, vel vulputate elit tellus et foo.example.com
augue. Phasellus tempor lectus ac nisi aliquam faucibus. Donec feugiat bar.example.com
egestas nibh id mattis. In hac habitasse platea dictumst. Ut accumsan
lorem eget leo dictum viverra. [dbservers]
one.example.com
Quisque egestas lorem sit amet felis tincidunt adipiscing. Aenean two.example.com
ornare fermentum accumsan. Aenean eu mauris arcu, id pulvinar three.example.com
quam. Suspendisse nec massa vel augue laoreet ultricies in convallis
dolor. Mauris sodales porta enim, non ultricies dolor luctus
in. Phasellus eu tortor lectus, vel porttitor nulla. Mauris vulputate, Selecting Targets
erat id scelerisque lobortis, nibh ipsum tristique elit, ac viverra +++++++++++++++++
arcu sem a ante. Praesent nec metus vestibulum augue eleifend
suscipit. In feugiat, sem nec dignissim consequat, velit tortor These patterns target all hosts in the inventory file::
scelerisque metus, sit amet mollis nisl sem eu nibh. Quisque in nibh
turpis. Proin ac nisi ligula, a pretium augue. all
*
In nibh eros, laoreet id interdum vel, sodales sed tortor. Sed
ullamcorper, sem vel mattis consectetur, nibh turpis molestie nisl, It is also possible to address specific hosts::
eget lobortis mi magna sed metus. Cras justo est, tempus quis
adipiscing ut, hendrerit convallis sem. Mauris ullamcorper, sapien et one.example.com
luctus iaculis, urna elit egestas ipsum, et tristique enim risus vitae one.example.com:two.example.com
nunc. Vivamus aliquet lorem eu urna pulvinar hendrerit malesuada nunc
sollicitudin. Cras in mi rhoncus quam egestas dignissim vel sit amet
lacus. Maecenas interdum viverra laoreet. Quisque elementum The following patterns address one or more groups, which are denoted with the bracket
sollicitudin ullamcorper. headers in the inventory file::
Pellentesque mauris sem, malesuada at lobortis in, porta eget webservers
urna. Duis aliquet quam eget risus elementum quis auctor ligula webservers:dbservers
gravida. Phasellus et ullamcorper libero. Nam elementum ultricies
tellus, in sagittis magna aliquet quis. Ut sit amet tellus id erat Individual hosts, but not groups, can also be referenced using wildcards:
tristique lobortis. Suspendisse est enim, tristique eu convallis id,
rutrum nec lacus. Fusce iaculis diam non felis rutrum lobortis. Proin *.example.com
hendrerit mi tincidunt dui fermentum placerat. *.com
It's also ok to mix wildcard patterns and groups at the same time::
one*.com:dbservers
NOTE: It is not possible to target a host not in the inventory file.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment