1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/html/patterns.html
Michael DeHaan 12fd193450 Docs updates
2012-03-08 13:36:47 -05:00

180 lines
No EOL
7.7 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>Patterns &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="Ansible Modules" href="modules.html" />
<link rel="prev" title="Getting Started" href="gettingstarted.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="modules.html" title="Ansible Modules"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="gettingstarted.html" title="Getting Started"
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="patterns">
<h1>Patterns<a class="headerlink" href="#patterns" title="Permalink to this headline"></a></h1>
<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>
<dt><a class="reference internal" href="playbooks.html"><em>Playbooks</em></a></dt>
<dd>Learning ansible&#8217;s configuration management language</dd>
</dl>
</div>
<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 class="section" id="targetting-all-systems">
<h2>Targetting All Systems<a class="headerlink" href="#targetting-all-systems" title="Permalink to this headline"></a></h2>
<p>The pattern &#8216;all&#8217; or &#8216;*&#8217; targets all systems in the inventory file.</p>
</div>
<div class="section" id="specific-hosts">
<h2>Specific Hosts<a class="headerlink" href="#specific-hosts" title="Permalink to this headline"></a></h2>
<p>It is possible to address specific hosts:</p>
<blockquote>
<div>one.example.com
one.example.com:two.example.com</div></blockquote>
</div>
<div class="section" id="groups">
<h2>Groups<a class="headerlink" href="#groups" title="Permalink to this headline"></a></h2>
<p>The following patterns address one or more groups:</p>
<blockquote>
<div>webservers
webservers:dbservers</div></blockquote>
<p>There is also a magic group &#8216;ungrouped&#8217; which selects systems not in a group.</p>
</div>
<div class="section" id="wildcards">
<h2>Wildcards<a class="headerlink" href="#wildcards" title="Permalink to this headline"></a></h2>
<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>
</div>
<div class="section" id="mixing-things-up">
<h2>Mixing Things Up<a class="headerlink" href="#mixing-things-up" title="Permalink to this headline"></a></h2>
<p>Specific hosts, wildcards, and groups can all be mixed in the same pattern</p>
<blockquote>
<div>one*.com:dbservers</div></blockquote>
<p>It is not possible to target a host not in the inventory file.</p>
</div>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<h3><a href="index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">Patterns</a><ul>
<li><a class="reference internal" href="#targetting-all-systems">Targetting All Systems</a></li>
<li><a class="reference internal" href="#specific-hosts">Specific Hosts</a></li>
<li><a class="reference internal" href="#groups">Groups</a></li>
<li><a class="reference internal" href="#wildcards">Wildcards</a></li>
<li><a class="reference internal" href="#mixing-things-up">Mixing Things Up</a></li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="gettingstarted.html"
title="previous chapter">Getting Started</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="modules.html"
title="next chapter">Ansible Modules</a></p>
<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">
<input type="text" name="q" />
<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="modules.html" title="Ansible Modules"
>next</a> |</li>
<li class="right" >
<a href="gettingstarted.html" title="Getting Started"
>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 08, 2012.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.8.
</div>
</body>
</html>