Hi all,
I'm wonder if it's possible to pass variables from playbook to role which
has template.
Example:
playbook.yml
- roles:
- { role: monit, monit_proc: "sshd",monit_ssh_port: "25"}
monit role:
monit/templates/sshd.conf.j2 :
check process sshd with pidfile {{ monit_ssh_pid }}
group system
start program "/etc/init.d/ssh start"
stop program "/etc/init.d/ssh stop"
if failed port {{ monit_ssh_port }} protocol ssh then restart
if {{ monit_restarts }} restarts within {{ monit_cycles}} cycles then
timeout
monit/tasks/main.yml :
- name: Add {{ monit_proc }}
template:
src=/etc/ansible/configs/monit/monit.d/{{monit_proc}}.j2.conf
dest=/etc/monit/conf.d/{{monit_proc}}.conf
tags:
- monit_cfg
Or maybe it's wrong approach ?
Best regards,
Morbious
--
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/aa600fa5-790f-42ae-8828-dfb969f1bd4a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.