Might be a simple solution that I didn’t understand after reading http://docs.ansible.com/ansible/playbooks_loops.html but here is my case:
There is a command that should run different parameters for the same role based on group of hosts for example:
webservers group:
/usr/bin/command definition1=value1a
/usr/bin/command definition2=value2a
/usr/bin/command definition3=value3a
dbservers group:
/usr/bin/command definition1=value1b
/usr/bin/command definition2=value2b
/usr/bin/command definition3=value3b
/usr/bin/command definition4=value4b
There will be two var files, webserver.yml and dbservers.yml with the following content:
webserver.yml
definition1,value1a
definition2,value2a
definition3,value3a
dbservers.yml
definition1,value1b
definition2,value2b
definition3,value3b
definition4,value4b
- how should I loop through all pairs of definitions and values in var files and run the command?
- where do I add the name definition that it will be displayed when it’s running?
Thanks in advance