mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 13:22:48 +00:00
fix rst + docs rebuild
This commit is contained in:
@@ -149,6 +149,7 @@ s.parentNode.insertBefore(ga, s);
|
||||
<li><a class="reference internal" href="#tutorial">Tutorial</a></li>
|
||||
<li><a class="reference internal" href="#testing-modules">Testing Modules</a></li>
|
||||
<li><a class="reference internal" href="#reading-input">Reading Input</a></li>
|
||||
<li><a class="reference internal" href="#module-provided-facts">Module Provided ‘Facts’</a></li>
|
||||
<li><a class="reference internal" href="#common-pitfalls">Common Pitfalls</a></li>
|
||||
<li><a class="reference internal" href="#conventions">Conventions</a></li>
|
||||
<li><a class="reference internal" href="#shorthand-vs-json">Shorthand Vs JSON</a></li>
|
||||
@@ -328,10 +329,32 @@ a lot shorter than this:</p>
|
||||
<div class="highlight-python"><pre>ansible/hacking/test-module ./time time=\"March 14 12:23\"</pre>
|
||||
</div>
|
||||
<p>This should return something like:</p>
|
||||
<div class="highlight-python"><div class="highlight"><pre><span class="p">{</span><span class="s">"changed"</span><span class="p">:</span> <span class="n">true</span><span class="p">,</span> <span class="s">"time"</span><span class="p">:</span> <span class="s">"2012-03-14 12:23:00.000307"</span><span class="p">}</span>
|
||||
<div class="highlight-python"><div class="highlight"><pre><span class="p">{</span><span class="s">"changed"</span><span class="p">:</span> <span class="bp">True</span><span class="p">,</span> <span class="s">"time"</span><span class="p">:</span> <span class="s">"2012-03-14 12:23:00.000307"</span><span class="p">}</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="module-provided-facts">
|
||||
<h2>Module Provided ‘Facts’<a class="headerlink" href="#module-provided-facts" title="Permalink to this headline">¶</a></h2>
|
||||
<p>The ‘setup’ module that ships with Ansible provides many variables about a system that can be used in playbooks
|
||||
and templates. However, it’s possible to also add your own facts without modifying the system module. To do
|
||||
this, just have the module return a <cite>ansible_facts</cite> key, like so, along with other return data. This requires
|
||||
Ansible 0.4 and later:</p>
|
||||
<div class="highlight-python"><pre>{
|
||||
"changed" : True,
|
||||
"rc" : 5,
|
||||
"ansible_facts" : {
|
||||
"leptons" : 5000
|
||||
"colors" : {
|
||||
"red" : "FF0000",
|
||||
"white" : "FFFFFF"
|
||||
}
|
||||
}
|
||||
}</pre>
|
||||
</div>
|
||||
<p>These ‘facts’ will be available to all statements called after that module (but not before) in the playbook.
|
||||
A good idea might be make a module called ‘site_facts’ and always call it at the top of each playbook, though
|
||||
we’re always open to improving the selection of core facts in Ansible as well.</p>
|
||||
</div>
|
||||
<div class="section" id="common-pitfalls">
|
||||
<h2>Common Pitfalls<a class="headerlink" href="#common-pitfalls" title="Permalink to this headline">¶</a></h2>
|
||||
<p>If writing a module in Python and you have managed nodes running
|
||||
@@ -430,7 +453,7 @@ Stop by the mailing list to inquire about requirements.</p>
|
||||
</p>
|
||||
<p>
|
||||
© Copyright 2012 Michael DeHaan.<br/>
|
||||
Last updated on May 06, 2012.<br/>
|
||||
Last updated on May 10, 2012.<br/>
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
Reference in New Issue
Block a user