<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="ansible 2.1.1.0"><pre class="notranslate"><code class="notranslate">ansible 2.1.1.0
</code></pre></div>
<h5 dir="auto">CONFIGURATION</h5>
<h5 dir="auto">OS / ENVIRONMENT</h5>
<p dir="auto">Ubuntu 16.04</p>
<h5 dir="auto">SUMMARY</h5>
<p dir="auto">group_vars are ignored if the inventory is the output of a script that is stored in a subdirectory. This includes the popular ec2 inventory script. This bug was introduced in 2.1.1.0 (2.1.0.0 works fine).</p>
<h5 dir="auto">STEPS TO REPRODUCE</h5>
<h6 dir="auto"><code class="notranslate">inventory/script.sh</code></h6>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="#!/bin/sh

echo '{&quot;webservers&quot;: [&quot;paperberry&quot;]}'"><pre class="notranslate"><code class="notranslate">#!/bin/sh

echo '{"webservers": ["paperberry"]}'
</code></pre></div>
<h6 dir="auto"><code class="notranslate">group_vars/all.yml</code>:</h6>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="
---
frontend_path: /var/www/html"><pre class="notranslate"><code class="notranslate">
---
frontend_path: /var/www/html
</code></pre></div>
<h6 dir="auto"><code class="notranslate">playbooks/webservers.yml</code>:</h6>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="
---
- hosts: all
  connection: local
  tasks:
  - debug: var=frontend_path"><pre class="notranslate"><code class="notranslate">
---
- hosts: all
  connection: local
  tasks:
  - debug: var=frontend_path
</code></pre></div>
<p dir="auto">Run the following code:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ansible-playbook -i inventory/script.sh playbooks/webservers.yml "><pre class="notranslate"><code class="notranslate">ansible-playbook -i inventory/script.sh playbooks/webservers.yml 
</code></pre></div>
<h5 dir="auto">EXPECTED RESULTS</h5>
<p dir="auto">ansible 2.1.0.0 shows</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ok: [paperberry] =&gt; {
    &quot;frontend_path&quot;: &quot;/var/www/html&quot;
}"><pre class="notranslate"><code class="notranslate">ok: [paperberry] =&gt; {
    "frontend_path": "/var/www/html"
}
</code></pre></div>
<h5 dir="auto">ACTUAL RESULTS</h5>
<p dir="auto">ansible 2.1.1.0 shows</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ok: [paperberry] =&gt; {
    &quot;frontend_path&quot;: &quot;VARIABLE IS NOT DEFINED!&quot;
}"><pre class="notranslate"><code class="notranslate">ok: [paperberry] =&gt; {
    "frontend_path": "VARIABLE IS NOT DEFINED!"
}
</code></pre></div>
<p dir="auto">The ability to have role dependencies is nice, but it would be even better to be able to<br>
call a role as a task with parameters.  It would still be ok having to define the role as a<br>
dependency in meta, but perhaps with a run tag, for example:</p>
<p dir="auto">meta/main.yml</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="dependencies:
  -  role: pre
     arg: bar 
  -  role: bar
     auto: false
  -  role: finalize
     auto: post"><pre class="notranslate"><code class="notranslate">dependencies:
  -  role: pre
     arg: bar 
  -  role: bar
     auto: false
  -  role: finalize
     auto: post
</code></pre></div>
<p dir="auto">the default is then, as now, auto: pre<br>
and then in tasks/main.yml</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="- name: do something that I do alot from different places
  role: bar arg=baz"><pre class="notranslate"><code class="notranslate">- name: do something that I do alot from different places
  role: bar arg=baz
</code></pre></div>