Hi,
Here is my variable :
instances:
- name: ref
mgservices:
name: test1
My default variable:
default_mgservice :
name: blah
I want to use "default_mgservice.name" when mgservices is not defined :
instances:
- name: ref
Here is my template
{% for instance in instances %}
pgservice : {{ instance.mgservices.name | default(default_mgservice.name) }}
{% endfor %}
But it failed :
"AnsibleUndefinedVariable: 'dict object' has no attribute 'mgservices'"}
I don't understand why default do not work on dict? Any idea?
Thanks
--
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/d1f524ff-075e-458b-95ca-bed4e1333304%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.