# inventory and group vars

**URL:** <https://forum.ansible.com/t/inventory-and-group-vars/27957>\
**Category:** Ansible Project\
**Created:** [July 5, 2018, 3:14pm UTC](https://forum.ansible.com/t/inventory-and-group-vars/27957 "2018-07-05T15:14:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![lior\_hollander](https://avatars.discourse-cdn.com/v4/letter/l/7ba0ec/32.png) [@lior\_hollander](https://forum.ansible.com/u/lior_hollander)\
**Post date:** [July 5, 2018, 3:14pm UTC](https://forum.ansible.com/t/inventory-and-group-vars/27957/1 "2018-07-05T15:14:24Z")

</div>

hey,

i have the following directory layout, and its not working:

```auto
inventories/
   production/
      hosts # inventory file for production servers
      group_vars/
         group1.yml # here we assign variables to particular groups
         group2.yml
      host_vars/
         hostname1.yml # here we assign variables to particular systems
         hostname2.yml

   staging/
      hosts # inventory file for staging environment
      group_vars/
         group1.yml # here we assign variables to particular groups
         group2.yml
      host_vars/
         stagehost1.yml # here we assign variables to particular systems
         stagehost2.yml

library/
module_utils/
filter_plugins/

site.yml
webservers.yml
dbservers.yml

roles/
    common/
    webtier/
    monitoring/
    fooapp/

```

```auto

i run the command:

ansible-playbook -i inventories site.yml --vault-password-file=/etc/ansible/password-file

and it says:
that is failes to connect with ssh, but i told it in the group1.yml to connect with 443.
i created the group_vars folder where my site,yml is and under that created the all.yml and then it connects but doesnt find all the veriables in the group1.yml.

WHY?

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [July 5, 2018, 4:05pm UTC](https://forum.ansible.com/t/inventory-and-group-vars/27957/2 "2018-07-05T16:05:35Z")

</div>

You have 2 group1.yml, I suspect you define the same vars differently  
in them, the inventories are additive, not separate, to use them  
separate you need to `-i invetnories/production`
