Re: [ansible-project] group_vars dir structure question (2.4.2.0)

32 views
Skip to first unread message
Message has been deleted

Matt Martz

unread,
Jan 15, 2018, 10:28:04 AM1/15/18
to ansible...@googlegroups.com
group_vars and host_vars can reside in 2 locations.

1) Relative to the current executing playbook file
2) Relative to the inventory file

Note that I explicitly mention "file", as that is what ansible uses when looking relative for these directories.

On Sun, Jan 14, 2018 at 9:58 AM, James <jame...@gmail.com> wrote:
Hi All,

I am trying to understand how the inventory structure works with group_vars. I currently have:

├── inventory/
│   ├── cisco/
│   │   ├── 2621XM/
│   │   │   └── 12.4/
│   │   │       └── cg/
│   │   │           └── 1
│   │   └── WS-C3550/
│   │       └── 12.2/
│   │           └── cg/
│   │               └── 1
│   └── group_vars/
│       ├── 2621XM
│       ├── all
│       ├── cisco
│       └── WS-C3550

Where the default inventory path in Ansible.cfg is set to /etc/ansible/inventory.

While the above dir structure works, it's not what I am after. I want to be able to set group (cg) specific vars to hosts specified in the INI (1) but still run the playbook from my default inventory path - because I want to run one playbook on all of the hosts but have different login creds for each cg file (eg: 1).

Is this possible, or do I have to do something like this:

├── inventory/
│   ├── cisco/
│   │   ├── 2621XM/
│   │   │   └── 12.4/
│   │   │       └── cg/
│   │   │           └── 1
│   │   │           └── group_vars
│   │   │             └── all

Then run ansible-playbook play.yml -i /etc/ansible/inventory/cisco/2621XM/12.4/cg

Any help would be much appreciated.

Regards,

James





 

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscribe@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/35224535-2a88-435e-a977-33c3d0d973b2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Matt Martz
@sivel
sivel.net
Reply all
Reply to author
Forward
0 new messages