mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Document the new 'serial' and 'delegate_to' features.
This commit is contained in:
parent
6a5a7bd0f8
commit
1824dd33cf
18 changed files with 107 additions and 19 deletions
|
@ -289,7 +289,7 @@ languages:
|
|||
</p>
|
||||
<p>
|
||||
© Copyright 2012 Michael DeHaan.<br/>
|
||||
Last updated on Aug 17, 2012.<br/>
|
||||
Last updated on Aug 18, 2012.<br/>
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
|
2
api.html
2
api.html
|
@ -469,7 +469,7 @@ e.g.
|
|||
</p>
|
||||
<p>
|
||||
© Copyright 2012 Michael DeHaan.<br/>
|
||||
Last updated on Aug 17, 2012.<br/>
|
||||
Last updated on Aug 18, 2012.<br/>
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
|
|
@ -340,7 +340,7 @@ different variables to different geographies.</p>
|
|||
</p>
|
||||
<p>
|
||||
© Copyright 2012 Michael DeHaan.<br/>
|
||||
Last updated on Aug 17, 2012.<br/>
|
||||
Last updated on Aug 18, 2012.<br/>
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
|
|
@ -442,7 +442,7 @@ what their names or IP addresses are).</p>
|
|||
</p>
|
||||
<p>
|
||||
© Copyright 2012 Michael DeHaan.<br/>
|
||||
Last updated on Aug 17, 2012.<br/>
|
||||
Last updated on Aug 18, 2012.<br/>
|
||||
</p>
|
||||
</div>
|
||||
</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>
|
||||
© Copyright 2012 Michael DeHaan.<br/>
|
||||
Last updated on Aug 17, 2012.<br/>
|
||||
Last updated on Aug 18, 2012.<br/>
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
|
|
@ -204,7 +204,7 @@ s.parentNode.insertBefore(ga, s);
|
|||
</p>
|
||||
<p>
|
||||
© Copyright 2012 Michael DeHaan.<br/>
|
||||
Last updated on Aug 17, 2012.<br/>
|
||||
Last updated on Aug 18, 2012.<br/>
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
|
|
@ -410,7 +410,7 @@ explore, but you already have a fully working infrastructure!</p>
|
|||
</p>
|
||||
<p>
|
||||
© Copyright 2012 Michael DeHaan.<br/>
|
||||
Last updated on Aug 17, 2012.<br/>
|
||||
Last updated on Aug 18, 2012.<br/>
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
|
|
@ -213,6 +213,8 @@ Infrastructure should be easy and powerful to command, but it should not look li
|
|||
</tr>
|
||||
<tr><td>Modules can be written in ANY language</td>
|
||||
</tr>
|
||||
<tr><td>Orchestrates load balancer rotations and outage windows</td>
|
||||
</tr>
|
||||
<tr><td>Awesome API for creating very powerful distributed applications</td>
|
||||
</tr>
|
||||
<tr><td>Pluggable transports (SSH is just the default)</td>
|
||||
|
@ -417,7 +419,7 @@ Puppet Labs, and is now with <a class="reference external" href="http://rpath.co
|
|||
</p>
|
||||
<p>
|
||||
© Copyright 2012 Michael DeHaan.<br/>
|
||||
Last updated on Aug 17, 2012.<br/>
|
||||
Last updated on Aug 18, 2012.<br/>
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
|
|
@ -511,7 +511,7 @@ the program. Stop by the mailing list to inquire about requirements.</p>
|
|||
</p>
|
||||
<p>
|
||||
© Copyright 2012 Michael DeHaan.<br/>
|
||||
Last updated on Aug 17, 2012.<br/>
|
||||
Last updated on Aug 18, 2012.<br/>
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
|
|
@ -1796,7 +1796,7 @@ yum name=httpd state=installed</pre>
|
|||
</p>
|
||||
<p>
|
||||
© Copyright 2012 Michael DeHaan.<br/>
|
||||
Last updated on Aug 17, 2012.<br/>
|
||||
Last updated on Aug 18, 2012.<br/>
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
|
|
@ -392,7 +392,7 @@ Ansible 0.7. Ansible 0.6 includes a <a class="reference external" href="https:/
|
|||
</p>
|
||||
<p>
|
||||
© Copyright 2012 Michael DeHaan.<br/>
|
||||
Last updated on Aug 17, 2012.<br/>
|
||||
Last updated on Aug 18, 2012.<br/>
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
|
|
@ -550,7 +550,7 @@ can do this:</p>
|
|||
</p>
|
||||
<p>
|
||||
© Copyright 2012 Michael DeHaan.<br/>
|
||||
Last updated on Aug 17, 2012.<br/>
|
||||
Last updated on Aug 18, 2012.<br/>
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
|
|
@ -166,6 +166,8 @@ s.parentNode.insertBefore(ga, s);
|
|||
<li><a class="reference internal" href="#turning-off-facts">Turning Off Facts</a></li>
|
||||
<li><a class="reference internal" href="#pull-mode-playbooks">Pull-Mode Playbooks</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="#delegation">Delegation</a></li>
|
||||
<li><a class="reference internal" href="#style-points">Style Points</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
@ -587,7 +589,7 @@ logs from ansible-pull runs would be an excellent way to gather and analyze remo
|
|||
it later. Use of the command module in this way can in many ways eliminate the need to write site specific facts, for
|
||||
instance, you could test for the existance of a particular program.</p>
|
||||
<p>The ‘register’ keyword decides what variable to save a result in. The resulting variables can be used in templates, action lines, or only_if statements. It looks like this (in an obviously trivial example):</p>
|
||||
<div class="highlight-python"><pre>- name: test playbook
|
||||
<div class="highlight-python"><pre>- name: test play
|
||||
hosts: all
|
||||
|
||||
tasks:
|
||||
|
@ -599,6 +601,45 @@ instance, you could test for the existance of a particular program.</p>
|
|||
only_if: "'${motd_contents.stdout}'.find('hi') != -1"</pre>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="rolling-updates">
|
||||
<h2>Rolling Updates<a class="headerlink" href="#rolling-updates" title="Permalink to this headline">¶</a></h2>
|
||||
<p class="versionadded">
|
||||
<span class="versionmodified">New in version 0.7.</span></p>
|
||||
<p>By default ansible will try to manage all of the machines referenced in a play in parallel. For a rolling updates
|
||||
use case, you can define how many hosts ansible should manage at a single time by using the ‘’serial’’ keyword:</p>
|
||||
<div class="highlight-python"><pre>- name: test play
|
||||
hosts: webservers
|
||||
serial: 3</pre>
|
||||
</div>
|
||||
<p>In the above example, if we had 100 hosts, 3 hosts in the group ‘webservers’
|
||||
would complete the play completely before moving on to the next 3 hosts.</p>
|
||||
</div>
|
||||
<div class="section" id="delegation">
|
||||
<h2>Delegation<a class="headerlink" href="#delegation" title="Permalink to this headline">¶</a></h2>
|
||||
<p class="versionadded">
|
||||
<span class="versionmodified">New in version 0.7.</span></p>
|
||||
<p>If you want to perform a task on one host with reference to other hosts, use the ‘delegate_to’ keyword on a task.
|
||||
This is ideal for placing nodes in a load balanced pool, or removing them. It is also very useful for controlling
|
||||
outage windows. Using this with the ‘serial’ keyword to control the number of hosts executing at one time is also
|
||||
a good idea:</p>
|
||||
<div class="highlight-python"><pre>---
|
||||
- hosts: webservers
|
||||
serial: 5
|
||||
|
||||
tasks:
|
||||
|
||||
- name: take out of load balancer pool
|
||||
action: command /usr/bin/take_out_of_pool $inventory_hostname
|
||||
delegate_to: 127.0.0.1
|
||||
|
||||
- name: actual steps would go here
|
||||
action: yum name=acme-web-stack state=latest
|
||||
|
||||
- name: add back to load balancer pool
|
||||
action: command /usr/bin/add_back_to_pool $inventory_hostname
|
||||
delegate_to: 127.0.0.1</pre>
|
||||
</div>
|
||||
</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>
|
||||
|
@ -655,7 +696,7 @@ instance, you could test for the existance of a particular program.</p>
|
|||
</p>
|
||||
<p>
|
||||
© Copyright 2012 Michael DeHaan.<br/>
|
||||
Last updated on Aug 17, 2012.<br/>
|
||||
Last updated on Aug 18, 2012.<br/>
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
|
|
@ -33,6 +33,8 @@ Infrastructure should be easy and powerful to command, but it should not look li
|
|||
+---------------------------------------------------------------------+
|
||||
| Modules can be written in ANY language |
|
||||
+---------------------------------------------------------------------+
|
||||
| Orchestrates load balancer rotations and outage windows |
|
||||
+---------------------------------------------------------------------+
|
||||
| Awesome API for creating very powerful distributed applications |
|
||||
+---------------------------------------------------------------------+
|
||||
| Pluggable transports (SSH is just the default) |
|
||||
|
|
|
@ -448,7 +448,7 @@ instance, you could test for the existance of a particular program.
|
|||
|
||||
The 'register' keyword decides what variable to save a result in. The resulting variables can be used in templates, action lines, or only_if statements. It looks like this (in an obviously trivial example)::
|
||||
|
||||
- name: test playbook
|
||||
- name: test play
|
||||
hosts: all
|
||||
|
||||
tasks:
|
||||
|
@ -460,6 +460,49 @@ The 'register' keyword decides what variable to save a result in. The resulting
|
|||
only_if: "'${motd_contents.stdout}'.find('hi') != -1"
|
||||
|
||||
|
||||
Rolling Updates
|
||||
```````````````
|
||||
|
||||
.. versionadded:: 0.7
|
||||
|
||||
By default ansible will try to manage all of the machines referenced in a play in parallel. For a rolling updates
|
||||
use case, you can define how many hosts ansible should manage at a single time by using the ''serial'' keyword::
|
||||
|
||||
|
||||
- name: test play
|
||||
hosts: webservers
|
||||
serial: 3
|
||||
|
||||
In the above example, if we had 100 hosts, 3 hosts in the group 'webservers'
|
||||
would complete the play completely before moving on to the next 3 hosts.
|
||||
|
||||
Delegation
|
||||
``````````
|
||||
|
||||
.. versionadded:: 0.7
|
||||
|
||||
If you want to perform a task on one host with reference to other hosts, use the 'delegate_to' keyword on a task.
|
||||
This is ideal for placing nodes in a load balanced pool, or removing them. It is also very useful for controlling
|
||||
outage windows. Using this with the 'serial' keyword to control the number of hosts executing at one time is also
|
||||
a good idea::
|
||||
|
||||
---
|
||||
- hosts: webservers
|
||||
serial: 5
|
||||
|
||||
tasks:
|
||||
|
||||
- name: take out of load balancer pool
|
||||
action: command /usr/bin/take_out_of_pool $inventory_hostname
|
||||
delegate_to: 127.0.0.1
|
||||
|
||||
- name: actual steps would go here
|
||||
action: yum name=acme-web-stack state=latest
|
||||
|
||||
- name: add back to load balancer pool
|
||||
action: command /usr/bin/add_back_to_pool $inventory_hostname
|
||||
delegate_to: 127.0.0.1
|
||||
|
||||
Style Points
|
||||
````````````
|
||||
|
||||
|
|
|
@ -221,7 +221,7 @@ s.parentNode.insertBefore(ga, s);
|
|||
</p>
|
||||
<p>
|
||||
© Copyright 2012 Michael DeHaan.<br/>
|
||||
Last updated on Aug 17, 2012.<br/>
|
||||
Last updated on Aug 18, 2012.<br/>
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -269,7 +269,7 @@ s.parentNode.insertBefore(ga, s);
|
|||
</p>
|
||||
<p>
|
||||
© Copyright 2012 Michael DeHaan.<br/>
|
||||
Last updated on Aug 17, 2012.<br/>
|
||||
Last updated on Aug 18, 2012.<br/>
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
|
Loading…
Reference in a new issue