<h5 dir="auto">ISSUE TYPE</h5>

<ul dir="auto">
<li>Bug Report</li>
</ul>
<h5 dir="auto">COMPONENT NAME</h5>
<p dir="auto">Inventory</p>
<h5 dir="auto">ANSIBLE VERSION</h5>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ ansible-playbook --version
ansible-playbook 2.4.0.0
  config file = /home/shrews/.ansible.cfg
  configured module search path = ['/home/shrews/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/shrews/Devel/git/openstack-infra/zuul/.tox/py35/lib/python3.6/site-packages/ansible
  executable location = /home/shrews/Devel/git/openstack-infra/zuul/.tox/py35/bin/ansible-playbook
  python version = 3.6.2 (default, Aug 11 2017, 11:59:59) [GCC 7.1.1 20170622 (Red Hat 7.1.1-3)]"><pre class="notranslate"><code class="notranslate">$ ansible-playbook --version
ansible-playbook 2.4.0.0
  config file = /home/shrews/.ansible.cfg
  configured module search path = ['/home/shrews/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/shrews/Devel/git/openstack-infra/zuul/.tox/py35/lib/python3.6/site-packages/ansible
  executable location = /home/shrews/Devel/git/openstack-infra/zuul/.tox/py35/bin/ansible-playbook
  python version = 3.6.2 (default, Aug 11 2017, 11:59:59) [GCC 7.1.1 20170622 (Red Hat 7.1.1-3)]
</code></pre></div>
<h5 dir="auto">CONFIGURATION</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ ansible-config dump --only-changed
[DEPRECATION WARNING]: [defaults]hostfile option, The key is misleading as it can also be a list of hosts, a directory or a list of paths . This feature will be removed in version 2.8. Deprecation warnings can be disabled by 
setting deprecation_warnings=False in ansible.cfg."><pre class="notranslate"><code class="notranslate">$ ansible-config dump --only-changed
[DEPRECATION WARNING]: [defaults]hostfile option, The key is misleading as it can also be a list of hosts, a directory or a list of paths . This feature will be removed in version 2.8. Deprecation warnings can be disabled by 
setting deprecation_warnings=False in ansible.cfg.
</code></pre></div>
<p dir="auto">Set hostsfile to a hosts.yaml file.</p>
<h5 dir="auto">OS / ENVIRONMENT</h5>
<p dir="auto">Fedora 26</p>
<h5 dir="auto">SUMMARY</h5>
<p dir="auto">Behavior of 'all' (at least in a YAML host inventory file) seems to have changed.</p>
<h5 dir="auto">STEPS TO REPRODUCE</h5>


<p dir="auto">hosts.yaml:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="all:
  hosts:
    controller:
      ansible_host: localhost
      ansible_connection: local
    localhost:
      ansible_connection: local"><pre class="notranslate"><code class="notranslate">all:
  hosts:
    controller:
      ansible_host: localhost
      ansible_connection: local
    localhost:
      ansible_connection: local
</code></pre></div>
<p dir="auto">Example playbook:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="---
- hosts: all
  name: Foo
  tasks:
     - name: Bar
       shell: |
          echo &quot;Hello World&quot;"><pre class="notranslate"><code class="notranslate">---
- hosts: all
  name: Foo
  tasks:
     - name: Bar
       shell: |
          echo "Hello World"
</code></pre></div>

<h5 dir="auto">EXPECTED RESULTS</h5>
<p dir="auto">Expected results (generated from Ansible 2.3):</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ ansible-playbook ~/a.yaml 

PLAY [Foo] *********************************************************************

TASK [Gathering Facts] *********************************************************
ok: [localhost]
ok: [controller]

TASK [Bar] *********************************************************************
changed: [controller]
changed: [localhost]

PLAY RECAP *********************************************************************
controller                 : ok=2    changed=1    unreachable=0    failed=0   
localhost                  : ok=2    changed=1    unreachable=0    failed=0 "><pre class="notranslate"><code class="notranslate">$ ansible-playbook ~/a.yaml 

PLAY [Foo] *********************************************************************

TASK [Gathering Facts] *********************************************************
ok: [localhost]
ok: [controller]

TASK [Bar] *********************************************************************
changed: [controller]
changed: [localhost]

PLAY RECAP *********************************************************************
controller                 : ok=2    changed=1    unreachable=0    failed=0   
localhost                  : ok=2    changed=1    unreachable=0    failed=0 
</code></pre></div>
<h5 dir="auto">ACTUAL RESULTS</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ ansible-playbook -vvv ~/a.yaml 
ansible-playbook 2.4.0.0
  config file = /home/shrews/.ansible.cfg
  configured module search path = ['/home/shrews/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/shrews/Devel/git/openstack-infra/zuul/.tox/py35/lib/python3.6/site-packages/ansible
  executable location = /home/shrews/Devel/git/openstack-infra/zuul/.tox/py35/bin/ansible-playbook
  python version = 3.6.2 (default, Aug 11 2017, 11:59:59) [GCC 7.1.1 20170622 (Red Hat 7.1.1-3)]
Using /home/shrews/.ansible.cfg as config file
[DEPRECATION WARNING]: [defaults]hostfile option, The key is misleading as it can also be a list of hosts, a directory or a list of paths . This feature will be removed in version 2.8. Deprecation warnings can be disabled by 
setting deprecation_warnings=False in ansible.cfg.
 [WARNING]: Unable to parse /etc/ansible/hosts as an inventory source

 [WARNING]: No inventory was parsed, only implicit localhost is available

 [WARNING]: Could not match supplied host pattern, ignoring: all

 [WARNING]: provided hosts list is empty, only localhost is available


PLAYBOOK: a.yaml *****************************************************************************************************************************************************************************************************************
1 plays in /home/shrews/a.yaml

PLAY [Foo] ***********************************************************************************************************************************************************************************************************************
skipping: no hosts matched

PLAY RECAP ***************************************************************************************************"><pre class="notranslate"><code class="notranslate">$ ansible-playbook -vvv ~/a.yaml 
ansible-playbook 2.4.0.0
  config file = /home/shrews/.ansible.cfg
  configured module search path = ['/home/shrews/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/shrews/Devel/git/openstack-infra/zuul/.tox/py35/lib/python3.6/site-packages/ansible
  executable location = /home/shrews/Devel/git/openstack-infra/zuul/.tox/py35/bin/ansible-playbook
  python version = 3.6.2 (default, Aug 11 2017, 11:59:59) [GCC 7.1.1 20170622 (Red Hat 7.1.1-3)]
Using /home/shrews/.ansible.cfg as config file
[DEPRECATION WARNING]: [defaults]hostfile option, The key is misleading as it can also be a list of hosts, a directory or a list of paths . This feature will be removed in version 2.8. Deprecation warnings can be disabled by 
setting deprecation_warnings=False in ansible.cfg.
 [WARNING]: Unable to parse /etc/ansible/hosts as an inventory source

 [WARNING]: No inventory was parsed, only implicit localhost is available

 [WARNING]: Could not match supplied host pattern, ignoring: all

 [WARNING]: provided hosts list is empty, only localhost is available


PLAYBOOK: a.yaml *****************************************************************************************************************************************************************************************************************
1 plays in /home/shrews/a.yaml

PLAY [Foo] ***********************************************************************************************************************************************************************************************************************
skipping: no hosts matched

PLAY RECAP ***************************************************************************************************
</code></pre></div>
<h5 dir="auto">ISSUE TYPE</h5>
<ul dir="auto">
<li><del>B ug Report</del></li>
<li>Docs Report</li>
</ul>
<h5 dir="auto">COMPONENT NAME</h5>
<p dir="auto">import_playbook</p>
<h5 dir="auto">ANSIBLE VERSION</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ansible 2.3.2.0
  config file = /home/foo/.ansible.cfg
  configured module search path = Default w/o overrides
  python version = 2.7.13 (default, May  8 2017, 12:47:14) [GCC 4.4.7 20120313 (Red Hat 4.4.7-17)]"><pre class="notranslate"><code class="notranslate">ansible 2.3.2.0
  config file = /home/foo/.ansible.cfg
  configured module search path = Default w/o overrides
  python version = 2.7.13 (default, May  8 2017, 12:47:14) [GCC 4.4.7 20120313 (Red Hat 4.4.7-17)]
</code></pre></div>
<h5 dir="auto">CONFIGURATION</h5>
<p dir="auto">Bog standard.  Set inventory path.</p>
<h5 dir="auto">OS / ENVIRONMENT</h5>
<p dir="auto">RHEL6</p>
<h5 dir="auto">SUMMARY</h5>
<p dir="auto">The documentation at (<a href="http://docs.ansible.com/ansible/latest/playbooks_reuse_includes.html" rel="nofollow">http://docs.ansible.com/ansible/latest/playbooks_reuse_includes.html</a>) for <strong>import_playbook</strong> shows what seems to be invalid YAML.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="---
import_playbook: webservers.yml
import_playbook: databases.yml"><pre class="notranslate"><code class="notranslate">---
import_playbook: webservers.yml
import_playbook: databases.yml
</code></pre></div>
<p dir="auto">Sure enough, trying a simple example like this fails, with:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[WARNING]: While constructing a mapping from /data0/tenadarts/ansible/playbooks/configure.yml, line 2, column 1, found a duplicate dict key (import_playbook). Using last defined value only."><pre class="notranslate"><code class="notranslate">[WARNING]: While constructing a mapping from /data0/tenadarts/ansible/playbooks/configure.yml, line 2, column 1, found a duplicate dict key (import_playbook). Using last defined value only.
</code></pre></div>
<p dir="auto">Followed by,</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ERROR! playbooks must be a list of plays"><pre class="notranslate"><code class="notranslate">ERROR! playbooks must be a list of plays
</code></pre></div>
<h5 dir="auto">STEPS TO REPRODUCE</h5>
<p dir="auto">Create two playbooks, test1.yml and test2.yml</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="---
- hosts: linux
  tasks:
    - ping: {}    "><pre class="notranslate"><code class="notranslate">---
- hosts: linux
  tasks:
    - ping: {}    
</code></pre></div>
<p dir="auto">Create a playbook, pb.yml</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="---
import_playbook: test1.yml
import_playbook: test2.yml"><pre class="notranslate"><code class="notranslate">---
import_playbook: test1.yml
import_playbook: test2.yml
</code></pre></div>
<p dir="auto">Run:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ansible-playbook pb.yml"><pre class="notranslate"><code class="notranslate">ansible-playbook pb.yml
</code></pre></div>
<p dir="auto">This results in the <strong>ERROR! Playbooks must be a list of plays</strong> above.<br>
Trying to guess at the required structure, I also tried:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="---
- import_playbook: test1.yml
- import_playbook: test2.yml"><pre class="notranslate"><code class="notranslate">---
- import_playbook: test1.yml
- import_playbook: test2.yml
</code></pre></div>
<p dir="auto">This yields: <strong>ERROR! 'import_playbook' is not a valid attribute for a Play</strong></p>
<h5 dir="auto">EXPECTED RESULTS</h5>
<p dir="auto">The two playbooks are imported then executed.</p>
<h5 dir="auto">ACTUAL RESULTS</h5>
<p dir="auto">Various syntax errors.</p>