I think you are going to have to change, or at least add something to do 
this.

I would do this by adding a temporary inventory file and group vars.  

If you have inventory with groups like

[webservers]
host1 app_folder=/opt/instance1


[database]
host1 app_folder=/opt/instance2


then you can have a playbook that does something like the following:

hosts: webservers:
roles:
   - install_app


hosts: database
roles:
   - install_app


if install_app uses app_folder
as the installation dir for app then you can get 2 

Don't forget you can set defaults in your role so that you only have to 
provide an override for the hosts that need it.

I have an inventory file which has all the same group names as my test and 
production inventories, but only 1 actual host, which points at a virtual 
machine which I can revert back to a 'blank' snapshot.  I use this a lot 
for developing my provisioning playbooks.

Hope this helps,

Jon

On Wednesday, October 26, 2016 at 10:05:19 AM UTC+1, ishan jain wrote:
>
> I have a situation for which we have decided to allow multiple instances 
> of the same app to run on same host machines. I do not want to modify my 
> playbook or inventory to incorporate this temporary hack and was wondering 
> if i can do that simply by modifying host list and some of the variables. 
> So i need to know two main things:
>
> 1) Is there a way i can repeat a target host in my playbook ? I have tried 
> repeating the hostname in the comma separated list but that doesn't work
>
> 2) How can i override some variables for this repeated host ?
>

-- 
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/e0cd4e8c-7282-4a55-889e-2fb5bc2e28a9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to