Thanks, Nikhil. The tower-manage inventory import did the trick. On Thursday, 22 December 2016 22:56:30 UTC+5:30, [email protected] wrote: > > There are couple of options here. > > If its a host ini file, which is a static file and is not managed by any > version control, you can use tower-manage to import the inventory to tower > > http://docs.ansible.com/ansible-tower/latest/html/administration/tower-manage.html > > There is also ability to add custom inventory scripts as dynamic inventory > sources through the Tower UI. You'll need to create a custom script that > pulls the inventory data as json. > > > http://docs.ansible.com/ansible-tower/latest/html/administration/custom_inventory_script.html#custom-inventory-scripts > > > http://docs.ansible.com/ansible/developing_inventory.html#developing-dynamic-inventory-sources > > Let me know if this helps. > > Thanks, > Nikhil > > On Wednesday, December 21, 2016 at 5:08:59 PM UTC+5:30, Chethan S wrote: >> >> Thank you very much, Brian and Mark. I have been using the with_items >> approach and providing the VM names from a static file. Since we use >> Ansible Tower, these files are fetched from a git repository. We also use >> the roles way of doing things and being relatively new to Ansible, I am >> little confused about how to go ahead here. >> >> I believe in your cases, you define the hostnames in the hosts file saved >> inside the Ansible Server or a common location. I was trying to figure out >> how do I achieve the same thing in my case where the hostnames are in the >> git repository i.e., how do I specify that in the ansible.cfg file? >> >> Can you suggest the best approach here - saving the hostnames inside the >> Ansible server Vs. fetching that from a Git repository during the job run? >> >> In my case >> >> On Wednesday, 21 December 2016 01:25:19 UTC+5:30, Mark Phillips wrote: >>> >>> >>> On Tuesday, 20 December 2016 19:53:01 UTC, Brian Coca wrote: >>>> >>>> I was going for even simpler: >>>> >>> >>> Dude, you rock! >>> >>> >>> >>> >>>> >>>> # inventory >>>> >>>> [vm_group] >>>> host[1-50] ansible_connection=local >>>> >>>> # play >>>> - hosts: vm_group >>>> gather_facts: false >>>> tasks: >>>> - create_vm: name={{inventory_hostname} .... >>>> delegate_to: localhost >>>> >>>> >>>> ---------- >>>> Brian Coca >>>> >>>
-- 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 [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/8321c1a5-8754-4111-8269-963da20e7231%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
