<h5 dir="auto">ISSUE TYPE</h5>
<ul dir="auto">
<li>Bug Report</li>
</ul>
<h5 dir="auto">COMPONENT NAME</h5>
<p dir="auto">include and include_tasks</p>
<h5 dir="auto">ANSIBLE VERSION</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ansible 2.4.3.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /bin/ansible
  python version = 2.7.5 (default, Aug  4 2017, 00:39:18) [GCC 4.8.5 20150623 (Red Hat 4.8.5-16)]"><pre class="notranslate"><code class="notranslate">ansible 2.4.3.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /bin/ansible
  python version = 2.7.5 (default, Aug  4 2017, 00:39:18) [GCC 4.8.5 20150623 (Red Hat 4.8.5-16)]
</code></pre></div>
<h5 dir="auto">CONFIGURATION</h5>
<p dir="auto">No change</p>
<h5 dir="auto">SUMMARY</h5>
<p dir="auto">If I run a playbook importing many tasks with "include_tasks" (ansible-loop_include_tasks.tar.gz), it hangs with the error:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="OSError: [Errno 12] Cannot allocate memory"><pre class="notranslate"><code class="notranslate">OSError: [Errno 12] Cannot allocate memory
</code></pre></div>
<p dir="auto">However, if I run the same playbook with "include" (ansible-loop_include.tar.gz) instead of "include_tasks", it finishes successfully.</p>
<h5 dir="auto">STEPS TO REPRODUCE</h5>
<p dir="auto">Attached the following playbooks to replicate this:</p>
<ul dir="auto">
<li>
<p dir="auto">Using "include_tasks":<br>
<a href="https://github.com/ansible/ansible/files/1717114/ansible-loop_include_tasks.tar.gz">ansible-loop_include_tasks.tar.gz</a></p>
</li>
<li>
<p dir="auto">Using "include":<br>
<a href="https://github.com/ansible/ansible/files/1717113/ansible-loop_include.tar.gz">ansible-loop_include.tar.gz</a></p>
</li>
</ul>
<h5 dir="auto">EXPECTED RESULTS</h5>
<p dir="auto">Both of playbooks finishes correctly.</p>
<h5 dir="auto">ACTUAL RESULTS</h5>
<p dir="auto">When I ran the playbook with "include_tasks" (ansible-loop_include_tasks.tar.gz), I am getting the following error:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="TASK [loop : Hello Message] ******************************************************************************************************************************************************************
task path: /home/vagrant/ansible-projects/ansible-loop/loop/tasks/hello-world-32.yml:2
ERROR! Unexpected Exception, this is probably a bug: [Errno 12] Cannot allocate memory
the full traceback was:

Traceback (most recent call last):
  File &quot;/bin/ansible-playbook&quot;, line 106, in &lt;module&gt;
    exit_code = cli.run()
  File &quot;/usr/lib/python2.7/site-packages/ansible/cli/playbook.py&quot;, line 122, in run
    results = pbex.run()
  File &quot;/usr/lib/python2.7/site-packages/ansible/executor/playbook_executor.py&quot;, line 154, in run
    result = self._tqm.run(play=play)
  File &quot;/usr/lib/python2.7/site-packages/ansible/executor/task_queue_manager.py&quot;, line 290, in run
    play_return = strategy.run(iterator, play_context)
  File &quot;/usr/lib/python2.7/site-packages/ansible/plugins/strategy/linear.py&quot;, line 277, in run
    self._queue_task(host, task, task_vars, play_context)
  File &quot;/usr/lib/python2.7/site-packages/ansible/plugins/strategy/__init__.py&quot;, line 254, in _queue_task
    worker_prc.start()
  File &quot;/usr/lib64/python2.7/multiprocessing/process.py&quot;, line 130, in start
    self._popen = Popen(self)
  File &quot;/usr/lib64/python2.7/multiprocessing/forking.py&quot;, line 121, in __init__
    self.pid = os.fork()
OSError: [Errno 12] Cannot allocate memory"><pre class="notranslate"><code class="notranslate">TASK [loop : Hello Message] ******************************************************************************************************************************************************************
task path: /home/vagrant/ansible-projects/ansible-loop/loop/tasks/hello-world-32.yml:2
ERROR! Unexpected Exception, this is probably a bug: [Errno 12] Cannot allocate memory
the full traceback was:

Traceback (most recent call last):
  File "/bin/ansible-playbook", line 106, in &lt;module&gt;
    exit_code = cli.run()
  File "/usr/lib/python2.7/site-packages/ansible/cli/playbook.py", line 122, in run
    results = pbex.run()
  File "/usr/lib/python2.7/site-packages/ansible/executor/playbook_executor.py", line 154, in run
    result = self._tqm.run(play=play)
  File "/usr/lib/python2.7/site-packages/ansible/executor/task_queue_manager.py", line 290, in run
    play_return = strategy.run(iterator, play_context)
  File "/usr/lib/python2.7/site-packages/ansible/plugins/strategy/linear.py", line 277, in run
    self._queue_task(host, task, task_vars, play_context)
  File "/usr/lib/python2.7/site-packages/ansible/plugins/strategy/__init__.py", line 254, in _queue_task
    worker_prc.start()
  File "/usr/lib64/python2.7/multiprocessing/process.py", line 130, in start
    self._popen = Popen(self)
  File "/usr/lib64/python2.7/multiprocessing/forking.py", line 121, in __init__
    self.pid = os.fork()
OSError: [Errno 12] Cannot allocate memory
</code></pre></div>
<p dir="auto">Relative to the setup dir, ansible should treat the following paths just like they were in vars_files:</p>
<p dir="auto">./groups/groupname.yml<br>
./vars/hostname.yml</p>
<p dir="auto">This will allow people to not have to explicitly duplicate this kind of magic in each playbook, and will give the INI format users a very good way to have complex per-group or per-host data (lists and hashes) if they need it.</p>
<p dir="auto">This is step 1 of 2 in allowing us to deprecate the YAML inventory format -- step 2 is to write a migration script.</p>