Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
359 lines (331 sloc) 16.7 KB
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html xmlns="">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Getting Started &mdash; Ansible - SSH-Based Configuration Management &amp; Deployment</title>
<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/bootstrap.css" type="text/css" />
<link rel="stylesheet" href="_static/bootstrap-sphinx.css" type="text/css" />
<script type="text/javascript">
VERSION: '0.01',
FILE_SUFFIX: '.html',
<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>
<script type="text/javascript" src="_static/bootstrap-dropdown.js"></script>
<script type="text/javascript" src="_static/bootstrap-scrollspy.js"></script>
<link rel="shortcut icon" href="_static/favicon.ico"/>
<link rel="top" title="Ansible - SSH-Based Configuration Management &amp; Deployment" href="index.html" />
<link rel="next" title="Inventory &amp; Patterns" href="patterns.html" />
<link rel="prev" title="The Future Is Now" href="index.html" />
<script type="text/javascript">
(function () {
* Patch TOC list.
* Will mutate the underlying span to have a correct ul for nav.
* @param $span: Span containing nested UL's to mutate.
* @param minLevel: Starting level for nested lists. (1: global, 2: local).
var patchToc = function ($span, minLevel) {
var $tocList = $("<ul/>").attr('class', "dropdown-menu"),
// Find all a "internal" tags, traversing recursively.
findA = function ($elem, level) {
var level = level || 0,
$items = $elem.find("> li > a.internal, > ul, > li > ul");
// Iterate everything in order.
$items.each(function (index, item) {
var $item = $(item),
tag = item.tagName.toLowerCase(),
pad = 10 + ((level - minLevel) * 10);
if (tag === 'a' && level >= minLevel) {
// Add to existing padding.
$item.css('padding-left', pad + "px");
// Add list element.
} else if (tag === 'ul') {
// Recurse.
findA($item, level + 1);
// Start construction and return.
// Wipe out old list and patch in new one.
return $span.empty("ul").append($tocList);
$(document).ready(function () {
// Patch the global and local TOC's to be bootstrap-compliant.
patchToc($("span.globaltoc"), 1);
patchToc($("span.localtoc"), 2);
// Activate.
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-29861888-1']);
(function() {
var ga = document.createElement('script'); ga.type =
'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' :
'http://www') + '';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(ga, s);
<script type="text/javascript">
(function() {
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
po.src = '';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); = id;
js.src = "//";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<div class="topbar" data-scrollspy="scrollspy" >
<div class="topbar-inner">
<div class="container">
<!-- <a class="brand" href="index.html">Ansible</a> -->
<ul class="nav">
<li class="dropdown" data-dropdown="dropdown">
<a href="index.html"
<span class="globaltoc"><ul class="current">
<li class="toctree-l1 current"><a class="current reference internal" href="">Getting Started</a></li>
<li class="toctree-l1"><a class="reference internal" href="patterns.html">Inventory &amp; Patterns</a></li>
<li class="toctree-l1"><a class="reference internal" href="examples.html">Command Line</a></li>
<li class="toctree-l1"><a class="reference internal" href="modules.html">Ansible Modules</a></li>
<li class="toctree-l1"><a class="reference internal" href="YAMLSyntax.html">YAML Syntax</a></li>
<li class="toctree-l1"><a class="reference internal" href="playbooks.html">Playbooks</a></li>
<li class="toctree-l1"><a class="reference internal" href="playbooks2.html">Advanced Playbooks</a></li>
<li class="toctree-l1"><a class="reference internal" href="bestpractices.html">Best Practices</a></li>
<li class="toctree-l1"><a class="reference internal" href="api.html">API &amp; Integrations</a></li>
<li class="toctree-l1"><a class="reference internal" href="moduledev.html">Module Development</a></li>
<li class="toctree-l1"><a class="reference internal" href="faq.html">FAQ</a></li>
<li class="dropdown" data-dropdown="dropdown">
<a href="#"
<span class="localtoc"><ul>
<li><a class="reference internal" href="#">Getting Started</a><ul>
<li><a class="reference internal" href="#requirements">Requirements</a></li>
<li><a class="reference internal" href="#python-2-6-epel-instructions-for-rhel-and-centos-5">Python 2.6 EPEL instructions for RHEL and CentOS 5</a></li>
<li><a class="reference internal" href="#getting-ansible">Getting Ansible</a><ul>
<li><a class="reference internal" href="#running-from-checkout">Running From Checkout</a></li>
<li><a class="reference internal" href="#make-install">Make Install</a></li>
<li><a class="reference internal" href="#via-rpm">Via RPM</a></li>
<li><a class="reference internal" href="#debian-gentoo-arch-others">Debian, Gentoo, Arch, Others</a></li>
<li><a class="reference internal" href="#tagged-releases">Tagged Releases</a></li>
<li><a class="reference internal" href="#your-first-commands">Your first commands</a></li>
<ul class="nav secondary-nav">
<form class="pull-left" action="search.html" method="get">
<input type="text" name="q" placeholder="Search" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
<a href=""><img style="position: absolute; right: 0; border: 0;" src="" alt="Fork me on GitHub"></a>
<div class="container">
<a href=""><img src="" alt="Ansible"/></a><br/>
<div class="section" id="getting-started">
<h1>Getting Started<a class="headerlink" href="#getting-started" title="Permalink to this headline">¶</a></h1>
<div class="section" id="requirements">
<h2>Requirements<a class="headerlink" href="#requirements" title="Permalink to this headline">¶</a></h2>
<p>Requirements for Ansible are extremely minimal.</p>
<p>Ansible is written for Python 2.6. If you are running Python 2.5 on an &#8220;Enterprise Linux&#8221; variant,
your distribution can easily install 2.6 (see instructions in the next section). Newer versions
of Linux and OS X should already have 2.6.</p>
<p>In additon to Python 2.6, you will want the following packages:</p>
<ul class="simple">
<li><tt class="docutils literal"><span class="pre">paramiko</span></tt></li>
<li><tt class="docutils literal"><span class="pre">PyYAML</span></tt></li>
<li><tt class="docutils literal"><span class="pre">python-jinja2</span></tt></li>
<p>On the managed nodes, you only need Python 2.4 or later, but if you are are running less than Python 2.6 on them, you will
also need:</p>
<ul class="simple">
<li><tt class="docutils literal"><span class="pre">python-simplejson</span></tt></li>
<p>NOTE: Ansible 0.4 will have ways to remote bootstrap this, using Ansible itself. Stay tuned.</p>
<div class="section" id="python-2-6-epel-instructions-for-rhel-and-centos-5">
<h2>Python 2.6 EPEL instructions for RHEL and CentOS 5<a class="headerlink" href="#python-2-6-epel-instructions-for-rhel-and-centos-5" title="Permalink to this headline">¶</a></h2>
<p>These distributions don&#8217;t have Python 2.6 by default, but it is easily installable.</p>
<ul class="simple">
<li>If you have not already done so, <a class="reference external" href="">configure EPEL</a></li>
<li>yum install python26 python26-PyYAML python26-paramiko python26-jinja2</li>
<div class="section" id="getting-ansible">
<h2>Getting Ansible<a class="headerlink" href="#getting-ansible" title="Permalink to this headline">¶</a></h2>
<p>If you are interested in using all the latest features, you may wish to keep up to date
with the development branch of the git checkout. This also makes it easiest to contribute
back to the project.</p>
<p>Instructions for installing from source are below.</p>
<p>Ansible&#8217;s release cycles are about one month long. Due to this
short release cycle, any bugs will generally be fixed in the next release versus maintaining
backports on the stable branch.</p>
<p>You may also wish to follow the <a class="reference external" href="">Github project</a> if
you have a github account. This is also where we keep the issue tracker for sharing
bugs and feature ideas.</p>
<div class="section" id="running-from-checkout">
<h3>Running From Checkout<a class="headerlink" href="#running-from-checkout" title="Permalink to this headline">¶</a></h3>
<p>Ansible is trivially easy to run from a checkout, root permissions are not required
to use it:</p>
<div class="highlight-python"><pre>$ git clone git://
$ git checkout -t origin/devel
$ cd ./ansible
$ source ./hacking/env-setup</pre>
<p>You can optionally specify an inventory file (see doc:<cite>patterns</cite>) other than /etc/ansible/hosts:</p>
<div class="highlight-python"><pre>$ echo "" &gt; ~/ansible_hosts
$ export ANSIBLE_HOSTS=~/ansible_hosts</pre>
<p>Now let&#8217;s test things:</p>
<div class="highlight-python"><pre>$ ansible all -m ping --ask-pass</pre>
<div class="section" id="make-install">
<h3>Make Install<a class="headerlink" href="#make-install" title="Permalink to this headline">¶</a></h3>
<p>If you are not working from a distribution where Ansible is packaged yet, you can install Ansible
using &#8220;make install&#8221;. This is done through <cite>python-distutils</cite>:</p>
<div class="highlight-python"><pre>$ git clone git://
$ git checkout -t origin/devel
$ cd ./ansible
$ sudo make install</pre>
<div class="section" id="via-rpm">
<h3>Via RPM<a class="headerlink" href="#via-rpm" title="Permalink to this headline">¶</a></h3>
<p>RPMs for the last Ansible release are available for <a class="reference external" href="">EPEL</a> 6 and currently supported
Fedora distributions.</p>
<div># install the epel-release RPM if needed on CentOS, RHEL, or Scientific Linux
$ sudo yum install ansible</div></blockquote>
<p>You can also use the <tt class="docutils literal"><span class="pre">make</span> <span class="pre">rpm</span></tt> command to
build an RPM you can distribute and install:</p>
<div class="highlight-python"><pre>$ git clone git://
$ cd ./ansible
$ make rpm
$ sudo rpm -Uvh ~/rpmbuild/RPMS/noarch/ansible-*.noarch.rpm</pre>
<p>Note that if you are tracking the upstream source (i.e. git), the RPM revision will not be
bumped with every source code change. To get around this, you can use
<tt class="docutils literal"><span class="pre">rpm</span> <span class="pre">-Uvh</span></tt> with <tt class="docutils literal"><span class="pre">--force</span></tt> when RPM tells you the package is still at the
same version. This is perfectly safe to do.</p>
<div class="section" id="debian-gentoo-arch-others">
<h3>Debian, Gentoo, Arch, Others<a class="headerlink" href="#debian-gentoo-arch-others" title="Permalink to this headline">¶</a></h3>
<p>Gentoo eBuilds are available <a class="reference external" href="">here</a></p>
<p>Debian package recipes can be built from the source checkout, run:</p>
<div class="highlight-python"><pre>make debian</pre>
<p>An Arch PKGBUILD is available on <a class="reference external" href="">AUR</a>
If you have python3 installed on Arch, you probably want to symlink python to python2.:</p>
<div class="highlight-python"><pre>sudo ln -sf /usr/bin/python2 /usr/bin/python</pre>
<p>If you would like to package Ansible for Homebrew, BSD, or others,
please stop by the mailing list and say hi!</p>
<div class="section" id="tagged-releases">
<h3>Tagged Releases<a class="headerlink" href="#tagged-releases" title="Permalink to this headline">¶</a></h3>
<p>Tagged releases are available as tar.gz files from the Ansible github
project page:</p>
<ul class="simple">
<li><a class="reference external" href="">Ansible/downloads</a></li>
<div class="section" id="your-first-commands">
<h2>Your first commands<a class="headerlink" href="#your-first-commands" title="Permalink to this headline">¶</a></h2>
<p>Now that you&#8217;ve installed Ansible, it&#8217;s time to test it.</p>
<p>Edit (or create) /etc/ansible/hosts and put one or more remote systems in it, for
which you have your SSH key in <tt class="docutils literal"><span class="pre">authorized_keys</span></tt>:</p>
<div class="highlight-python"><pre></pre>
<p>Set up SSH agent to avoid retyping passwords:</p>
<div class="highlight-python"><pre>ssh-agent bash
ssh-add ~/.ssh/id_rsa</pre>
<p>Now ping all your nodes:</p>
<div class="highlight-python"><pre>ansible all -m ping</pre>
<p>Now run a live command on all of your nodes:</p>
<div class="highlight-python"><pre>ansible all -a "/bin/echo hello"</pre>
<p>Congratulations. You&#8217;ve just contacted your nodes with Ansible. It&#8217;s
now time to read some of the more real-world <a class="reference internal" href="examples.html"><em>Command Line</em></a>, and explore
what you can do with different modules, as well as the Ansible
<a class="reference internal" href="playbooks.html"><em>Playbooks</em></a> language. Ansible is not just about running commands, it
also has powerful configuration management and deployment features. There&#8217;s more to
explore, but you already have a fully working infrastructure!</p>
<div class="admonition-see-also admonition seealso">
<p class="first admonition-title">See also</p>
<dl class="last docutils">
<dt><a class="reference internal" href="examples.html"><em>Command Line</em></a></dt>
<dd>Examples of basic commands</dd>
<dt><a class="reference internal" href="playbooks.html"><em>Playbooks</em></a></dt>
<dd>Learning ansible&#8217;s configuration management language</dd>
<dt><a class="reference external" href="">Mailing List</a></dt>
<dd>Questions? Help? Ideas? Stop by the list on Google Groups</dd>
<dt><a class="reference external" href=""></a></dt>
<dd>#ansible IRC chat channel</dd>
<footer class="footer">
<div class="container">
<div id="fb-root"></div>
<a href="" class="twitter-share-button" data-text="">Share On Twitter</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);;js.src="//";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
<g:plusone annotation="inline"></g:plusone>
<div class="fb-like" data-href="" data-send="true" data-width="450" data-show-faces="false"></div>
&copy; Copyright 2012 Michael DeHaan.<br/>
Last updated on May 13, 2012.<br/>
Something went wrong with that request. Please try again.