mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Document how to reference variables about another host from any host.
This commit is contained in:
parent
81773f5635
commit
0165ceb3cc
4 changed files with 22 additions and 1 deletions
|
@ -323,6 +323,7 @@ Email: <input type=text name=email> <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#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-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#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#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-execution">Conditional Execution</a></li>
|
||||||
<li class="toctree-l3"><a class="reference internal" href="playbooks.html#conditional-imports">Conditional Imports</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="#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="#power-tricks">Power Tricks</a><ul>
|
||||||
<li><a class="reference internal" href="#local-playbooks">Local Playbooks</a></li>
|
<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="#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-execution">Conditional Execution</a></li>
|
||||||
<li><a class="reference internal" href="#conditional-imports">Conditional Imports</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>
|
connection: local</pre>
|
||||||
</div>
|
</div>
|
||||||
</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 ‘fact’ from another node, it’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">
|
<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>
|
<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’s a great idea to keep your playbooks under source control, but
|
<p>It’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
|
hosts: 127.0.0.1
|
||||||
connection: local
|
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
|
External Variables And Prompted or Sensitive Data
|
||||||
+++++++++++++++++++++++++++++++++++++++++++++++++
|
+++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue