Combine inventory listings

29 views
Skip to first unread message

Scott

unread,
Oct 16, 2017, 4:01:51 AM10/16/17
to Ansible Project
Hi,

I am working with multiple Openstack and AWS clouds and need to run application installation on instances across across them.  I currently run my playbooks against each cloud separately using the dynamic openstack.py and ec2.py as I need the dynamic functionality thes provide.  Apart from rerunning the same playbook multiple times I also sometimes need information about hosts that resides in a different cloud (i.e. IP Address for security groups).  I was wondering if there is a way to combine different inventory outputs into a single usable inventory list that can be used by a playbook.

Yannig Perre

unread,
Oct 16, 2017, 4:07:19 AM10/16/17
to Ansible Project
Hi,

With last version of Ansible (2.4), you can specify multiple inventory files (-i inventory1 -i inventory2). Maybe this is what you're looking for?

Regards

Scott

unread,
Oct 16, 2017, 4:17:16 AM10/16/17
to Ansible Project
Thats sounds like what I need although (apart from an upgrade from 2.2) I'm wondering how would that handle the different authentication credentials needed for each cloud dynamic scripts? 

Yannig Perre

unread,
Oct 16, 2017, 4:48:46 AM10/16/17
to Ansible Project
In this case, maybe you need to wrap your dynamic inventory script with a shell script that set env variables correctly.

Brian Coca

unread,
Oct 16, 2017, 9:27:24 AM10/16/17
to Ansible Project
Pre 2.4 you can just put the scripts and configuration in the same
directory and use the directory as the inventory.

There should be no need to wrap the dynamic inventories as they dont
have overlapping settings, unless they are the same script.
As for remote auth, I recommend setting up connection variables as
group vars and assigning each source of inventory to one of the groups
so as not to have to pass it from the CLI.



--
----------
Brian Coca
Reply all
Reply to author
Forward
0 new messages