I have a group of hosts that have two tomcat instances on them, and I need the server.xml to have different values in each instance. Initially, I tried to write a jinja2 loop into a template, which I bailed on when someone in the IRC channel pointed out parameterizing the role (from
http://docs.ansible.com/ansible/playbooks_roles.html - there's not a direct anchor, so I'll quote):
Also, should you wish to parameterize roles, by adding variables, you can do so, like this:
- hosts: webservers
roles:
- common
- { role: foo_app_instance, dir: '/opt/a', port: 5000 }
- { role: foo_app_instance, dir: '/opt/b', port: 5001 }
But when I try the above, both server.xml's end up with the same value. It looks like each subsequent pass through the role puts it's value in both directories, so after the second time it runs, both server.xml's have the second value. I pastebinned my playbook, role, and the line from the template:
http://pastebin.com/eDMQkY3H
If anybody could help me with this, or tell me what I'm doing wrong, I'd greatly appreciate it.