I have a static inventory setup with the hope of applying different roles
to different hosts, but am finding that this playbook is not achieving what
I would like:
- hosts: "{{target}}"
pre_tasks:
- debug: var=role
roles:
- "{{role}}"
tasks:
- debug: var=role
post_tasks:
- debug: var=role
Ultimately with an inventory of:
192.168.1.13 role=test
Executing this playbook:
ansible-playbook -i inventory testrole.yml -e "target=192.168.1.13"
ERROR! 'role' is undefined
This persists no matter where I attempt to define that role variable, in
inventory, group_vars, host_vars, etc. If I comment out the roles stanza,
all the debug tasks report the variable being interpolated correctly no
matter how I do it. The only way I have found the role to be variable so
far is to define it with --extra-args at the command line.
I this a bug, or am I running into a hard boundary of ansible?
--
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/b824f6ac-ad74-492b-917a-8a9d23354572%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.