mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Document YAML inventory + eBuilds
This commit is contained in:
parent
b30aadcf0b
commit
48d3881d17
15 changed files with 124 additions and 31 deletions
|
@ -245,7 +245,7 @@ languages:
|
||||||
<p class="pull-right"><a href="#">Back to top</a></p>
|
<p class="pull-right"><a href="#">Back to top</a></p>
|
||||||
<p>
|
<p>
|
||||||
© Copyright 2012 Michael DeHaan.<br/>
|
© Copyright 2012 Michael DeHaan.<br/>
|
||||||
Last updated on Apr 16, 2012.<br/>
|
Last updated on Apr 17, 2012.<br/>
|
||||||
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.8.<br/>
|
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.8.<br/>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
2
api.html
2
api.html
|
@ -329,7 +329,7 @@ a conf.d file appropriately or something similar. Who knows.</p>
|
||||||
<p class="pull-right"><a href="#">Back to top</a></p>
|
<p class="pull-right"><a href="#">Back to top</a></p>
|
||||||
<p>
|
<p>
|
||||||
© Copyright 2012 Michael DeHaan.<br/>
|
© Copyright 2012 Michael DeHaan.<br/>
|
||||||
Last updated on Apr 16, 2012.<br/>
|
Last updated on Apr 17, 2012.<br/>
|
||||||
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.8.<br/>
|
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.8.<br/>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -342,7 +342,7 @@ a simplified syntax for this.</p>
|
||||||
<p class="pull-right"><a href="#">Back to top</a></p>
|
<p class="pull-right"><a href="#">Back to top</a></p>
|
||||||
<p>
|
<p>
|
||||||
© Copyright 2012 Michael DeHaan.<br/>
|
© Copyright 2012 Michael DeHaan.<br/>
|
||||||
Last updated on Apr 16, 2012.<br/>
|
Last updated on Apr 17, 2012.<br/>
|
||||||
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.8.<br/>
|
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.8.<br/>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
2
faq.html
2
faq.html
|
@ -351,7 +351,7 @@ tasks – whether for a QA sytem, build system, or anything you can think of
|
||||||
<p class="pull-right"><a href="#">Back to top</a></p>
|
<p class="pull-right"><a href="#">Back to top</a></p>
|
||||||
<p>
|
<p>
|
||||||
© Copyright 2012 Michael DeHaan.<br/>
|
© Copyright 2012 Michael DeHaan.<br/>
|
||||||
Last updated on Apr 16, 2012.<br/>
|
Last updated on Apr 17, 2012.<br/>
|
||||||
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.8.<br/>
|
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.8.<br/>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -160,7 +160,7 @@ s.parentNode.insertBefore(ga, s);
|
||||||
<p class="pull-right"><a href="#">Back to top</a></p>
|
<p class="pull-right"><a href="#">Back to top</a></p>
|
||||||
<p>
|
<p>
|
||||||
© Copyright 2012 Michael DeHaan.<br/>
|
© Copyright 2012 Michael DeHaan.<br/>
|
||||||
Last updated on Apr 16, 2012.<br/>
|
Last updated on Apr 17, 2012.<br/>
|
||||||
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.8.<br/>
|
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.8.<br/>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -240,9 +240,10 @@ same version. This is perfectly safe to do.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="other-package-distributions">
|
<div class="section" id="other-package-distributions">
|
||||||
<h3>Other Package Distributions<a class="headerlink" href="#other-package-distributions" title="Permalink to this headline">¶</a></h3>
|
<h3>Other Package Distributions<a class="headerlink" href="#other-package-distributions" title="Permalink to this headline">¶</a></h3>
|
||||||
<p>If you would like to package Ansible for Debian/Ubuntu, Homebrew, or BSD,
|
<p><a class="reference external" href="https://github.com/uu/ubuilds">Gentoo eBuilds are here</a></p>
|
||||||
please stop by the mailing list and say hi. We’d love to have that as well
|
<p>Debian packages are in progress.</p>
|
||||||
and it shouldn’t be difficult and would be happy to help.</p>
|
<p>If you would like to package Ansible for Homebrew, BSD, or others,
|
||||||
|
please stop by the mailing list and say hi.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="tagged-releases">
|
<div class="section" id="tagged-releases">
|
||||||
<h3>Tagged Releases<a class="headerlink" href="#tagged-releases" title="Permalink to this headline">¶</a></h3>
|
<h3>Tagged Releases<a class="headerlink" href="#tagged-releases" title="Permalink to this headline">¶</a></h3>
|
||||||
|
@ -303,7 +304,7 @@ explore, but you already have a fully working infrastructure!</p>
|
||||||
<p class="pull-right"><a href="#">Back to top</a></p>
|
<p class="pull-right"><a href="#">Back to top</a></p>
|
||||||
<p>
|
<p>
|
||||||
© Copyright 2012 Michael DeHaan.<br/>
|
© Copyright 2012 Michael DeHaan.<br/>
|
||||||
Last updated on Apr 16, 2012.<br/>
|
Last updated on Apr 17, 2012.<br/>
|
||||||
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.8.<br/>
|
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.8.<br/>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -267,8 +267,9 @@ Email: <input type=text name=email> <input type=submit name="sub" val
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="patterns.html">The Inventory File, Patterns, and Groups</a><ul>
|
<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#baisc-inventory-file-format">Baisc Inventory File Format</a></li>
|
||||||
<li class="toctree-l2"><a class="reference internal" href="patterns.html#selecting-targets">Selecting Targets</a></li>
|
<li class="toctree-l2"><a class="reference internal" href="patterns.html#selecting-targets">Selecting Targets</a></li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="patterns.html#advanced-inventory-file-format">Advanced Inventory File Format</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="examples.html">Command Line Examples</a><ul>
|
<li class="toctree-l1"><a class="reference internal" href="examples.html">Command Line Examples</a><ul>
|
||||||
|
@ -393,7 +394,7 @@ Puppet Labs, and rPath. Reach Michael by email <a class="reference external" hr
|
||||||
<p class="pull-right"><a href="#">Back to top</a></p>
|
<p class="pull-right"><a href="#">Back to top</a></p>
|
||||||
<p>
|
<p>
|
||||||
© Copyright 2012 Michael DeHaan.<br/>
|
© Copyright 2012 Michael DeHaan.<br/>
|
||||||
Last updated on Apr 16, 2012.<br/>
|
Last updated on Apr 17, 2012.<br/>
|
||||||
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.8.<br/>
|
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.8.<br/>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -394,7 +394,7 @@ Stop by the mailing list to inquire about requirements.</p>
|
||||||
<p class="pull-right"><a href="#">Back to top</a></p>
|
<p class="pull-right"><a href="#">Back to top</a></p>
|
||||||
<p>
|
<p>
|
||||||
© Copyright 2012 Michael DeHaan.<br/>
|
© Copyright 2012 Michael DeHaan.<br/>
|
||||||
Last updated on Apr 16, 2012.<br/>
|
Last updated on Apr 17, 2012.<br/>
|
||||||
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.8.<br/>
|
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.8.<br/>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -613,7 +613,7 @@ yum pkg=httpd ensure=installed</pre>
|
||||||
<p class="pull-right"><a href="#">Back to top</a></p>
|
<p class="pull-right"><a href="#">Back to top</a></p>
|
||||||
<p>
|
<p>
|
||||||
© Copyright 2012 Michael DeHaan.<br/>
|
© Copyright 2012 Michael DeHaan.<br/>
|
||||||
Last updated on Apr 16, 2012.<br/>
|
Last updated on Apr 17, 2012.<br/>
|
||||||
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.8.<br/>
|
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.8.<br/>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -129,8 +129,9 @@ s.parentNode.insertBefore(ga, s);
|
||||||
class="dropdown-toggle">Page</a>
|
class="dropdown-toggle">Page</a>
|
||||||
<span class="localtoc"><ul>
|
<span class="localtoc"><ul>
|
||||||
<li><a class="reference internal" href="#">The Inventory File, Patterns, and Groups</a><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="#baisc-inventory-file-format">Baisc Inventory File Format</a></li>
|
||||||
<li><a class="reference internal" href="#selecting-targets">Selecting Targets</a></li>
|
<li><a class="reference internal" href="#selecting-targets">Selecting Targets</a></li>
|
||||||
|
<li><a class="reference internal" href="#advanced-inventory-file-format">Advanced Inventory File Format</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -160,8 +161,8 @@ s.parentNode.insertBefore(ga, s);
|
||||||
<p>Ansible works against multiple systems in your infrastructure at the
|
<p>Ansible works against multiple systems in your infrastructure at the
|
||||||
same time. It does this by selecting portions of systems listed in
|
same time. It does this by selecting portions of systems listed in
|
||||||
Ansible’s inventory file, which defaults to /etc/ansible/hosts.</p>
|
Ansible’s inventory file, which defaults to /etc/ansible/hosts.</p>
|
||||||
<div class="section" id="inventory-file-format">
|
<div class="section" id="baisc-inventory-file-format">
|
||||||
<span id="inventoryformat"></span><h2>Inventory File Format<a class="headerlink" href="#inventory-file-format" title="Permalink to this headline">¶</a></h2>
|
<span id="inventoryformat"></span><h2>Baisc Inventory File Format<a class="headerlink" href="#baisc-inventory-file-format" title="Permalink to this headline">¶</a></h2>
|
||||||
<p>The format for /etc/ansible/hosts looks like this:</p>
|
<p>The format for /etc/ansible/hosts 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>
|
<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>
|
||||||
|
|
||||||
|
@ -216,7 +217,51 @@ wildcards:</p>
|
||||||
<p class="first admonition-title">Note</p>
|
<p class="first admonition-title">Note</p>
|
||||||
<p class="last">It is not possible to target a host not in the inventory file. This is a safety feature.</p>
|
<p class="last">It is not possible to target a host not in the inventory file. This is a safety feature.</p>
|
||||||
</div>
|
</div>
|
||||||
<p>Easy enough. Now see <a class="reference internal" href="examples.html"><em>Command Line Examples</em></a> and then <a class="reference internal" href="playbooks.html"><em>Playbooks</em></a> for how to do things to selected hosts.</p>
|
<p>Easy enough. See <a class="reference internal" href="examples.html"><em>Command Line Examples</em></a> and then <a class="reference internal" href="playbooks.html"><em>Playbooks</em></a> for how to do things to selected hosts.</p>
|
||||||
|
</div>
|
||||||
|
<div class="section" id="advanced-inventory-file-format">
|
||||||
|
<h2>Advanced Inventory File Format<a class="headerlink" href="#advanced-inventory-file-format" title="Permalink to this headline">¶</a></h2>
|
||||||
|
<p>(This features requires the integration branch of Ansible, soon to be release 0.3)</p>
|
||||||
|
<p>Once you read about playbooks you’ll quickly see how useful it will be to assign particular variables
|
||||||
|
to particular hosts and groups of hosts. While the default INI-style host format doesn’t allow this,
|
||||||
|
switching to the YAML inventory format can add some compelling capabilities. Just replace your INI
|
||||||
|
style file with a YAML one.:</p>
|
||||||
|
<div class="highlight-python"><pre>---
|
||||||
|
|
||||||
|
# some ungrouped hosts, either use the short string form or the "host: " prefix
|
||||||
|
- host: jupiter
|
||||||
|
- mars
|
||||||
|
|
||||||
|
# variables can be assigned like this...
|
||||||
|
- host: saturn
|
||||||
|
vars:
|
||||||
|
- moon: titan
|
||||||
|
|
||||||
|
# groups can also set variables to all hosts in the group
|
||||||
|
# here are a bunch of hosts using a non-standard SSH port
|
||||||
|
# and also defining a variable 'ntpserver'
|
||||||
|
- group: greek
|
||||||
|
hosts:
|
||||||
|
- zeus
|
||||||
|
- hera
|
||||||
|
- poseidon
|
||||||
|
vars:
|
||||||
|
- ansible_ssh_port: 3000
|
||||||
|
- ntp_server: olympus.example.com
|
||||||
|
|
||||||
|
# individual hosts can still set variables inside of groups too
|
||||||
|
# so you aren't limited to just group variables and host variables.
|
||||||
|
- group: norse
|
||||||
|
hosts:
|
||||||
|
- host: thor
|
||||||
|
vars:
|
||||||
|
- hammer: True
|
||||||
|
- odin
|
||||||
|
- loki
|
||||||
|
vars:
|
||||||
|
- asdf: 1234</pre>
|
||||||
|
</div>
|
||||||
|
<p>Tip: Be sure to start your YAML file with the YAML record designator “—”.</p>
|
||||||
<div class="admonition-see-also admonition seealso">
|
<div class="admonition-see-also admonition seealso">
|
||||||
<p class="first admonition-title">See also</p>
|
<p class="first admonition-title">See also</p>
|
||||||
<dl class="last docutils">
|
<dl class="last docutils">
|
||||||
|
@ -240,7 +285,7 @@ wildcards:</p>
|
||||||
<p class="pull-right"><a href="#">Back to top</a></p>
|
<p class="pull-right"><a href="#">Back to top</a></p>
|
||||||
<p>
|
<p>
|
||||||
© Copyright 2012 Michael DeHaan.<br/>
|
© Copyright 2012 Michael DeHaan.<br/>
|
||||||
Last updated on Apr 16, 2012.<br/>
|
Last updated on Apr 17, 2012.<br/>
|
||||||
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.8.<br/>
|
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.8.<br/>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -416,10 +416,6 @@ in a push-script:</p>
|
||||||
favcolor: "what is your favorite color?"</pre>
|
favcolor: "what is your favorite color?"</pre>
|
||||||
</div>
|
</div>
|
||||||
<p>There are full examples of both of these items in the github examples/playbooks directory.</p>
|
<p>There are full examples of both of these items in the github examples/playbooks directory.</p>
|
||||||
<p>Finally, there exists one more option, which feeds variables in from the command line,
|
|
||||||
rather than sourcing them from the usual means:</p>
|
|
||||||
<div class="highlight-python"><pre>ansible-playbook foo.yml --extra-vars="release_version=1234 capital_of_assyria=idontknow"</pre>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="conditional-execution">
|
<div class="section" id="conditional-execution">
|
||||||
<h3>Conditional Execution<a class="headerlink" href="#conditional-execution" title="Permalink to this headline">¶</a></h3>
|
<h3>Conditional Execution<a class="headerlink" href="#conditional-execution" title="Permalink to this headline">¶</a></h3>
|
||||||
|
@ -662,7 +658,7 @@ Let’s run a playbook using a parallelism level of 10:</p>
|
||||||
<p class="pull-right"><a href="#">Back to top</a></p>
|
<p class="pull-right"><a href="#">Back to top</a></p>
|
||||||
<p>
|
<p>
|
||||||
© Copyright 2012 Michael DeHaan.<br/>
|
© Copyright 2012 Michael DeHaan.<br/>
|
||||||
Last updated on Apr 16, 2012.<br/>
|
Last updated on Apr 17, 2012.<br/>
|
||||||
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.8.<br/>
|
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.8.<br/>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -90,9 +90,12 @@ same version. This is perfectly safe to do.
|
||||||
Other Package Distributions
|
Other Package Distributions
|
||||||
+++++++++++++++++++++++++++
|
+++++++++++++++++++++++++++
|
||||||
|
|
||||||
If you would like to package Ansible for Debian/Ubuntu, Homebrew, or BSD,
|
`Gentoo eBuilds are here <https://github.com/uu/ubuilds>`_
|
||||||
please stop by the mailing list and say hi. We'd love to have that as well
|
|
||||||
and it shouldn't be difficult and would be happy to help.
|
Debian packages are in progress.
|
||||||
|
|
||||||
|
If you would like to package Ansible for Homebrew, BSD, or others,
|
||||||
|
please stop by the mailing list and say hi.
|
||||||
|
|
||||||
|
|
||||||
Tagged Releases
|
Tagged Releases
|
||||||
|
|
|
@ -9,8 +9,8 @@ Ansible's inventory file, which defaults to /etc/ansible/hosts.
|
||||||
|
|
||||||
.. _inventoryformat:
|
.. _inventoryformat:
|
||||||
|
|
||||||
Inventory File Format
|
Baisc Inventory File Format
|
||||||
+++++++++++++++++++++
|
+++++++++++++++++++++++++++
|
||||||
|
|
||||||
The format for /etc/ansible/hosts looks like this::
|
The format for /etc/ansible/hosts looks like this::
|
||||||
|
|
||||||
|
@ -75,7 +75,54 @@ It's also ok to mix wildcard patterns and groups at the same time::
|
||||||
.. note::
|
.. note::
|
||||||
It is not possible to target a host not in the inventory file. This is a safety feature.
|
It is not possible to target a host not in the inventory file. This is a safety feature.
|
||||||
|
|
||||||
Easy enough. Now see :doc:`examples` and then :doc:`playbooks` for how to do things to selected hosts.
|
Easy enough. See :doc:`examples` and then :doc:`playbooks` for how to do things to selected hosts.
|
||||||
|
|
||||||
|
Advanced Inventory File Format
|
||||||
|
++++++++++++++++++++++++++++++
|
||||||
|
|
||||||
|
(This features requires the integration branch of Ansible, soon to be release 0.3)
|
||||||
|
|
||||||
|
Once you read about playbooks you'll quickly see how useful it will be to assign particular variables
|
||||||
|
to particular hosts and groups of hosts. While the default INI-style host format doesn't allow this,
|
||||||
|
switching to the YAML inventory format can add some compelling capabilities. Just replace your INI
|
||||||
|
style file with a YAML one.::
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
# some ungrouped hosts, either use the short string form or the "host: " prefix
|
||||||
|
- host: jupiter
|
||||||
|
- mars
|
||||||
|
|
||||||
|
# variables can be assigned like this...
|
||||||
|
- host: saturn
|
||||||
|
vars:
|
||||||
|
- moon: titan
|
||||||
|
|
||||||
|
# groups can also set variables to all hosts in the group
|
||||||
|
# here are a bunch of hosts using a non-standard SSH port
|
||||||
|
# and also defining a variable 'ntpserver'
|
||||||
|
- group: greek
|
||||||
|
hosts:
|
||||||
|
- zeus
|
||||||
|
- hera
|
||||||
|
- poseidon
|
||||||
|
vars:
|
||||||
|
- ansible_ssh_port: 3000
|
||||||
|
- ntp_server: olympus.example.com
|
||||||
|
|
||||||
|
# individual hosts can still set variables inside of groups too
|
||||||
|
# so you aren't limited to just group variables and host variables.
|
||||||
|
- group: norse
|
||||||
|
hosts:
|
||||||
|
- host: thor
|
||||||
|
vars:
|
||||||
|
- hammer: True
|
||||||
|
- odin
|
||||||
|
- loki
|
||||||
|
vars:
|
||||||
|
- asdf: 1234
|
||||||
|
|
||||||
|
Tip: Be sure to start your YAML file with the YAML record designator "---".
|
||||||
|
|
||||||
.. seealso::
|
.. seealso::
|
||||||
|
|
||||||
|
|
|
@ -177,7 +177,7 @@ s.parentNode.insertBefore(ga, s);
|
||||||
<p class="pull-right"><a href="#">Back to top</a></p>
|
<p class="pull-right"><a href="#">Back to top</a></p>
|
||||||
<p>
|
<p>
|
||||||
© Copyright 2012 Michael DeHaan.<br/>
|
© Copyright 2012 Michael DeHaan.<br/>
|
||||||
Last updated on Apr 16, 2012.<br/>
|
Last updated on Apr 17, 2012.<br/>
|
||||||
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.8.<br/>
|
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.8.<br/>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue