# Inventory Configuration Question

**URL:** <https://forum.ansible.com/t/inventory-configuration-question/23634>\
**Category:** Ansible Project\
**Created:** [February 3, 2017, 8:16pm UTC](https://forum.ansible.com/t/inventory-configuration-question/23634 "2017-02-03T20:16:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anthony\_Bond1](https://avatars.discourse-cdn.com/v4/letter/a/439d5e/32.png) [@Anthony\_Bond1](https://forum.ansible.com/u/Anthony_Bond1)\
**Post date:** [February 3, 2017, 8:16pm UTC](https://forum.ansible.com/t/inventory-configuration-question/23634/1 "2017-02-03T20:16:46Z")

</div>

I have been using Ansible in a limited fashion and have configured a static inventory. I’m trying to build onto this inventory by adding groups\_vars and host\_vars for individual cluster groups. Problem is Ansible isn’t picking up the required group\_vars. Does anyone see why my group\_vars wouldn’t be loading with this inventory structure. I’m only testing with the dev3 group before filling out the remaining group\_vars directories.

Command: ansible -m debug dev3 -i /ansible/inventory -a “var=hostvars[inventory\_hostname]”

`inventory/`  
├── batch  
│ ├── group\_vars  
│ ├── hosts  
│ └── host\_vars  
├── dev0  
│ ├── group\_vars  
│ ├── hosts  
│ └── host\_vars  
├── dev1  
│ ├── group\_vars  
│ ├── hosts  
│ └── host\_vars  
├── dev2  
│ ├── group\_vars  
│ ├── hosts  
│ └── host\_vars  
├── dev3  
│ ├── group\_vars  
│ │ ├── dev3  
│ │ │ └── vars.yml  
│ │ └── dev3\_db  
│ ├── hosts  
│ └── host\_vars  
├── dev4  
│ ├── group\_vars  
│ ├── hosts  
│ └── host\_vars  
├── dev5  
│ ├── group\_vars  
│ ├── hosts  
│ └── host\_vars  
├── dev6  
│ ├── group\_vars  
│ ├── hosts  
│ └── host\_vars  
└── dev7  
├── group\_vars  
├── hosts  
└── host\_vars

Current Sample Output:

`

[dev1.domain.com](http://dev1.domain.com/) | SUCCESS =\> {  
“hostvars[inventory\_hostname]”: {  
“ansible\_check\_mode”: false,  
“ansible\_version”: {  
“full”: “2.1.2.0”,  
“major”: 2,  
“minor”: 1,  
“revision”: 2,  
“string”: “2.1.2.0”  
},  
“group\_names”: [  
“dev3”  
],  
“groups”: {  
“all”: [  
“[test1.domain.com](http://test1.domain.com/)”,  
“[test2.domain.com](http://test2.domain.com/)”,  
“[test3.domain.com](http://test3.domain.com/)”,  
“[dev1.domain.com](http://dev1.domain.com/)”,

“[dev2.domain.com](http://dev2.domain.com/)”,  
“[dev3.domain.com](http://dev3.domain.com/)”,  
“[dev4.domain.com](http://dev4.domain.com/)”  
],  
“dev3”: [  
“[dev1.domain.com](http://dev1.domain.com/)”,  
“[dev2.domain.com](http://dev2.domain.com/)”,  
“[dev3.domain.com](http://dev3.domain.com/)”,  
“[dev4.domain.com](http://dev4.domain.com/)”,  
“[dev5.domain.com](http://dev5.domain.com/)”  
],  
“ungrouped”:   
},  
“inventory\_dir”: “/ansible/inventory”,  
“inventory\_file”: null,  
“inventory\_hostname”: “[dev3.domain.com](http://dev3.domain.com/)”,  
“inventory\_hostname\_short”: “dev3”,  
“omit”: “\_\_omit\_place\_holder\_\_998cd0b3347833ef6af77480e6387c8135a35469”,  
“playbook\_dir”: “.”  
}  
}

`

Expected Output with the addition of my group\_vars  
“app\_location”: “east”,  
“db\_connection”: “some string value”,

`  
[dev1.domain.com](http://dev1.domain.com/) | SUCCESS =\> {  
“hostvars[inventory\_hostname]”: {  
“ansible\_check\_mode”: false,  
“ansible\_version”: {  
“full”: “2.1.2.0”,  
“major”: 2,  
“minor”: 1,  
“revision”: 2,  
“string”: “2.1.2.0”  
},

“app\_location”: “east”,  
“db\_connection”: “some string value”,

“group\_names”: [  
“dev3”  
],  
“groups”: {  
“all”: [  
“[test1.domain.com](http://test1.domain.com/)”,  
“[test2.domain.com](http://test2.domain.com/)”,  
“[test3.domain.com](http://test3.domain.com/)”,  
“[dev1.domain.com](http://dev1.domain.com/)”,

“[dev2.domain.com](http://dev2.domain.com/)”,  
“[dev3.domain.com](http://dev3.domain.com/)”,  
“[dev4.domain.com](http://dev4.domain.com/)”  
],  
“dev3”: [  
“[dev1.domain.com](http://dev1.domain.com/)”,  
“[dev2.domain.com](http://dev2.domain.com/)”,  
“[dev3.domain.com](http://dev3.domain.com/)”,  
“[dev4.domain.com](http://dev4.domain.com/)”,  
“[dev5.domain.com](http://dev5.domain.com/)”  
],  
“ungrouped”:   
},  
“inventory\_dir”: “/ansible/inventory”,  
“inventory\_file”: null,  
“inventory\_hostname”: “[dev3.domain.com](http://dev3.domain.com/)”,  
“inventory\_hostname\_short”: “dev3”,  
“omit”: “\_\_omit\_place\_holder\_\_998cd0b3347833ef6af77480e6387c8135a35469”,  
“playbook\_dir”: “.”  
}  
}  
`

I do know that running the below command will produce the desired data that I’m expecting, but now I don’t have all of my hosts that I want. I’m probably trying to over organize my hosts by breaking all my groups out into small clusters of groups. What I found odd is Ansible can read the hosts files located in the individual cluster directories but it won’t recognize the group\_vars unless I move my group\_vars under /ansible/inventory…

ansible -m debug dev403 -i /ansible/inventory/dev403 -a “var=hostvars[inventory\_hostname]”
