Update playbooks_strategies.rst (#72176)
beside the fact that naming the variable to specify the number of machines executed in *parallel* is named *serial* - the number of hosts chosen in this example is not optimal, either: 2x2 = 4; so - 3 hosts in 2 batches should clear things up a little
This commit is contained in:
parent
b18e462bbb
commit
8465f285cc
1 changed files with 10 additions and 4 deletions
|
@ -48,7 +48,7 @@ By default, Ansible runs in parallel against all the hosts in the :ref:`pattern
|
||||||
---
|
---
|
||||||
- name: test play
|
- name: test play
|
||||||
hosts: webservers
|
hosts: webservers
|
||||||
serial: 2
|
serial: 3
|
||||||
gather_facts: False
|
gather_facts: False
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
|
@ -57,34 +57,40 @@ By default, Ansible runs in parallel against all the hosts in the :ref:`pattern
|
||||||
- name: second task
|
- name: second task
|
||||||
command: hostname
|
command: hostname
|
||||||
|
|
||||||
In the above example, if we had 4 hosts in the group 'webservers', Ansible would execute the play completely (both tasks) on 2 of the hosts before moving on to the next 2 hosts::
|
In the above example, if we had 6 hosts in the group 'webservers', Ansible would execute the play completely (both tasks) on 3 of the hosts before moving on to the next 3 hosts::
|
||||||
|
|
||||||
|
|
||||||
PLAY [webservers] ****************************************
|
PLAY [webservers] ****************************************
|
||||||
|
|
||||||
TASK [first task] ****************************************
|
TASK [first task] ****************************************
|
||||||
|
changed: [web3]
|
||||||
changed: [web2]
|
changed: [web2]
|
||||||
changed: [web1]
|
changed: [web1]
|
||||||
|
|
||||||
TASK [second task] ***************************************
|
TASK [second task] ***************************************
|
||||||
changed: [web1]
|
changed: [web1]
|
||||||
changed: [web2]
|
changed: [web2]
|
||||||
|
changed: [web3]
|
||||||
|
|
||||||
PLAY [webservers] ****************************************
|
PLAY [webservers] ****************************************
|
||||||
|
|
||||||
TASK [first task] ****************************************
|
TASK [first task] ****************************************
|
||||||
changed: [web3]
|
|
||||||
changed: [web4]
|
changed: [web4]
|
||||||
|
changed: [web5]
|
||||||
|
changed: [web6]
|
||||||
|
|
||||||
TASK [second task] ***************************************
|
TASK [second task] ***************************************
|
||||||
changed: [web3]
|
|
||||||
changed: [web4]
|
changed: [web4]
|
||||||
|
changed: [web5]
|
||||||
|
changed: [web2]
|
||||||
|
|
||||||
PLAY RECAP ***********************************************
|
PLAY RECAP ***********************************************
|
||||||
web1 : ok=2 changed=2 unreachable=0 failed=0
|
web1 : ok=2 changed=2 unreachable=0 failed=0
|
||||||
web2 : ok=2 changed=2 unreachable=0 failed=0
|
web2 : ok=2 changed=2 unreachable=0 failed=0
|
||||||
web3 : ok=2 changed=2 unreachable=0 failed=0
|
web3 : ok=2 changed=2 unreachable=0 failed=0
|
||||||
web4 : ok=2 changed=2 unreachable=0 failed=0
|
web4 : ok=2 changed=2 unreachable=0 failed=0
|
||||||
|
web5 : ok=2 changed=2 unreachable=0 failed=0
|
||||||
|
web6 : ok=2 changed=2 unreachable=0 failed=0
|
||||||
|
|
||||||
|
|
||||||
You can also specify a percentage with the ``serial`` keyword. Ansible applies the percentage to the total number of hosts in a play to determine the number of hosts per pass::
|
You can also specify a percentage with the ``serial`` keyword. Ansible applies the percentage to the total number of hosts in a play to determine the number of hosts per pass::
|
||||||
|
|
Loading…
Reference in a new issue