From 8465f285cc47d1bd34ffe7fbabdc2bdb9bf75ee1 Mon Sep 17 00:00:00 2001 From: Justin Otherguy Date: Wed, 14 Oct 2020 19:26:16 +0200 Subject: [PATCH] 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 --- .../rst/user_guide/playbooks_strategies.rst | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/docs/docsite/rst/user_guide/playbooks_strategies.rst b/docs/docsite/rst/user_guide/playbooks_strategies.rst index a97f0447956..ec7526a3223 100644 --- a/docs/docsite/rst/user_guide/playbooks_strategies.rst +++ b/docs/docsite/rst/user_guide/playbooks_strategies.rst @@ -48,7 +48,7 @@ By default, Ansible runs in parallel against all the hosts in the :ref:`pattern --- - name: test play hosts: webservers - serial: 2 + serial: 3 gather_facts: False tasks: @@ -57,34 +57,40 @@ By default, Ansible runs in parallel against all the hosts in the :ref:`pattern - name: second task 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] **************************************** TASK [first task] **************************************** + changed: [web3] changed: [web2] changed: [web1] TASK [second task] *************************************** changed: [web1] changed: [web2] + changed: [web3] PLAY [webservers] **************************************** TASK [first task] **************************************** - changed: [web3] changed: [web4] + changed: [web5] + changed: [web6] TASK [second task] *************************************** - changed: [web3] changed: [web4] + changed: [web5] + changed: [web2] PLAY RECAP *********************************************** web1 : 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 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::