1
0
Fork 0
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:
Michael DeHaan 2012-08-18 10:23:17 -04:00
parent 6a5a7bd0f8
commit 1824dd33cf
18 changed files with 107 additions and 19 deletions

View file

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

View file

@ -469,7 +469,7 @@ e.g.
</p>
<p>
&copy; Copyright 2012 Michael DeHaan.<br/>
Last updated on Aug 17, 2012.<br/>
Last updated on Aug 18, 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 17, 2012.<br/>
Last updated on Aug 18, 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 17, 2012.<br/>
Last updated on Aug 18, 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 17, 2012.<br/>
Last updated on Aug 18, 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 17, 2012.<br/>
Last updated on Aug 18, 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 17, 2012.<br/>
Last updated on Aug 18, 2012.<br/>
</p>
</div>
</footer>

View file

@ -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>
&copy; Copyright 2012 Michael DeHaan.<br/>
Last updated on Aug 17, 2012.<br/>
Last updated on Aug 18, 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 17, 2012.<br/>
Last updated on Aug 18, 2012.<br/>
</p>
</div>
</footer>

View file

@ -1796,7 +1796,7 @@ yum name=httpd state=installed</pre>
</p>
<p>
&copy; Copyright 2012 Michael DeHaan.<br/>
Last updated on Aug 17, 2012.<br/>
Last updated on Aug 18, 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 17, 2012.<br/>
Last updated on Aug 18, 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 17, 2012.<br/>
Last updated on Aug 18, 2012.<br/>
</p>
</div>
</footer>

View file

@ -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 &#8216;register&#8217; 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 &#8216;&#8217;serial&#8217;&#8217; 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 &#8216;webservers&#8217;
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 &#8216;delegate_to&#8217; 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 &#8216;serial&#8217; 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>
&copy; Copyright 2012 Michael DeHaan.<br/>
Last updated on Aug 17, 2012.<br/>
Last updated on Aug 18, 2012.<br/>
</p>
</div>
</footer>

View file

@ -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) |

View file

@ -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
````````````

View file

@ -221,7 +221,7 @@ s.parentNode.insertBefore(ga, s);
</p>
<p>
&copy; 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

View file

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