mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
171 lines
No EOL
7.3 KiB
HTML
171 lines
No EOL
7.3 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>The Inventory File, Patterns, and Groups — 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> »</li>
|
|
</ul>
|
|
</div>
|
|
|
|
<div class="document">
|
|
<div class="documentwrapper">
|
|
<div class="bodywrapper">
|
|
<div class="body">
|
|
|
|
<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>
|
|
<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: Ansible for Deployment, Configuration Management, and Orchestration</em></a></dt>
|
|
<dd>Learning ansible’s configuration management language</dd>
|
|
</dl>
|
|
</div>
|
|
<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>
|
|
<p>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,
|
|
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>
|
|
<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>
|
|
</div>
|
|
<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>
|
|
</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>
|
|
<p>It’s also ok to mix wildcard patterns and groups at the same time:</p>
|
|
<div class="highlight-python"><pre>one*.com:dbservers</pre>
|
|
</div>
|
|
<p>NOTE: 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="#">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>
|
|
</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> »</li>
|
|
</ul>
|
|
</div>
|
|
<div class="footer">
|
|
© 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> |