benefit of Dynamic Inventory over static inventory

160 views
Skip to first unread message

Usama Mehboob

unread,
Nov 28, 2014, 7:18:22 AM11/28/14
to ansible...@googlegroups.com
I have written dynamic inventory scripts https://dpaste.de/1mVa . But I dont get whats the benefit of using dynamic inventory. I still had to list all the things which I used in static inventory. could you tell me in what way I can get most out of dynamic inventory. In what ways It is better to use, right now I dont think so

Brian Coca

unread,
Nov 28, 2014, 10:38:12 AM11/28/14
to ansible...@googlegroups.com
Well, dynamic inventories make sense when you have an external source
(cloud provider, vm system, db, inventory system, ldap, etc) not when
you are just listing the hosts manually. If that is the case just
stick with the ini format.

--
Brian Coca

Dann Bohn

unread,
Nov 28, 2014, 11:21:27 PM11/28/14
to ansible...@googlegroups.com
One added benifit of dynamic inventories is support for more complex facts. You can set lists and dictionaries as facts with a dynamic source, and you can't with the ini format. That said, it looks like in your case sticking with ini may be the way to go.

Brian Coca

unread,
Nov 28, 2014, 11:58:27 PM11/28/14
to ansible...@googlegroups.com
With both formats, you can do complex variables using the
host_vars/<hostname> group_vars/<groupname> with yaml files.



--
Brian Coca

William Muriithi

unread,
Nov 30, 2014, 12:48:18 PM11/30/14
to ansible...@googlegroups.com
Brian
> Brian Coca <bc...@ansible.com>: Nov 28 10:38AM -0500
Thank you a lot. Petty good answer and it make sense now as I had the
same problem.

Was wondering, have you been able to retrieve a list of hosts' IPs
given a list of vmware IPs? I have struggled with this a lot and the
fact that dynamic inventory is designed for such case mean there is a
way, just haven't found it


Would be great to share

William

Brian Coca

unread,
Nov 30, 2014, 1:10:54 PM11/30/14
to ansible...@googlegroups.com
there is actually an existing inventory script for vmware/vcenter, in
the repo at plugins/inventory/vmware.py, check your ansible
installation for the file and set it up as your inventory. You can
also copy the vmware.ini in the same directory as an example for
setting it up.


--
Brian Coca

Chris Church

unread,
Dec 1, 2014, 8:57:38 AM12/1/14
to ansible...@googlegroups.com
I've made some VMware inventory updates that will become a PR once I get tags working.  It includes a change to define ansible_ssh_host for running VMs.

You can give it a try from my branch in the meantime:




--
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-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAJ5XC8%3DajEjGm0MPR6MGwAn-10gcQQ_FNFt%3DFsT7sbYU5oeFYw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages