I have this role (roles/dummy/tasks/main.yml) :
---
- debug: var=dum_name
and this playbook (test.yml) :
---
- hosts: localhost
vars:
name: "{{ foo_name | default('boom') }}"
tasks:
- debug: var=name
roles:
- { role: dummy, dum_name: "{{ name }}" }
If I define a variable "foo_name=bar" in the inventory file for localhost ,
I get this output :
TASK: [dummy | debug var=dum_name]
********************************************
ok: [localhost] => {
"var": {
"dum_name": "boom"
}
}
TASK: [debug var=name]
********************************************************
ok: [localhost] => {
"var": {
"name": "bar"
}
}
In the dummy task, I expected : "dum_name": "bar" .
In a real application, I need to use several times a same role with
different parameters. A simple way to get the same thing is :
...
roles:
- { role: dummy, dum_name: "{{ foo_name | default('boom') }}" }
but the problem is the same : I get "boom" in the result instead of "bar" .
What is the solution/workaround ?
Regards,
Fabien
--
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/ae0a9684-b008-4771-a86d-06d61520e541%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.