Is it possible to create multiple VMs in parallel? As of now, it’s one VM after another. I use the vmware_guest module for creating VMs in vCenter Server.
I tried specifying strategy: free but that is not helping.
Is it possible to create multiple VMs in parallel? As of now, it’s one VM after another. I use the vmware_guest module for creating VMs in vCenter Server.
I tried specifying strategy: free but that is not helping.
if the source of data of your VMs is with_, it will be serial, if you use inventory and hosts: it will be parallel.
Funnily enough I had this conversation with somebody on the Twitters a while back. I suggested ‘getting clever’ with inventory (as Brian alludes to too, actually).
Here’s an example …
https://gist.github.com/phips/1e895096ca70c85ad3c870b38d6677eb
I was going for even simpler:
[vm_group]
host[1-50] ansible_connection=local
I was going for even simpler:
Dude, you rock!
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
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/developing_inventory.html#developing-dynamic-inventory-sources
Let me know if this helps.
Thanks,
Nikhil
Thanks, Nikhil. The tower-manage inventory import did the trick.
I find it weird, using this approach that… intermittently, network will not be configured on your first entry(VM) in your inventory.