<h5 dir="auto">Issue Type:</h5>
<ul dir="auto">
<li>Bug Report</li>
</ul>
<h5 dir="auto">Ansible Version:</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="user@h0$ ansible-playbook --version
ansible-playbook 2.1.0
  config file = 
  configured module search path = Default w/o overrides"><pre class="notranslate"><code class="notranslate">user@h0$ ansible-playbook --version
ansible-playbook 2.1.0
  config file = 
  configured module search path = Default w/o overrides
</code></pre></div>
<p dir="auto">Installed from GitHub at approximately:<br>
Thu Feb 25 18:43:33 UTC 2016</p>
<h5 dir="auto">Ansible Configuration:</h5>
<p dir="auto">No configuration file modifications</p>
<h5 dir="auto">Environment:</h5>
<p dir="auto">Debian 8</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="user@h0$ uname -a
Linux h0 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt20-1+deb8u3 (2016-01-17) x86_64 GNU/Linux"><pre class="notranslate"><code class="notranslate">user@h0$ uname -a
Linux h0 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt20-1+deb8u3 (2016-01-17) x86_64 GNU/Linux
</code></pre></div>
<h5 dir="auto">Summary:</h5>
<p dir="auto">Given a playbook with multiple plays run against two target hosts (host1 and host2). If a task in the first play fails for host2, but succeeds for host1, subsequent tasks (and handlers) in the same play are executed on host1, but tasks in subsequent plays are NOT executed on host1. The message "NO MORE HOSTS LEFT" is printed even though host1 has not had any failed tasks.</p>
<p dir="auto">This is different than the behavior observed on version 1.9.4. On 1.9.4, the tasks in subsequent plays are executed for host1. The behavior also appears to conflict with the documentation and I haven't found any record that this change was intentional.</p>
<h5 dir="auto">Steps To Reproduce:</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="user@h0$ cat two_plays.pb.yaml 

---
- name: Play 1
  hosts: all
  connection: local
  gather_facts: no
  tasks:
    - name: Task 1
      command: /bin/true
      failed_when: &quot;'host2' in inventory_hostname&quot;
      notify: Handler 1
    - name: Task 2
      command: /bin/true
  handlers:
    - name: Handler 1
      command: /bin/true

- name: Play 2
  hosts: all
  connection: local
  gather_facts: no
  tasks:
    - name: Task 3
      command: /bin/true"><pre class="notranslate"><code class="notranslate">user@h0$ cat two_plays.pb.yaml 

---
- name: Play 1
  hosts: all
  connection: local
  gather_facts: no
  tasks:
    - name: Task 1
      command: /bin/true
      failed_when: "'host2' in inventory_hostname"
      notify: Handler 1
    - name: Task 2
      command: /bin/true
  handlers:
    - name: Handler 1
      command: /bin/true

- name: Play 2
  hosts: all
  connection: local
  gather_facts: no
  tasks:
    - name: Task 3
      command: /bin/true
</code></pre></div>
<h5 dir="auto">Expected Results:</h5>
<p dir="auto">I expect the same result as seen on version 1.9.4 in the output below.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="user@h0$ ansible-playbook --version
ansible-playbook 1.9.4
  configured module search path = None

user@h0$ ansible-playbook two_plays.pb.yaml 

PLAY [Play 1] ***************************************************************** 

TASK: [Task 1] **************************************************************** 
failed: [host2] =&gt; {&quot;changed&quot;: true, &quot;cmd&quot;: [&quot;/bin/true&quot;], &quot;delta&quot;: &quot;0:00:00.004436&quot;, &quot;end&quot;: &quot;2016-02-25 12:04:28.139206&quot;, &quot;failed&quot;: true, &quot;failed_when_result&quot;: true, &quot;rc&quot;: 0, &quot;start&quot;: &quot;2016-02-25 12:04:28.134770&quot;, &quot;warnings&quot;: []}
changed: [host1]

TASK: [Task 2] **************************************************************** 
changed: [host1]

NOTIFIED: [Handler 1] ********************************************************* 
changed: [host1]

PLAY [Play 2] ***************************************************************** 

TASK: [Task 3] **************************************************************** 
changed: [host1]

PLAY RECAP ******************************************************************** 
           to retry, use: --limit @/home/user/two_plays.pb.yaml.retry

host1                      : ok=4    changed=4    unreachable=0    failed=0   
host2                      : ok=0    changed=0    unreachable=0    failed=1   "><pre class="notranslate"><code class="notranslate">user@h0$ ansible-playbook --version
ansible-playbook 1.9.4
  configured module search path = None

user@h0$ ansible-playbook two_plays.pb.yaml 

PLAY [Play 1] ***************************************************************** 

TASK: [Task 1] **************************************************************** 
failed: [host2] =&gt; {"changed": true, "cmd": ["/bin/true"], "delta": "0:00:00.004436", "end": "2016-02-25 12:04:28.139206", "failed": true, "failed_when_result": true, "rc": 0, "start": "2016-02-25 12:04:28.134770", "warnings": []}
changed: [host1]

TASK: [Task 2] **************************************************************** 
changed: [host1]

NOTIFIED: [Handler 1] ********************************************************* 
changed: [host1]

PLAY [Play 2] ***************************************************************** 

TASK: [Task 3] **************************************************************** 
changed: [host1]

PLAY RECAP ******************************************************************** 
           to retry, use: --limit @/home/user/two_plays.pb.yaml.retry

host1                      : ok=4    changed=4    unreachable=0    failed=0   
host2                      : ok=0    changed=0    unreachable=0    failed=1   
</code></pre></div>
<h5 dir="auto">Actual Results:</h5>
<p dir="auto">Instead, Task 3 from Play 2 is not executed on host1. The message "NO MORE HOSTS LEFT" is displayed.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="user@h0$ ansible-playbook --version
ansible-playbook 2.1.0
  config file = 
  configured module search path = Default w/o overrides

user@h0$ ansible-playbook two_plays.pb.yaml 

PLAY [Play 1] ******************************************************************

TASK [Task 1] ******************************************************************
fatal: [host2]: FAILED! =&gt; {&quot;changed&quot;: true, &quot;cmd&quot;: [&quot;/bin/true&quot;], &quot;delta&quot;: &quot;0:00:00.006471&quot;, &quot;end&quot;: &quot;2016-02-25 12:08:15.874254&quot;, &quot;failed&quot;: true, &quot;failed_when_result&quot;: true, &quot;rc&quot;: 0, &quot;start&quot;: &quot;2016-02-25 12:08:15.867783&quot;, &quot;stderr&quot;: &quot;&quot;, &quot;stdout&quot;: &quot;&quot;, &quot;stdout_lines&quot;: [], &quot;warnings&quot;: []}
changed: [host1]

TASK [Task 2] ******************************************************************
changed: [host1]

RUNNING HANDLER [Handler 1] ****************************************************
changed: [host1]

NO MORE HOSTS LEFT *************************************************************

PLAY RECAP *********************************************************************
host1                      : ok=3    changed=3    unreachable=0    failed=0   
host2                      : ok=0    changed=0    unreachable=0    failed=1   "><pre class="notranslate"><code class="notranslate">user@h0$ ansible-playbook --version
ansible-playbook 2.1.0
  config file = 
  configured module search path = Default w/o overrides

user@h0$ ansible-playbook two_plays.pb.yaml 

PLAY [Play 1] ******************************************************************

TASK [Task 1] ******************************************************************
fatal: [host2]: FAILED! =&gt; {"changed": true, "cmd": ["/bin/true"], "delta": "0:00:00.006471", "end": "2016-02-25 12:08:15.874254", "failed": true, "failed_when_result": true, "rc": 0, "start": "2016-02-25 12:08:15.867783", "stderr": "", "stdout": "", "stdout_lines": [], "warnings": []}
changed: [host1]

TASK [Task 2] ******************************************************************
changed: [host1]

RUNNING HANDLER [Handler 1] ****************************************************
changed: [host1]

NO MORE HOSTS LEFT *************************************************************

PLAY RECAP *********************************************************************
host1                      : ok=3    changed=3    unreachable=0    failed=0   
host2                      : ok=0    changed=0    unreachable=0    failed=1   
</code></pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="user@h0$ ansible-playbook --version
ansible-playbook 2.1.0
  config file = 
  configured module search path = Default w/o overrides

user@h0$ ansible-playbook -vvv two_plays.pb.yaml 
No config file found; using defaults

PLAYBOOK: two_plays.pb.yaml ****************************************************
2 plays in two_plays.pb.yaml

PLAY [Play 1] ******************************************************************

TASK [Task 1] ******************************************************************
task path: /home/user/playbooks/two_plays.pb.yaml:7
ESTABLISH LOCAL CONNECTION FOR USER: user
host1 EXEC /bin/sh -c '( umask 22 &amp;&amp; mkdir -p &quot;` echo $HOME/.ansible/tmp/ansible-tmp-1456427335.4-181448891920162 `&quot; &amp;&amp; echo &quot;` echo $HOME/.ansible/tmp/ansible-tmp-1456427335.4-181448891920162 `&quot; )'
ESTABLISH LOCAL CONNECTION FOR USER: user
host2 EXEC /bin/sh -c '( umask 22 &amp;&amp; mkdir -p &quot;` echo $HOME/.ansible/tmp/ansible-tmp-1456427335.41-67699306413194 `&quot; &amp;&amp; echo &quot;` echo $HOME/.ansible/tmp/ansible-tmp-1456427335.41-67699306413194 `&quot; )'
host1 PUT /tmp/tmp_1kdGb TO /home/user/.ansible/tmp/ansible-tmp-1456427335.4-181448891920162/command
host1 EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /home/user/.ansible/tmp/ansible-tmp-1456427335.4-181448891920162/command; rm -rf &quot;/home/user/.ansible/tmp/ansible-tmp-1456427335.4-181448891920162/&quot; &gt; /dev/null 2&gt;&amp;1'
host2 PUT /tmp/tmpeUisOu TO /home/user/.ansible/tmp/ansible-tmp-1456427335.41-67699306413194/command
host2 EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /home/user/.ansible/tmp/ansible-tmp-1456427335.41-67699306413194/command; rm -rf &quot;/home/user/.ansible/tmp/ansible-tmp-1456427335.41-67699306413194/&quot; &gt; /dev/null 2&gt;&amp;1'
fatal: [host2]: FAILED! =&gt; {&quot;changed&quot;: true, &quot;cmd&quot;: [&quot;/bin/true&quot;], &quot;delta&quot;: &quot;0:00:00.005199&quot;, &quot;end&quot;: &quot;2016-02-25 12:08:55.458196&quot;, &quot;failed&quot;: true, &quot;failed_when_result&quot;: true, &quot;invocation&quot;: {&quot;module_args&quot;: {&quot;_raw_params&quot;: &quot;/bin/true&quot;, &quot;_uses_shell&quot;: false, &quot;chdir&quot;: null, &quot;creates&quot;: null, &quot;executable&quot;: null, &quot;removes&quot;: null, &quot;warn&quot;: true}, &quot;module_name&quot;: &quot;command&quot;}, &quot;rc&quot;: 0, &quot;start&quot;: &quot;2016-02-25 12:08:55.452997&quot;, &quot;stderr&quot;: &quot;&quot;, &quot;stdout&quot;: &quot;&quot;, &quot;stdout_lines&quot;: [], &quot;warnings&quot;: []}
NOTIFIED HANDLER Handler 1
changed: [host1] =&gt; {&quot;changed&quot;: true, &quot;cmd&quot;: [&quot;/bin/true&quot;], &quot;delta&quot;: &quot;0:00:00.008875&quot;, &quot;end&quot;: &quot;2016-02-25 12:08:55.466677&quot;, &quot;failed&quot;: false, &quot;failed_when_result&quot;: false, &quot;invocation&quot;: {&quot;module_args&quot;: {&quot;_raw_params&quot;: &quot;/bin/true&quot;, &quot;_uses_shell&quot;: false, &quot;chdir&quot;: null, &quot;creates&quot;: null, &quot;executable&quot;: null, &quot;removes&quot;: null, &quot;warn&quot;: true}, &quot;module_name&quot;: &quot;command&quot;}, &quot;rc&quot;: 0, &quot;start&quot;: &quot;2016-02-25 12:08:55.457802&quot;, &quot;stderr&quot;: &quot;&quot;, &quot;stdout&quot;: &quot;&quot;, &quot;stdout_lines&quot;: [], &quot;warnings&quot;: []}

TASK [Task 2] ******************************************************************
task path: /home/user/playbooks/two_plays.pb.yaml:11
ESTABLISH LOCAL CONNECTION FOR USER: user
host1 EXEC /bin/sh -c '( umask 22 &amp;&amp; mkdir -p &quot;` echo $HOME/.ansible/tmp/ansible-tmp-1456427335.51-149718488385002 `&quot; &amp;&amp; echo &quot;` echo $HOME/.ansible/tmp/ansible-tmp-1456427335.51-149718488385002 `&quot; )'
host1 PUT /tmp/tmpatPQZV TO /home/user/.ansible/tmp/ansible-tmp-1456427335.51-149718488385002/command
host1 EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /home/user/.ansible/tmp/ansible-tmp-1456427335.51-149718488385002/command; rm -rf &quot;/home/user/.ansible/tmp/ansible-tmp-1456427335.51-149718488385002/&quot; &gt; /dev/null 2&gt;&amp;1'
changed: [host1] =&gt; {&quot;changed&quot;: true, &quot;cmd&quot;: [&quot;/bin/true&quot;], &quot;delta&quot;: &quot;0:00:00.005788&quot;, &quot;end&quot;: &quot;2016-02-25 12:08:55.568887&quot;, &quot;invocation&quot;: {&quot;module_args&quot;: {&quot;_raw_params&quot;: &quot;/bin/true&quot;, &quot;_uses_shell&quot;: false, &quot;chdir&quot;: null, &quot;creates&quot;: null, &quot;executable&quot;: null, &quot;removes&quot;: null, &quot;warn&quot;: true}, &quot;module_name&quot;: &quot;command&quot;}, &quot;rc&quot;: 0, &quot;start&quot;: &quot;2016-02-25 12:08:55.563099&quot;, &quot;stderr&quot;: &quot;&quot;, &quot;stdout&quot;: &quot;&quot;, &quot;stdout_lines&quot;: [], &quot;warnings&quot;: []}

RUNNING HANDLER [Handler 1] ****************************************************
ESTABLISH LOCAL CONNECTION FOR USER: user
host1 EXEC /bin/sh -c '( umask 22 &amp;&amp; mkdir -p &quot;` echo $HOME/.ansible/tmp/ansible-tmp-1456427335.6-154968896387882 `&quot; &amp;&amp; echo &quot;` echo $HOME/.ansible/tmp/ansible-tmp-1456427335.6-154968896387882 `&quot; )'
host1 PUT /tmp/tmpoh615S TO /home/user/.ansible/tmp/ansible-tmp-1456427335.6-154968896387882/command
host1 EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /home/user/.ansible/tmp/ansible-tmp-1456427335.6-154968896387882/command; rm -rf &quot;/home/user/.ansible/tmp/ansible-tmp-1456427335.6-154968896387882/&quot; &gt; /dev/null 2&gt;&amp;1'
changed: [host1] =&gt; {&quot;changed&quot;: true, &quot;cmd&quot;: [&quot;/bin/true&quot;], &quot;delta&quot;: &quot;0:00:00.005483&quot;, &quot;end&quot;: &quot;2016-02-25 12:08:55.646776&quot;, &quot;invocation&quot;: {&quot;module_args&quot;: {&quot;_raw_params&quot;: &quot;/bin/true&quot;, &quot;_uses_shell&quot;: false, &quot;chdir&quot;: null, &quot;creates&quot;: null, &quot;executable&quot;: null, &quot;removes&quot;: null, &quot;warn&quot;: true}, &quot;module_name&quot;: &quot;command&quot;}, &quot;rc&quot;: 0, &quot;start&quot;: &quot;2016-02-25 12:08:55.641293&quot;, &quot;stderr&quot;: &quot;&quot;, &quot;stdout&quot;: &quot;&quot;, &quot;stdout_lines&quot;: [], &quot;warnings&quot;: []}

NO MORE HOSTS LEFT *************************************************************

PLAY RECAP *********************************************************************
host1                      : ok=3    changed=3    unreachable=0    failed=0   
host2                      : ok=0    changed=0    unreachable=0    failed=1   "><pre class="notranslate"><code class="notranslate">user@h0$ ansible-playbook --version
ansible-playbook 2.1.0
  config file = 
  configured module search path = Default w/o overrides

user@h0$ ansible-playbook -vvv two_plays.pb.yaml 
No config file found; using defaults

PLAYBOOK: two_plays.pb.yaml ****************************************************
2 plays in two_plays.pb.yaml

PLAY [Play 1] ******************************************************************

TASK [Task 1] ******************************************************************
task path: /home/user/playbooks/two_plays.pb.yaml:7
ESTABLISH LOCAL CONNECTION FOR USER: user
host1 EXEC /bin/sh -c '( umask 22 &amp;&amp; mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1456427335.4-181448891920162 `" &amp;&amp; echo "` echo $HOME/.ansible/tmp/ansible-tmp-1456427335.4-181448891920162 `" )'
ESTABLISH LOCAL CONNECTION FOR USER: user
host2 EXEC /bin/sh -c '( umask 22 &amp;&amp; mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1456427335.41-67699306413194 `" &amp;&amp; echo "` echo $HOME/.ansible/tmp/ansible-tmp-1456427335.41-67699306413194 `" )'
host1 PUT /tmp/tmp_1kdGb TO /home/user/.ansible/tmp/ansible-tmp-1456427335.4-181448891920162/command
host1 EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /home/user/.ansible/tmp/ansible-tmp-1456427335.4-181448891920162/command; rm -rf "/home/user/.ansible/tmp/ansible-tmp-1456427335.4-181448891920162/" &gt; /dev/null 2&gt;&amp;1'
host2 PUT /tmp/tmpeUisOu TO /home/user/.ansible/tmp/ansible-tmp-1456427335.41-67699306413194/command
host2 EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /home/user/.ansible/tmp/ansible-tmp-1456427335.41-67699306413194/command; rm -rf "/home/user/.ansible/tmp/ansible-tmp-1456427335.41-67699306413194/" &gt; /dev/null 2&gt;&amp;1'
fatal: [host2]: FAILED! =&gt; {"changed": true, "cmd": ["/bin/true"], "delta": "0:00:00.005199", "end": "2016-02-25 12:08:55.458196", "failed": true, "failed_when_result": true, "invocation": {"module_args": {"_raw_params": "/bin/true", "_uses_shell": false, "chdir": null, "creates": null, "executable": null, "removes": null, "warn": true}, "module_name": "command"}, "rc": 0, "start": "2016-02-25 12:08:55.452997", "stderr": "", "stdout": "", "stdout_lines": [], "warnings": []}
NOTIFIED HANDLER Handler 1
changed: [host1] =&gt; {"changed": true, "cmd": ["/bin/true"], "delta": "0:00:00.008875", "end": "2016-02-25 12:08:55.466677", "failed": false, "failed_when_result": false, "invocation": {"module_args": {"_raw_params": "/bin/true", "_uses_shell": false, "chdir": null, "creates": null, "executable": null, "removes": null, "warn": true}, "module_name": "command"}, "rc": 0, "start": "2016-02-25 12:08:55.457802", "stderr": "", "stdout": "", "stdout_lines": [], "warnings": []}

TASK [Task 2] ******************************************************************
task path: /home/user/playbooks/two_plays.pb.yaml:11
ESTABLISH LOCAL CONNECTION FOR USER: user
host1 EXEC /bin/sh -c '( umask 22 &amp;&amp; mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1456427335.51-149718488385002 `" &amp;&amp; echo "` echo $HOME/.ansible/tmp/ansible-tmp-1456427335.51-149718488385002 `" )'
host1 PUT /tmp/tmpatPQZV TO /home/user/.ansible/tmp/ansible-tmp-1456427335.51-149718488385002/command
host1 EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /home/user/.ansible/tmp/ansible-tmp-1456427335.51-149718488385002/command; rm -rf "/home/user/.ansible/tmp/ansible-tmp-1456427335.51-149718488385002/" &gt; /dev/null 2&gt;&amp;1'
changed: [host1] =&gt; {"changed": true, "cmd": ["/bin/true"], "delta": "0:00:00.005788", "end": "2016-02-25 12:08:55.568887", "invocation": {"module_args": {"_raw_params": "/bin/true", "_uses_shell": false, "chdir": null, "creates": null, "executable": null, "removes": null, "warn": true}, "module_name": "command"}, "rc": 0, "start": "2016-02-25 12:08:55.563099", "stderr": "", "stdout": "", "stdout_lines": [], "warnings": []}

RUNNING HANDLER [Handler 1] ****************************************************
ESTABLISH LOCAL CONNECTION FOR USER: user
host1 EXEC /bin/sh -c '( umask 22 &amp;&amp; mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1456427335.6-154968896387882 `" &amp;&amp; echo "` echo $HOME/.ansible/tmp/ansible-tmp-1456427335.6-154968896387882 `" )'
host1 PUT /tmp/tmpoh615S TO /home/user/.ansible/tmp/ansible-tmp-1456427335.6-154968896387882/command
host1 EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /home/user/.ansible/tmp/ansible-tmp-1456427335.6-154968896387882/command; rm -rf "/home/user/.ansible/tmp/ansible-tmp-1456427335.6-154968896387882/" &gt; /dev/null 2&gt;&amp;1'
changed: [host1] =&gt; {"changed": true, "cmd": ["/bin/true"], "delta": "0:00:00.005483", "end": "2016-02-25 12:08:55.646776", "invocation": {"module_args": {"_raw_params": "/bin/true", "_uses_shell": false, "chdir": null, "creates": null, "executable": null, "removes": null, "warn": true}, "module_name": "command"}, "rc": 0, "start": "2016-02-25 12:08:55.641293", "stderr": "", "stdout": "", "stdout_lines": [], "warnings": []}

NO MORE HOSTS LEFT *************************************************************

PLAY RECAP *********************************************************************
host1                      : ok=3    changed=3    unreachable=0    failed=0   
host2                      : ok=0    changed=0    unreachable=0    failed=1   
</code></pre></div>
<h5 dir="auto">ISSUE TYPE</h5>
<ul dir="auto">
<li>Feature Idea</li>
</ul>
<h5 dir="auto">COMPONENT NAME</h5>
<p dir="auto">patterns, group of groups, static inventory file</p>
<h5 dir="auto">ANSIBLE VERSION</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ansible 2.2.0.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = Default w/o overrides"><pre class="notranslate"><code class="notranslate">ansible 2.2.0.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = Default w/o overrides
</code></pre></div>
<h5 dir="auto">CONFIGURATION</h5>
<p dir="auto">Empty files for ansible.cfg, and no ANSIBLE_ environment variables</p>
<h5 dir="auto">OS / ENVIRONMENT</h5>
<p dir="auto">CentOS 6.9</p>
<h5 dir="auto">SUMMARY</h5>
<p dir="auto">ansible is used in our environment to manage cluster servers. The cluster in our environment is formed by 3 servers. However, in daily operation, we usually have to run some specific tasks regarding to the nodes. Thus we have to define another 3 groups to represent the first, the second and the third server of each cluster. For example (inventory file):</p>
<div class="highlight highlight-source-ini notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="[ha-cluster-1]
node-a.de
node-b.de
node-c.de

[ha-cluster-2]
node-x.us
node-y.us
node-z.us

# ... 100+ similar ha-cluster- section

[ha-cluster-129]
server-a.fr
server-b.fr
server-c.fr

[all-ha-cluster:children]
ha-cluster-1
ha-cluster-2
# ... 100+ group names
ha-cluster-129

[all-ha-cluster-1st-node]
node-a.de
node-x.us
# ... 100+ hosts from the first server of each ha-cluster section
server-a.fr

[all-ha-cluster-2nd-node]
node-b.de
node-y.us
# ... 100+ hosts from the first server of each ha-cluster section
server-b.fr"><pre class="notranslate"><span class="pl-en">[ha-cluster-1]</span>
node-a.de
node-b.de
node-c.de

<span class="pl-en">[ha-cluster-2]</span>
node-x.us
node-y.us
node-z.us

<span class="pl-c"><span class="pl-c">#</span> ... 100+ similar ha-cluster- section</span>

<span class="pl-en">[ha-cluster-129]</span>
server-a.fr
server-b.fr
server-c.fr

<span class="pl-en">[all-ha-cluster:children]</span>
ha-cluster-1
ha-cluster-2
<span class="pl-c"><span class="pl-c">#</span> ... 100+ group names</span>
ha-cluster-129

<span class="pl-en">[all-ha-cluster-1st-node]</span>
node-a.de
node-x.us
<span class="pl-c"><span class="pl-c">#</span> ... 100+ hosts from the first server of each ha-cluster section</span>
server-a.fr

<span class="pl-en">[all-ha-cluster-2nd-node]</span>
node-b.de
node-y.us
<span class="pl-c"><span class="pl-c">#</span> ... 100+ hosts from the first server of each ha-cluster section</span>
server-b.fr</pre></div>
<p dir="auto">As the example illustrates, <code class="notranslate">all-ha-cluster-1st-node</code> and <code class="notranslate">all-ha-cluster-2nd-node</code> just duplicate the hostnames which have been listed above. This just makes the inventory file hard to be managed.<br>
So I'm thinking if pattern is supported by "group of groups", this file can be more simple. For example:</p>
<div class="highlight highlight-source-ini notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="[all-ha-cluster:children]
ha-cluster-* # represent all groups which start with &quot;ha-cluster-&quot;
[all-ha-cluster-1st-node:children]
ha-cluster-*[0] # represent all first node in the groups which start with &quot;ha-cluster-&quot;
[all-ha-cluster-2nd-node:children]
ha-cluster-*[1] # represent all second node in the groups which start with &quot;ha-cluster-&quot;"><pre class="notranslate"><span class="pl-en">[all-ha-cluster:children]</span>
ha-cluster-* <span class="pl-c"><span class="pl-c">#</span> represent all groups which start with "ha-cluster-"</span>
<span class="pl-en">[all-ha-cluster-1st-node:children]</span>
ha-cluster-*[0] <span class="pl-c"><span class="pl-c">#</span> represent all first node in the groups which start with "ha-cluster-"</span>
<span class="pl-en">[all-ha-cluster-2nd-node:children]</span>
ha-cluster-*[1] <span class="pl-c"><span class="pl-c">#</span> represent all second node in the groups which start with "ha-cluster-"</span></pre></div>
<p dir="auto">In that case lots of lines can be save and the inventory file becomes more tidy.</p>
<h5 dir="auto">STEPS TO REPRODUCE</h5>
<p dir="auto">n/a</p>
<h5 dir="auto">EXPECTED RESULTS</h5>
<p dir="auto">n/a</p>
<h5 dir="auto">ACTUAL RESULTS</h5>
<p dir="auto">n/a</p>