Split inventory in multiple .yml files?

31 views
Skip to first unread message

vu001

unread,
Mar 3, 2017, 10:45:40 AM3/3/17
to Ansible Project
Hi,

is it possible to split inventory in multiple files...

eg.
I have 3 projects on one virtual machine1, so I created group machine which consists of 3 subelements (projects), ProjectA, ProjectB and ProjectC

[Machine1]
ProjectA ansible_ssh_host=machine1_fqdn
ProjectB ansible_ssh_host=machine1_fqdn
ProjectC ansible_ssh_host=machine1_fqdn

So when I want to run some playbook I choose some (or all) of this projects.

But, my question is, is it possible to split ProjectA inventory file in multiple inventory files...
Somehow include in it every *.yml  file in some specific folder....

eg. 
ProjectA inventory consists of every *.yml file in ProjectA folder
So my hosts_vars would be:

ProjectA - file 
ProjectA - folder
ProjectB - file 
ProjectB - folder
ProjectC - file
ProjectC - folder


Thanks a lot!

Dennis Klein

unread,
Mar 3, 2017, 10:54:06 AM3/3/17
to Ansible Project
yes


we are using it this way.


├── inventory
  ├── group_vars
    ├── all
      ├── vars.yml
      └── vault.yml
  └── host_vars
      ├──host1
      ├── vars.yml
      └── vault.yml

192.168.20.10

vu001

unread,
Mar 6, 2017, 5:40:46 AM3/6/17
to Ansible Project
Thank you Denis...that is what I needed
Reply all
Reply to author
Forward
0 new messages