Roger Sherman
2015-07-29 18:23:41 UTC
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
- 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.
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
- 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.
--
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 ansible-project+***@googlegroups.com.
To post to this group, send email to ansible-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/e1d377c2-93d9-45eb-99d6-697ff41ae43a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
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 ansible-project+***@googlegroups.com.
To post to this group, send email to ansible-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/e1d377c2-93d9-45eb-99d6-697ff41ae43a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.