ansible/html/patterns.html

171 lines
7.3 KiB
HTML
Raw Normal View History

2012-03-07 16:35:18 +00:00
<!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" />
2012-03-08 18:53:48 +00:00
<title>The Inventory File, Patterns, and Groups &mdash; Ansible v0.0.1 documentation</title>
2012-03-07 16:35:18 +00:00
<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" />
2012-03-08 18:36:47 +00:00
<link rel="next" title="Ansible Modules" href="modules.html" />
<link rel="prev" title="Getting Started" href="gettingstarted.html" />
2012-03-07 16:35:18 +00:00
</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" >
2012-03-08 18:36:47 +00:00
<a href="modules.html" title="Ansible Modules"
2012-03-07 16:35:18 +00:00
accesskey="N">next</a> |</li>
<li class="right" >
2012-03-08 18:36:47 +00:00
<a href="gettingstarted.html" title="Getting Started"
2012-03-07 16:35:18 +00:00
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">
2012-03-08 18:53:48 +00:00
<div class="section" id="the-inventory-file-patterns-and-groups">
<h1>The Inventory File, Patterns, and Groups<a class="headerlink" href="#the-inventory-file-patterns-and-groups" title="Permalink to this headline"></a></h1>
2012-03-08 18:36:47 +00:00
<p>How to select hosts you wish to manage</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>Examples</em></a></dt>
<dd>Examples of basic commands</dd>
2012-03-08 18:53:48 +00:00
<dt><a class="reference internal" href="playbooks.html"><em>Playbooks: Ansible for Deployment, Configuration Management, and Orchestration</em></a></dt>
2012-03-08 18:36:47 +00:00
<dd>Learning ansible&#8217;s configuration management language</dd>
</dl>
</div>
2012-03-08 18:53:48 +00:00
<div class="section" id="inventory-file-format">
<h2>Inventory File Format<a class="headerlink" href="#inventory-file-format" title="Permalink to this headline"></a></h2>
2012-03-08 18:36:47 +00:00
<p>Ansible works against multiple systems in your infrastructure at the
same time. It does this by selecting portions of systems listed in Ansible&#8217;s inventory file,
which defaults to /etc/ansible/hosts, and looks like this:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">mail</span><span class="o">.</span><span class="n">example</span><span class="o">.</span><span class="n">com</span>
<span class="p">[</span><span class="n">webservers</span><span class="p">]</span>
<span class="n">foo</span><span class="o">.</span><span class="n">example</span><span class="o">.</span><span class="n">com</span>
<span class="n">bar</span><span class="o">.</span><span class="n">example</span><span class="o">.</span><span class="n">com</span>
<span class="p">[</span><span class="n">dbservers</span><span class="p">]</span>
<span class="n">one</span><span class="o">.</span><span class="n">example</span><span class="o">.</span><span class="n">com</span>
<span class="n">two</span><span class="o">.</span><span class="n">example</span><span class="o">.</span><span class="n">com</span>
<span class="n">three</span><span class="o">.</span><span class="n">example</span><span class="o">.</span><span class="n">com</span>
</pre></div>
</div>
</div>
2012-03-08 18:53:48 +00:00
<div class="section" id="selecting-targets">
<h2>Selecting Targets<a class="headerlink" href="#selecting-targets" title="Permalink to this headline"></a></h2>
<p>These patterns target all hosts in the inventory file:</p>
<div class="highlight-python"><pre>all
*</pre>
2012-03-08 18:36:47 +00:00
</div>
2012-03-08 18:53:48 +00:00
<p>It is also possible to address specific hosts:</p>
<div class="highlight-python"><pre>one.example.com
one.example.com:two.example.com</pre>
</div>
<p>The following patterns address one or more groups, which are denoted with the bracket
headers in the inventory file:</p>
<div class="highlight-python"><pre>webservers
webservers:dbservers</pre>
2012-03-08 18:36:47 +00:00
</div>
<p>Individual hosts, but not groups, can also be referenced using wildcards:</p>
<blockquote>
<div><a href="#id1"><span class="problematic" id="id2">*</span></a>.example.com
<a href="#id3"><span class="problematic" id="id4">*</span></a>.com</div></blockquote>
2012-03-08 18:53:48 +00:00
<p>It&#8217;s also ok to mix wildcard patterns and groups at the same time:</p>
<div class="highlight-python"><pre>one*.com:dbservers</pre>
2012-03-08 18:36:47 +00:00
</div>
2012-03-08 18:53:48 +00:00
<p>NOTE: It is not possible to target a host not in the inventory file.</p>
2012-03-08 18:36:47 +00:00
</div>
2012-03-07 16:35:18 +00:00
</div>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
2012-03-08 18:36:47 +00:00
<h3><a href="index.html">Table Of Contents</a></h3>
<ul>
2012-03-08 18:53:48 +00:00
<li><a class="reference internal" href="#">The Inventory File, Patterns, and Groups</a><ul>
<li><a class="reference internal" href="#inventory-file-format">Inventory File Format</a></li>
<li><a class="reference internal" href="#selecting-targets">Selecting Targets</a></li>
2012-03-08 18:36:47 +00:00
</ul>
</li>
</ul>
2012-03-07 16:35:18 +00:00
<h4>Previous topic</h4>
2012-03-08 18:36:47 +00:00
<p class="topless"><a href="gettingstarted.html"
title="previous chapter">Getting Started</a></p>
2012-03-07 16:35:18 +00:00
<h4>Next topic</h4>
<p class="topless"><a href="modules.html"
2012-03-08 18:36:47 +00:00
title="next chapter">Ansible Modules</a></p>
2012-03-07 16:35:18 +00:00
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/patterns.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">
2012-03-08 18:36:47 +00:00
<input type="text" name="q" />
2012-03-07 16:35:18 +00:00
<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" >
2012-03-08 18:36:47 +00:00
<a href="modules.html" title="Ansible Modules"
2012-03-07 16:35:18 +00:00
>next</a> |</li>
<li class="right" >
2012-03-08 18:36:47 +00:00
<a href="gettingstarted.html" title="Getting Started"
2012-03-07 16:35:18 +00:00
>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.
2012-03-08 18:36:47 +00:00
Last updated on Mar 08, 2012.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.8.
2012-03-07 16:35:18 +00:00
</div>
</body>
</html>