Commit 0165ceb3 by Michael DeHaan

Document how to reference variables about another host from any host.

parent 81773f56
......@@ -323,6 +323,7 @@ Email: <input type=text name=email>&nbsp;&nbsp;<input type=submit name="sub" val
<li class="toctree-l2"><a class="reference internal" href="playbooks.html#running-operations-on-change">Running Operations On Change</a></li>
<li class="toctree-l2"><a class="reference internal" href="playbooks.html#power-tricks">Power Tricks</a><ul>
<li class="toctree-l3"><a class="reference internal" href="playbooks.html#local-playbooks">Local Playbooks</a></li>
<li class="toctree-l3"><a class="reference internal" href="playbooks.html#variables-from-other-hosts">Variables From Other Hosts</a></li>
<li class="toctree-l3"><a class="reference internal" href="playbooks.html#external-variables-and-prompted-or-sensitive-data">External Variables And Prompted or Sensitive Data</a></li>
<li class="toctree-l3"><a class="reference internal" href="playbooks.html#conditional-execution">Conditional Execution</a></li>
<li class="toctree-l3"><a class="reference internal" href="playbooks.html#conditional-imports">Conditional Imports</a></li>
......
......@@ -139,6 +139,7 @@ s.parentNode.insertBefore(ga, s);
<li><a class="reference internal" href="#running-operations-on-change">Running Operations On Change</a></li>
<li><a class="reference internal" href="#power-tricks">Power Tricks</a><ul>
<li><a class="reference internal" href="#local-playbooks">Local Playbooks</a></li>
<li><a class="reference internal" href="#variables-from-other-hosts">Variables From Other Hosts</a></li>
<li><a class="reference internal" href="#external-variables-and-prompted-or-sensitive-data">External Variables And Prompted or Sensitive Data</a></li>
<li><a class="reference internal" href="#conditional-execution">Conditional Execution</a></li>
<li><a class="reference internal" href="#conditional-imports">Conditional Imports</a></li>
......@@ -377,6 +378,15 @@ use the default remote connection type:</p>
connection: local</pre>
</div>
</div>
<div class="section" id="variables-from-other-hosts">
<h3>Variables From Other Hosts<a class="headerlink" href="#variables-from-other-hosts" title="Permalink to this headline"></a></h3>
<p>If your database server wants to check the value of a &#8216;fact&#8217; from another node, it&#8217;s easy to do so
within a template or even an action line:</p>
<div class="highlight-python"><pre>{{ hostvars.get('name_of_host').get('name_of_fact') }}</pre>
</div>
<p>NOTE: No database or other complex system is required to exchange data between hosts. The hosts that you
want to reference data from must be included in either the current play or any previous play.</p>
</div>
<div class="section" id="external-variables-and-prompted-or-sensitive-data">
<h3>External Variables And Prompted or Sensitive Data<a class="headerlink" href="#external-variables-and-prompted-or-sensitive-data" title="Permalink to this headline"></a></h3>
<p>It&#8217;s a great idea to keep your playbooks under source control, but
......
......@@ -244,6 +244,16 @@ use the default remote connection type::
hosts: 127.0.0.1
connection: local
Variables From Other Hosts
++++++++++++++++++++++++++
If your database server wants to check the value of a 'fact' from another node, it's easy to do so
within a template or even an action line::
{{ hostvars.get('name_of_host').get('name_of_fact') }}
NOTE: No database or other complex system is required to exchange data between hosts. The hosts that you
want to reference data from must be included in either the current play or any previous play.
External Variables And Prompted or Sensitive Data
+++++++++++++++++++++++++++++++++++++++++++++++++
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment