I have four different hosts. host1, host2, host3, host4
I am trying to update following files on the these hosts.
host1
/var/www/foo1
host2
/var/www/foo1
/var/tmp/foo1
host3
/var/www/foo1
host4
/var/tmp/foo1
I am able to write two different playbook with different inventory files and group vars to achieve this task.
Inventory file 1
[group_foo1]
host1
host2
host3
Group variable
File name: group_foo1
path:/var/www
Inventory file 2
[group_foo2]
host2
host4
Group variable
File name: group_foo2
path:/var/tmp
Task
name: copy the file
copy: src=foo1 dest={{path}}
I want to do this task using single playbook.
How it can be done?