On 14.05.19 09:23, Daniel Vašek wrote:
> Hello,
>
> Im trying to use default filter:
>
> hosts: ["{{ groups['examples'][0] | default('localhost') }}":5045]
>
You should be able to use: groups.examples.0 | default(...)
This is the one case where dot notation is simpler/better :)
Sebastian
>
> But it return error:
>
>
> FAILED! => {"changed": false, "msg": "AnsibleUndefinedVariable: 'dict
> object' has no attribute 'examples'"}.
>
>
> I read something about default can use only 1 level deep, but I cannot
> write more levels properly.
>
>
>
--
Sebastian Meyer
Linux Consultant & Trainer
Mail: [email protected]
B1 Systems GmbH
Osterfeldstraße 7 / 85088 Vohburg / http://www.b1-systems.de
GF: Ralph Dehner / Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537
--
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/f4953f3c-b75d-d2d4-09a6-30313f391e4f%40b1-systems.de.
For more options, visit https://groups.google.com/d/optout.