You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ansible/index.html

390 lines
25 KiB
HTML

<!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>Introducing Ansible &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">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '',
VERSION: '0.01',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: false
};
</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>
<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="#" />
<link rel="next" title="Downloads &amp; Getting Started" href="gettingstarted.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"),
findA;
// 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.
$tocList.append($("<li/>").append($item));
} else if (tag === 'ul') {
// Recurse.
findA($item, level + 1);
}
});
};
// Start construction and return.
findA($span);
// 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.
$('#topbar').dropdown();
});
}());
</script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-29861888-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type =
'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' :
'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(ga, s);
})();
</script>
</head>
<body>
<div class="topbar" data-scrollspy="scrollspy" >
<div class="topbar-inner">
<div class="container">
<a class="brand" href="#">Ansible</a>
<ul class="nav">
<li class="dropdown" data-dropdown="dropdown">
<a href="#"
class="dropdown-toggle">Chapter</a>
<span class="globaltoc"><ul>
<li class="toctree-l1"><a class="reference internal" href="gettingstarted.html">Downloads &amp; Getting Started</a></li>
<li class="toctree-l1"><a class="reference internal" href="patterns.html">The Inventory File, Patterns, and Groups</a></li>
<li class="toctree-l1"><a class="reference internal" href="examples.html">Command Line Examples</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="api.html">API &amp; Integrations</a></li>
<li class="toctree-l1"><a class="reference internal" href="moduledev.html">Module Development Guide</a></li>
<li class="toctree-l1"><a class="reference internal" href="faq.html">Frequently Asked Questions</a></li>
</ul>
</span>
</li>
<li class="dropdown" data-dropdown="dropdown">
<a href="#"
class="dropdown-toggle">Page</a>
<span class="localtoc"><ul>
<li><a class="reference internal" href="#">Introducing Ansible</a><ul>
<li><a class="reference internal" href="#architecture">Architecture</a></li>
<li><a class="reference internal" href="#features">Features</a></li>
<li><a class="reference internal" href="#resources">Resources</a></li>
</ul>
</li>
<li><a class="reference internal" href="#contents">Contents</a><ul>
<li><a class="reference internal" href="#about-the-author">About the Author</a></li>
</ul>
</li>
</ul>
</span>
</li>
</ul>
<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" />
</form>
</ul>
</div>
</div>
</div>
<div class="container">
<a class="reference external image-reference" href="http://photos.michaeldehaan.net/infrared/h3d850bdf#h3d850bdf"><img alt="&quot;&quot;" src="http://ansible.github.com/mpd_rings.jpg" style="width: 300px; height: 225px;" /></a>
<a class="reference external image-reference" href="http://photos.michaeldehaan.net/favorites/h2428aca7#h2428aca7"><img alt="&quot;&quot;" src="http://ansible.github.com/mpd_tunnel.jpg" style="width: 337px; height: 225px;" /></a>
<a class="reference external image-reference" href="http://photos.michaeldehaan.net/ncsu/h3b63b68e#h3b63b68e"><img alt="&quot;&quot;" src="http://ansible.github.com/mpd_tubes.jpg" style="width: 225px; height: 225px;" /></a>
<div class="section" id="introducing-ansible">
<h1>Introducing Ansible<a class="headerlink" href="#introducing-ansible" title="Permalink to this headline"></a></h1>
<p>Ansible is a radically simple deployment, model-driven configuration management,
and command execution framework. Other tools in this space have been too
complicated for too long, require too much bootstrapping, 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&#8217;s core is a little over 1000 lines.</p>
<p>Ansible isn&#8217;t just for idempotent configuration &#8211; it&#8217;s also great for ad-hoc
tasks, quickly firing off commands against nodes. See <a class="reference internal" href="examples.html"><em>Command Line Examples</em></a>.</p>
<p>Where Ansible excels though, is expressing complex multi-node
deployment processes, executing ordered sequences on
different sets of nodes through <a class="reference internal" href="playbooks.html"><em>Playbooks</em></a>. Playbooks contain one or
more plays, each executed against a different batch of nodes. Think about
webservers, database servers, and backend servers in a multi-node web environment. A play could address each set of machines in a cycle, ensuring the configurations of the machines were correct and also updating them to the specified
version of software if required.</p>
<p>Multi-machine software deployment is poorly solved by most systems management tools &#8211; often due to architectural nature of being pull oriented and having complex ordering systems, they cover configuration but fail at deployment when updating tiers of machines in well defined steps. This results in using two (or more) logically distinct tools and having complex overlap between them.</p>
<p>Other deployment oriented frameworks similarly cover deployment well but lack a strongly defined resource model and devolve into glorified remote scripts. Ansible playbooks &#8211; having been designed with this problem in mind &#8211; are good at both deployment &amp; idempotent configuration, meaning you don&#8217;t have to spread your infrastructure management out between different tools (Puppet+Capistrano, Chef+Fabric, etc), and performing ordered steps between different classes of machines is no problem, yet our modules affect system state only when required &#8211; while avoiding the problem of fragile scripting that assumes certain starting
or ending states.</p>
<p>Ansible is also unique in other ways. Extending ansible does not require programming in any particular language &#8211; you can write <a class="reference internal" href="modules.html"><em>Ansible Modules</em></a> as idempotent scripts or programs that return simple JSON. Ansible is also pragmatic, so when you need to, it&#8217;s also trivially easy to just execute useful shell commands.</p>
<p>Why use Ansible versus other configuration management tools? (Puppet, Chef, etc?) Ansible will have far
less code, it will be (by extension) more correct, and it will be the
easiest thing to hack on and use you&#8217;ll ever see &#8211; regardless of your
favorite language of choice. Versus other deployment tools? (Capistrano, Fabric?). Ansible playbooks are easier
to use (not being code) and also allows intermixing of idempotent configuration management rules for a higher level
of control. Further, it was designed for deploying multi-node applications from the beginning.</p>
<p>Compared with most configuration managememnt tools, Ansible is also more secure. While most configuration management tools use a daemon, running as root with full access to the system, with it&#8217;s own in-house developed PKI infrastructure, Ansible just uses SSH (and supports sudo as neccesssary). There is no additional attack surface and OpenSSH is one of the most peer reviewed security components out there.
If a central server containing your playbooks are comprimised, your nodes are not &#8211; which is NOT the case
of these other tools, which can, more or less, turn into a botnet. Our security approach is to avoid writing custom
crypto code altogether, and rely on the most secure part of the Linux/Unix subsystem that your machines are already using.</p>
<p>Systems management doesn&#8217;t have to be complicated. Ansible&#8217;s docs will remain short &amp; simple, and the source will be blindingly obvious. We&#8217;ve learned well from &#8220;Infrastructure is Code&#8221;. Infrastructure should be easy and powerful to command, but it should not look like code, lest it acquire the disadvantages of a software project &#8211; bugs, complexity, and overhead. Infrastructure configurations should be simple, easy to develop, and easy to audit.</p>
<div class="section" id="architecture">
<h2>Architecture<a class="headerlink" href="#architecture" title="Permalink to this headline"></a></h2>
<div align="center" class="align-center"><img alt="&quot;Architecture Diagram&quot;" class="align-center" src="http://ansible.github.com/ansible_arch2.jpg" style="width: 800px;" /></div>
</div>
<div class="section" id="features">
<h2>Features<a class="headerlink" href="#features" title="Permalink to this headline"></a></h2>
<ul class="simple">
<li>Dead simple setup</li>
<li>Super fast &amp; parallel by default</li>
<li>No server or client daemons; use existing SSHd out of the box</li>
<li>No additional software required on client boxes</li>
<li>Can be easily run from a checkout, no installation required</li>
<li>Modules are idempotent, but you can also easily use shell commands</li>
<li>Modules can be written in ANY language</li>
<li>Awesome API for creating very powerful distributed scripts</li>
<li>Does not have to run remote steps as root</li>
<li>Pluggable transports (SSH is just the default)</li>
<li>Source host info &amp; variables from files or external software</li>
<li>The easiest config management system to use, ever.</li>
</ul>
</div>
<div class="section" id="resources">
<h2>Resources<a class="headerlink" href="#resources" title="Permalink to this headline"></a></h2>
<p>Your ideas and contributions are welcome. We&#8217;re also happy to help
you with questions about Ansible.</p>
<ul class="simple">
<li>Visit the <a class="reference external" href="https://github.com/ansible/ansible">project page</a> on Github</li>
<li>View the <a class="reference external" href="https://github.com/ansible/ansible/issues">issue tracker</a></li>
<li>See the presentation on <a class="reference external" href="http://speakerdeck.com/u/mpdehaan/p/ansible">Speakerdeck</a></li>
<li>Visit the <a class="reference external" href="http://groups.google.com/group/ansible-project">Google Group</a></li>
<li>Chat on <a class="reference external" href="http://webchat.freenode.net/?channels=ansible">FreeNode</a></li>
<li>View or add to the the <a class="reference external" href="https://github.com/ansible/ansible-contrib">Contrib Repo</a> on Github</li>
</ul>
<img src="http://groups.google.com/intl/en/images/logos/groups_logo_sm.gif" height=30 width=140 alt="Google Groups">
<br/>
<b>Subscribe to Ansible Project</b>
<br/>
<form action="http://groups.google.com/group/ansible-project/boxsubscribe">
<br/>
Email: <input type=text name=email>&nbsp;&nbsp;<input type=submit name="sub" value="Subscribe">
<br/></br>
</form>
<br/></div>
</div>
<div class="section" id="contents">
<h1>Contents<a class="headerlink" href="#contents" title="Permalink to this headline"></a></h1>
<div class="toctree-wrapper compound">
<ul>
<li class="toctree-l1"><a class="reference internal" href="gettingstarted.html">Downloads &amp; Getting Started</a><ul>
<li class="toctree-l2"><a class="reference internal" href="gettingstarted.html#requirements">Requirements</a></li>
<li class="toctree-l2"><a class="reference internal" href="gettingstarted.html#getting-ansible">Getting Ansible</a><ul>
<li class="toctree-l3"><a class="reference internal" href="gettingstarted.html#running-from-checkout">Running From Checkout</a></li>
<li class="toctree-l3"><a class="reference internal" href="gettingstarted.html#make-install">Make Install</a></li>
<li class="toctree-l3"><a class="reference internal" href="gettingstarted.html#via-rpm">Via RPM</a></li>
<li class="toctree-l3"><a class="reference internal" href="gettingstarted.html#other-package-distributions">Other Package Distributions</a></li>
<li class="toctree-l3"><a class="reference internal" href="gettingstarted.html#tagged-releases">Tagged Releases</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="gettingstarted.html#your-first-commands">Your first commands</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="patterns.html">The Inventory File, Patterns, and Groups</a><ul>
<li class="toctree-l2"><a class="reference internal" href="patterns.html#inventory-file-format">Inventory File Format</a></li>
<li class="toctree-l2"><a class="reference internal" href="patterns.html#selecting-targets">Selecting Targets</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="examples.html">Command Line Examples</a><ul>
<li class="toctree-l2"><a class="reference internal" href="examples.html#parallelism-and-shell-commands">Parallelism and Shell Commands</a></li>
<li class="toctree-l2"><a class="reference internal" href="examples.html#file-transfer-templating">File Transfer &amp; Templating</a></li>
<li class="toctree-l2"><a class="reference internal" href="examples.html#managing-packages">Managing Packages</a></li>
<li class="toctree-l2"><a class="reference internal" href="examples.html#users-and-groups">Users and Groups</a></li>
<li class="toctree-l2"><a class="reference internal" href="examples.html#deploying-from-source-control">Deploying From Source Control</a></li>
<li class="toctree-l2"><a class="reference internal" href="examples.html#managing-services">Managing Services</a></li>
<li class="toctree-l2"><a class="reference internal" href="examples.html#time-limited-background-operations">Time Limited Background Operations</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="modules.html">Ansible Modules</a><ul>
<li class="toctree-l2"><a class="reference internal" href="modules.html#apt">apt</a></li>
<li class="toctree-l2"><a class="reference internal" href="modules.html#command">command</a></li>
<li class="toctree-l2"><a class="reference internal" href="modules.html#copy">copy</a></li>
<li class="toctree-l2"><a class="reference internal" href="modules.html#facter">facter</a></li>
<li class="toctree-l2"><a class="reference internal" href="modules.html#fetch">fetch</a></li>
<li class="toctree-l2"><a class="reference internal" href="modules.html#file">file</a></li>
<li class="toctree-l2"><a class="reference internal" href="modules.html#git">git</a></li>
<li class="toctree-l2"><a class="reference internal" href="modules.html#group">group</a></li>
<li class="toctree-l2"><a class="reference internal" href="modules.html#ohai">ohai</a></li>
<li class="toctree-l2"><a class="reference internal" href="modules.html#ping">ping</a></li>
<li class="toctree-l2"><a class="reference internal" href="modules.html#service">service</a></li>
<li class="toctree-l2"><a class="reference internal" href="modules.html#setup">setup</a></li>
<li class="toctree-l2"><a class="reference internal" href="modules.html#shell">shell</a></li>
<li class="toctree-l2"><a class="reference internal" href="modules.html#template">template</a></li>
<li class="toctree-l2"><a class="reference internal" href="modules.html#user">user</a></li>
<li class="toctree-l2"><a class="reference internal" href="modules.html#virt">virt</a></li>
<li class="toctree-l2"><a class="reference internal" href="modules.html#yum">yum</a></li>
<li class="toctree-l2"><a class="reference internal" href="modules.html#writing-your-own-modules">Writing your own modules</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="YAMLSyntax.html">YAML Syntax</a><ul>
<li class="toctree-l2"><a class="reference internal" href="YAMLSyntax.html#yaml-basics">YAML Basics</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="playbooks.html">Playbooks</a><ul>
<li class="toctree-l2"><a class="reference internal" href="playbooks.html#playbook-example">Playbook Example</a></li>
<li class="toctree-l2"><a class="reference internal" href="playbooks.html#basics">Basics</a><ul>
<li class="toctree-l3"><a class="reference internal" href="playbooks.html#hosts-and-users">Hosts and Users</a></li>
<li class="toctree-l3"><a class="reference internal" href="playbooks.html#vars-section">Vars section</a></li>
<li class="toctree-l3"><a class="reference internal" href="playbooks.html#tasks-list">Tasks list</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="playbooks.html#running-operations-on-change">Running Operations On Change</a></li>
<li class="toctree-l2"><a class="reference internal" href="playbooks.html#power-tricks">Power Tricks</a><ul>
<li class="toctree-l3"><a class="reference internal" href="playbooks.html#local-playbooks">Local Playbooks</a></li>
<li class="toctree-l3"><a class="reference internal" href="playbooks.html#external-variables-and-prompted-or-sensitive-data">External Variables And Prompted or Sensitive Data</a></li>
<li class="toctree-l3"><a class="reference internal" href="playbooks.html#conditional-execution">Conditional Execution</a></li>
<li class="toctree-l3"><a class="reference internal" href="playbooks.html#conditional-imports">Conditional Imports</a></li>
<li class="toctree-l3"><a class="reference internal" href="playbooks.html#include-files-and-reuse">Include Files And Reuse</a></li>
<li class="toctree-l3"><a class="reference internal" href="playbooks.html#using-includes-to-assign-classes-of-systems">Using Includes To Assign Classes of Systems</a></li>
<li class="toctree-l3"><a class="reference internal" href="playbooks.html#asynchronous-actions-and-polling">Asynchronous Actions and Polling</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="playbooks.html#executing-a-playbook">Executing A Playbook</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="api.html">API &amp; Integrations</a><ul>
<li class="toctree-l2"><a class="reference internal" href="api.html#python-api">Python API</a><ul>
<li class="toctree-l3"><a class="reference internal" href="api.html#detailed-api-example">Detailed API Example</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="api.html#external-inventory">External Inventory</a><ul>
<li class="toctree-l3"><a class="reference internal" href="api.html#script-conventions">Script Conventions</a></li>
<li class="toctree-l3"><a class="reference internal" href="api.html#example-the-cobbler-external-inventory-script">Example: The Cobbler External Inventory Script</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="moduledev.html">Module Development Guide</a><ul>
<li class="toctree-l2"><a class="reference internal" href="moduledev.html#tutorial">Tutorial</a></li>
<li class="toctree-l2"><a class="reference internal" href="moduledev.html#testing-modules">Testing Modules</a></li>
<li class="toctree-l2"><a class="reference internal" href="moduledev.html#reading-input">Reading Input</a></li>
<li class="toctree-l2"><a class="reference internal" href="moduledev.html#common-pitfalls">Common Pitfalls</a></li>
<li class="toctree-l2"><a class="reference internal" href="moduledev.html#conventions">Conventions</a></li>
<li class="toctree-l2"><a class="reference internal" href="moduledev.html#shorthand-vs-json">Shorthand Vs JSON</a></li>
<li class="toctree-l2"><a class="reference internal" href="moduledev.html#sharing-your-module">Sharing Your Module</a></li>
<li class="toctree-l2"><a class="reference internal" href="moduledev.html#getting-your-module-into-core">Getting Your Module Into Core</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="faq.html">Frequently Asked Questions</a><ul>
<li class="toctree-l2"><a class="reference internal" href="faq.html#what-inspired-ansible">What inspired Ansible?</a></li>
<li class="toctree-l2"><a class="reference internal" href="faq.html#comparisons">Comparisons</a><ul>
<li class="toctree-l3"><a class="reference internal" href="faq.html#vs-func">vs Func?</a></li>
<li class="toctree-l3"><a class="reference internal" href="faq.html#vs-puppet">vs Puppet?</a></li>
<li class="toctree-l3"><a class="reference internal" href="faq.html#vs-chef">vs Chef?</a></li>
<li class="toctree-l3"><a class="reference internal" href="faq.html#vs-capistrano-fabric">vs Capistrano/Fabric?</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="faq.html#other-questions">Other Questions</a><ul>
<li class="toctree-l3"><a class="reference internal" href="faq.html#what-is-ansible-s-approach-to-security">What is Ansible&#8217;s approach to security?</a></li>
<li class="toctree-l3"><a class="reference internal" href="faq.html#how-does-ansible-scale">How does Ansible scale?</a></li>
<li class="toctree-l3"><a class="reference internal" href="faq.html#are-transports-other-than-ssh-supported">Are transports other than SSH supported?</a></li>
<li class="toctree-l3"><a class="reference internal" href="faq.html#what-are-some-ideal-uses-for-ansible">What are some ideal uses for Ansible?</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="section" id="about-the-author">
<h2>About the Author<a class="headerlink" href="#about-the-author" title="Permalink to this headline"></a></h2>
<p>Ansible was originally developed by <a class="reference external" href="http://michaeldehaan.net">Michael DeHaan</a> (<a class="reference external" href="http://twitter.com/#!/laserllama">&#64;laserllama</a>), a Raleigh, NC
based software developer and architect. He created the popular
DevOps program <a class="reference external" href="http://cobbler.github.com/">Cobbler</a>.
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 <a class="reference external" href="http://fedorahosted.org/func/">Func</a>, a precursor to Ansible, which is used to
orchestrate systems in lots of diverse places. He&#8217;s worked on systems
software for IBM, Motorola, Red Hat&#8217;s Emerging Technologies Group,
Puppet Labs, and rPath. Reach Michael by email <a class="reference external" href="mailto:michael&#46;dehaan&#37;&#52;&#48;gmail&#46;com">here</a>.</p>
</div>
</div>
</div>
<footer class="footer">
<div class="container">
<p class="pull-right"><a href="#">Back to top</a></p>
<p>
&copy; Copyright 2012 Michael DeHaan.<br/>
Last updated on Apr 14, 2012.<br/>
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.8.<br/>
</p>
</div>
</footer>
</body>
</html>