This commit is contained in:
Michael DeHaan 2012-08-09 22:09:05 -04:00
commit 331cfa6b36
6 changed files with 55 additions and 28 deletions

View file

@ -304,9 +304,11 @@ seperate from the inventory file, see the next section.</p>
</div>
<div class="section" id="splitting-out-host-and-group-specific-data">
<h2>Splitting Out Host and Group Specific Data<a class="headerlink" href="#splitting-out-host-and-group-specific-data" title="Permalink to this headline"></a></h2>
<p>In Ansible 0.6 and later, in addition to the storing variables directly in the INI file, host and
group variables can be stored in individual files relative to the inventory file. These
variable files are in YAML format.</p>
<p class="versionadded">
<span class="versionmodified">New in version 0.6.</span></p>
<p>In addition to the storing variables directly in the INI file, host
and group variables can be stored in individual files relative to the
inventory file. These variable files are in YAML format.</p>
<p>Assuming the inventory file path is:</p>
<div class="highlight-python"><pre>/etc/ansible/hosts</pre>
</div>
@ -326,13 +328,17 @@ database_server: storage.example.org</pre>
<p>It is ok if these files do not exist, this is an optional feature.</p>
<p>Tip: Keeping your inventory file and variables in a git repo (or other version control)
is an excellent way to track changes to your inventory and host variables.</p>
<p>Tip: If you ever have two python interpreters on a system, set a variable called &#8216;ansible_python_interpreter&#8217; to
the Python interpreter path you would like to use.</p>
<p class="versionadded">
<span class="versionmodified">New in version 0.5: </span>If you ever have two python interpreters on a system, set a
variable called &#8216;ansible_python_interpreter&#8217; to the Python
interpreter path you would like to use.</p>
</div>
<div class="section" id="yaml-inventory">
<h2>YAML Inventory<a class="headerlink" href="#yaml-inventory" title="Permalink to this headline"></a></h2>
<p>Ansible&#8217;s YAML inventory format is deprecated and will be removed in Ansible 0.7. Ansible 0.6 includes
a <a class="reference external" href="https://github.com/ansible/ansible/blob/devel/examples/scripts/yaml_to_ini.py">conversion script</a>.</p>
<p class="deprecated">
<span class="versionmodified">Deprecated since version 0.7.</span></p>
<p>Ansible&#8217;s YAML inventory format is deprecated and will be removed in
Ansible 0.7. Ansible 0.6 includes a <a class="reference external" href="https://github.com/ansible/ansible/blob/devel/examples/scripts/yaml_to_ini.py">conversion script</a>.</p>
<p>Usage:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">yaml_to_ini</span><span class="o">.</span><span class="n">py</span> <span class="o">/</span><span class="n">etc</span><span class="o">/</span><span class="n">ansible</span><span class="o">/</span><span class="n">hosts</span>
</pre></div>