Document variable precedence / rebuild

This commit is contained in:
Michael DeHaan 2012-08-21 22:02:43 -04:00
parent 68f07e83d9
commit b8ba2d3066
17 changed files with 55 additions and 16 deletions

View file

@ -289,7 +289,7 @@ languages:
</p>
<p>
&copy; Copyright 2012 Michael DeHaan.<br/>
Last updated on Aug 20, 2012.<br/>
Last updated on Aug 21, 2012.<br/>
</p>
</div>
</footer>

View file

@ -468,7 +468,7 @@ e.g.
</p>
<p>
&copy; Copyright 2012 Michael DeHaan.<br/>
Last updated on Aug 20, 2012.<br/>
Last updated on Aug 21, 2012.<br/>
</p>
</div>
</footer>

View file

@ -340,7 +340,7 @@ different variables to different geographies.</p>
</p>
<p>
&copy; Copyright 2012 Michael DeHaan.<br/>
Last updated on Aug 20, 2012.<br/>
Last updated on Aug 21, 2012.<br/>
</p>
</div>
</footer>

View file

@ -442,7 +442,7 @@ what their names or IP addresses are).</p>
</p>
<p>
&copy; Copyright 2012 Michael DeHaan.<br/>
Last updated on Aug 20, 2012.<br/>
Last updated on Aug 21, 2012.<br/>
</p>
</div>
</footer>

View file

@ -409,7 +409,7 @@ tasks &#8211; whether for a QA sytem, build system, or anything you can think of
</p>
<p>
&copy; Copyright 2012 Michael DeHaan.<br/>
Last updated on Aug 20, 2012.<br/>
Last updated on Aug 21, 2012.<br/>
</p>
</div>
</footer>

View file

@ -204,7 +204,7 @@ s.parentNode.insertBefore(ga, s);
</p>
<p>
&copy; Copyright 2012 Michael DeHaan.<br/>
Last updated on Aug 20, 2012.<br/>
Last updated on Aug 21, 2012.<br/>
</p>
</div>
</footer>

View file

@ -410,7 +410,7 @@ explore, but you already have a fully working infrastructure!</p>
</p>
<p>
&copy; Copyright 2012 Michael DeHaan.<br/>
Last updated on Aug 20, 2012.<br/>
Last updated on Aug 21, 2012.<br/>
</p>
</div>
</footer>

View file

@ -419,7 +419,7 @@ Puppet Labs, and is now with <a class="reference external" href="http://rpath.co
</p>
<p>
&copy; Copyright 2012 Michael DeHaan.<br/>
Last updated on Aug 20, 2012.<br/>
Last updated on Aug 21, 2012.<br/>
</p>
</div>
</footer>

View file

@ -511,7 +511,7 @@ the program. Stop by the mailing list to inquire about requirements.</p>
</p>
<p>
&copy; Copyright 2012 Michael DeHaan.<br/>
Last updated on Aug 20, 2012.<br/>
Last updated on Aug 21, 2012.<br/>
</p>
</div>
</footer>

View file

@ -1800,7 +1800,7 @@ yum name=httpd state=installed</pre>
</p>
<p>
&copy; Copyright 2012 Michael DeHaan.<br/>
Last updated on Aug 20, 2012.<br/>
Last updated on Aug 21, 2012.<br/>
</p>
</div>
</footer>

View file

@ -392,7 +392,7 @@ Ansible 0.7. Ansible 0.6 includes a <a class="reference external" href="https:/
</p>
<p>
&copy; Copyright 2012 Michael DeHaan.<br/>
Last updated on Aug 20, 2012.<br/>
Last updated on Aug 21, 2012.<br/>
</p>
</div>
</footer>

View file

@ -550,7 +550,7 @@ can do this:</p>
</p>
<p>
&copy; Copyright 2012 Michael DeHaan.<br/>
Last updated on Aug 20, 2012.<br/>
Last updated on Aug 21, 2012.<br/>
</p>
</div>
</footer>

View file

@ -168,6 +168,7 @@ s.parentNode.insertBefore(ga, s);
<li><a class="reference internal" href="#register-variables">Register Variables</a></li>
<li><a class="reference internal" href="#rolling-updates">Rolling Updates</a></li>
<li><a class="reference internal" href="#delegation">Delegation</a></li>
<li><a class="reference internal" href="#understanding-variable-precedence">Understanding Variable Precedence</a></li>
<li><a class="reference internal" href="#style-points">Style Points</a></li>
</ul>
</li>
@ -652,6 +653,22 @@ a good idea:</p>
local_action: command /usr/bin/add_back_to_pool $inventory_hostname</pre>
</div>
</div>
<div class="section" id="understanding-variable-precedence">
<h2>Understanding Variable Precedence<a class="headerlink" href="#understanding-variable-precedence" title="Permalink to this headline"></a></h2>
<p>You have already learned about inventory host and group variables, &#8216;vars&#8217;, and &#8216;vars_files&#8217;.</p>
<p>If a variable name is defined in more than one place with the same name, priority is as follows
to determine which place sets the value of the variable.</p>
<ol class="arabic simple">
<li>Variables loaded from YAML files mentioned in &#8216;vars_files&#8217; in a playbook.</li>
<li>&#8216;vars&#8217; as defined in the playbook.</li>
<li>facts, whether built in or custom, or variables assigned from the &#8216;register&#8217; keyword.</li>
<li>variables passed to parameterized task include statements.</li>
<li>Host variables from inventory.</li>
<li>Group variables from inventory, in order of least specific group to most specific.</li>
</ol>
<p>Therefore, if you want to set a default value for something you wish to override somewhere else, the best
place to set such a default is in a group variable.</p>
</div>
<div class="section" id="style-points">
<h2>Style Points<a class="headerlink" href="#style-points" title="Permalink to this headline"></a></h2>
<p>Ansible playbooks are colorized. If you do not like this, set the ANSIBLE_NOCOLOR=1 environment variable.</p>
@ -708,7 +725,7 @@ a good idea:</p>
</p>
<p>
&copy; Copyright 2012 Michael DeHaan.<br/>
Last updated on Aug 20, 2012.<br/>
Last updated on Aug 21, 2012.<br/>
</p>
</div>
</footer>

View file

@ -517,6 +517,28 @@ Here is the same playbook as above, but using the shorthand syntax,
- name: add back to load balancer pool
local_action: command /usr/bin/add_back_to_pool $inventory_hostname
Understanding Variable Precedence
`````````````````````````````````
You have already learned about inventory host and group variables, 'vars', and 'vars_files'.
If a variable name is defined in more than one place with the same name, priority is as follows
to determine which place sets the value of the variable.
1. Variables loaded from YAML files mentioned in 'vars_files' in a playbook.
2. 'vars' as defined in the playbook.
3. facts, whether built in or custom, or variables assigned from the 'register' keyword.
4. variables passed to parameterized task include statements.
5. Host variables from inventory.
6. Group variables from inventory, in order of least specific group to most specific.
Therefore, if you want to set a default value for something you wish to override somewhere else, the best
place to set such a default is in a group variable.
Style Points
````````````

View file

@ -221,7 +221,7 @@ s.parentNode.insertBefore(ga, s);
</p>
<p>
&copy; Copyright 2012 Michael DeHaan.<br/>
Last updated on Aug 20, 2012.<br/>
Last updated on Aug 21, 2012.<br/>
</p>
</div>
</footer>

File diff suppressed because one or more lines are too long

View file

@ -269,7 +269,7 @@ s.parentNode.insertBefore(ga, s);
</p>
<p>
&copy; Copyright 2012 Michael DeHaan.<br/>
Last updated on Aug 20, 2012.<br/>
Last updated on Aug 21, 2012.<br/>
</p>
</div>
</footer>