Document variable precedence / rebuild
This commit is contained in:
parent
68f07e83d9
commit
b8ba2d3066
17 changed files with 55 additions and 16 deletions
|
@ -289,7 +289,7 @@ languages:
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
© Copyright 2012 Michael DeHaan.<br/>
|
© Copyright 2012 Michael DeHaan.<br/>
|
||||||
Last updated on Aug 20, 2012.<br/>
|
Last updated on Aug 21, 2012.<br/>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
2
api.html
2
api.html
|
@ -468,7 +468,7 @@ e.g.
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
© Copyright 2012 Michael DeHaan.<br/>
|
© Copyright 2012 Michael DeHaan.<br/>
|
||||||
Last updated on Aug 20, 2012.<br/>
|
Last updated on Aug 21, 2012.<br/>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
|
@ -340,7 +340,7 @@ different variables to different geographies.</p>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
© Copyright 2012 Michael DeHaan.<br/>
|
© Copyright 2012 Michael DeHaan.<br/>
|
||||||
Last updated on Aug 20, 2012.<br/>
|
Last updated on Aug 21, 2012.<br/>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
|
@ -442,7 +442,7 @@ what their names or IP addresses are).</p>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
© Copyright 2012 Michael DeHaan.<br/>
|
© Copyright 2012 Michael DeHaan.<br/>
|
||||||
Last updated on Aug 20, 2012.<br/>
|
Last updated on Aug 21, 2012.<br/>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
2
faq.html
2
faq.html
|
@ -409,7 +409,7 @@ tasks – whether for a QA sytem, build system, or anything you can think of
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
© Copyright 2012 Michael DeHaan.<br/>
|
© Copyright 2012 Michael DeHaan.<br/>
|
||||||
Last updated on Aug 20, 2012.<br/>
|
Last updated on Aug 21, 2012.<br/>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
|
@ -204,7 +204,7 @@ s.parentNode.insertBefore(ga, s);
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
© Copyright 2012 Michael DeHaan.<br/>
|
© Copyright 2012 Michael DeHaan.<br/>
|
||||||
Last updated on Aug 20, 2012.<br/>
|
Last updated on Aug 21, 2012.<br/>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
|
@ -410,7 +410,7 @@ explore, but you already have a fully working infrastructure!</p>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
© Copyright 2012 Michael DeHaan.<br/>
|
© Copyright 2012 Michael DeHaan.<br/>
|
||||||
Last updated on Aug 20, 2012.<br/>
|
Last updated on Aug 21, 2012.<br/>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
|
@ -419,7 +419,7 @@ Puppet Labs, and is now with <a class="reference external" href="http://rpath.co
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
© Copyright 2012 Michael DeHaan.<br/>
|
© Copyright 2012 Michael DeHaan.<br/>
|
||||||
Last updated on Aug 20, 2012.<br/>
|
Last updated on Aug 21, 2012.<br/>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
|
@ -511,7 +511,7 @@ the program. Stop by the mailing list to inquire about requirements.</p>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
© Copyright 2012 Michael DeHaan.<br/>
|
© Copyright 2012 Michael DeHaan.<br/>
|
||||||
Last updated on Aug 20, 2012.<br/>
|
Last updated on Aug 21, 2012.<br/>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
|
@ -1800,7 +1800,7 @@ yum name=httpd state=installed</pre>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
© Copyright 2012 Michael DeHaan.<br/>
|
© Copyright 2012 Michael DeHaan.<br/>
|
||||||
Last updated on Aug 20, 2012.<br/>
|
Last updated on Aug 21, 2012.<br/>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
|
@ -392,7 +392,7 @@ Ansible 0.7. Ansible 0.6 includes a <a class="reference external" href="https:/
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
© Copyright 2012 Michael DeHaan.<br/>
|
© Copyright 2012 Michael DeHaan.<br/>
|
||||||
Last updated on Aug 20, 2012.<br/>
|
Last updated on Aug 21, 2012.<br/>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
|
@ -550,7 +550,7 @@ can do this:</p>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
© Copyright 2012 Michael DeHaan.<br/>
|
© Copyright 2012 Michael DeHaan.<br/>
|
||||||
Last updated on Aug 20, 2012.<br/>
|
Last updated on Aug 21, 2012.<br/>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
|
@ -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="#register-variables">Register Variables</a></li>
|
||||||
<li><a class="reference internal" href="#rolling-updates">Rolling Updates</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="#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>
|
<li><a class="reference internal" href="#style-points">Style Points</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
@ -652,6 +653,22 @@ a good idea:</p>
|
||||||
local_action: command /usr/bin/add_back_to_pool $inventory_hostname</pre>
|
local_action: command /usr/bin/add_back_to_pool $inventory_hostname</pre>
|
||||||
</div>
|
</div>
|
||||||
</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, ‘vars’, and ‘vars_files’.</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 ‘vars_files’ in a playbook.</li>
|
||||||
|
<li>‘vars’ as defined in the playbook.</li>
|
||||||
|
<li>facts, whether built in or custom, or variables assigned from the ‘register’ 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">
|
<div class="section" id="style-points">
|
||||||
<h2>Style Points<a class="headerlink" href="#style-points" title="Permalink to this headline">¶</a></h2>
|
<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>
|
<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>
|
||||||
<p>
|
<p>
|
||||||
© Copyright 2012 Michael DeHaan.<br/>
|
© Copyright 2012 Michael DeHaan.<br/>
|
||||||
Last updated on Aug 20, 2012.<br/>
|
Last updated on Aug 21, 2012.<br/>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
|
@ -517,6 +517,28 @@ Here is the same playbook as above, but using the shorthand syntax,
|
||||||
- name: add back to load balancer pool
|
- name: add back to load balancer pool
|
||||||
local_action: command /usr/bin/add_back_to_pool $inventory_hostname
|
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
|
Style Points
|
||||||
````````````
|
````````````
|
||||||
|
|
|
@ -221,7 +221,7 @@ s.parentNode.insertBefore(ga, s);
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
© Copyright 2012 Michael DeHaan.<br/>
|
© Copyright 2012 Michael DeHaan.<br/>
|
||||||
Last updated on Aug 20, 2012.<br/>
|
Last updated on Aug 21, 2012.<br/>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -269,7 +269,7 @@ s.parentNode.insertBefore(ga, s);
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
© Copyright 2012 Michael DeHaan.<br/>
|
© Copyright 2012 Michael DeHaan.<br/>
|
||||||
Last updated on Aug 20, 2012.<br/>
|
Last updated on Aug 21, 2012.<br/>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
Loading…
Reference in a new issue