<h5 dir="auto">Issue Type:</h5>
<p dir="auto">Bug</p>
<h5 dir="auto">Ansible Version:</h5>
<p dir="auto">Have encountered it in head, 1.5.2 and 1.5.3, according to discussions on irc it has been around for quite some time.</p>
<h5 dir="auto">Environment:</h5>
<p dir="auto">Deploy os is Os X mavericks servers deployed to is debian 7.</p>
<h5 dir="auto">Summary:</h5>
<p dir="auto">When using child groups to be able to override som variables, the variable from the parent group is the one that gets used.</p>
<p dir="auto">All tough this bug is not explicitly described in the pull request <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="29129998" data-permission-text="Title is private" data-url="https://github.com/ansible/ansible/issues/6379" data-hovercard-type="pull_request" data-hovercard-url="/ansible/ansible/pull/6379/hovercard" href="https://github.com/ansible/ansible/pull/6379">#6379</a> it did solve the problem. Tested the PR when merging with 1.5.3 branch.</p>
<h5 dir="auto">Steps To Reproduce:</h5>
<p dir="auto">small example snippet (I can add full files if needed).</p>
<p dir="auto">Inventory file:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[devproxyservers]
10.0.40.83
10.0.40.84

[proxyservers:children]
devproxyservers"><pre class="notranslate"><code class="notranslate">[devproxyservers]
10.0.40.83
10.0.40.84

[proxyservers:children]
devproxyservers
</code></pre></div>
<p dir="auto">proxyservers group vars</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="cert_path: &quot;{{ base_dir }}/certs/{{ cert_name }}&quot;
key_path: &quot;{{ base_dir }}/certs/{{ key_name }}&quot;"><pre class="notranslate"><code class="notranslate">cert_path: "{{ base_dir }}/certs/{{ cert_name }}"
key_path: "{{ base_dir }}/certs/{{ key_name }}"
</code></pre></div>
<p dir="auto">devproxyservers group vars</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="cert_path: &quot;{{ base_dir }}/certs/fake_cert.crt&quot;
key_path: &quot;{{ base_dir }}/certs/fake_key.key&quot;"><pre class="notranslate"><code class="notranslate">cert_path: "{{ base_dir }}/certs/fake_cert.crt"
key_path: "{{ base_dir }}/certs/fake_key.key"
</code></pre></div>
<h5 dir="auto">Expected Results:</h5>
<p dir="auto">according to docs <a href="http://docs.ansible.com/playbooks_variables.html#variable-precedence-where-should-i-put-a-variable" rel="nofollow">http://docs.ansible.com/playbooks_variables.html#variable-precedence-where-should-i-put-a-variable</a> the cild group vars should be used.</p>
<h5 dir="auto">Actual Results:</h5>
<p dir="auto">The variables of proxyservers group is the variable that gets used</p>
<p dir="auto">Allow for nesting of groups within groups in the /etc/ansible/hosts Inventory File.  A comparative (but not exact match) feature would be LUMPs in dsh.</p>
<p dir="auto">Examples would be something like:</p>
<p dir="auto">[datacenters]<br>
east-coast-dc<br>
west-coast-dc</p>
<p dir="auto">[east-coast-dc]<br>
eastcoast-webservers<br>
eastcoast-appservers</p>
<p dir="auto">[west-coast-dc]<br>
westcoast-webservers<br>
westcoast-appservers</p>
<p dir="auto">[east-coast-webservers]<br>
web1<br>
web2</p>
<p dir="auto">[west-coast-webservers]<br>
web3<br>
web4</p>
<p dir="auto">[site-webservers]<br>
east-coast-webservers<br>
west-coast-webservers</p>
<p dir="auto">There may be some better ways to accomplish some of the nesting via something like tagging classes/roles/location of host defs, but I haven't thought that completely through yet.  Could be of the form:</p>
<p dir="auto">host: location:class/role, i.e</p>
<p dir="auto">web1:east-coast:webserver<br>
app3:west-coast:appserver<br>
webapp2:east-coast:appserver,webserver</p>
<p dir="auto">Need to balance extensibility against simplicity here, but limiting the amount of duplication in the configuration will help out tremendously for inheritance and reduce errors and mistakes in forgetting to add hosts to multiple groups.</p>