Hi,
Try with this:
{% for instance in instances %}
pgservice : {{ (instance['mgservices'] | default(default_mgservice))['name'] }}
{% endfor %}
Cheers,
Marko
CONFIDENTIALITY NOTICE: This message is the property of International Game
Technology PLC and/or its subsidiaries and may contain
>
>
> Just a guess:
> Your problem is not the default, but rather how you try to address
> your dict.
>
> Try this:
> pgservice: {{ instance["msgservices"]["name"] }}
>
> Johannes
>
Thanks but I have the same error. I want to use default_mgservice.name
when mgservices is not defined.
I
On 08.02.17 11:29 adrien nayrat wrote:
> instances:
> - name: ref
> mgservices:
> name: test1
> pgservice : {{ instance.mgservices.name |
> "AnsibleUndefinedVariable: 'dict object' has no attribute 'mgservices'"}
Just a guess:
Your problem is not the default, but rather how you
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