On 04.03.2019 17:44, Ralf Weber wrote:
> Moin!
>
> On 4 Mar 2019, at 16:55, Kai Stian Olstad wrote:
>> The correct syntax for nested list is
>>
>> stub2:
>> - - mystub2,example.net
>> - - - ns1.mystub2.example.net
>> - - 192.0.2.5
>>
>> or
>>
>> stub2:
>> -
>> - mystub2,example.net
>> -
>> -
>> - ns1.mystub2.example.net
>> -
>> - 192.0.2.5
>
> Thanks a lot. That was the trick I was looking for. You missed one array (
> the structure is complex ;-).
I don't think I missed an array, but I didn't test it so I did now.
- hosts: localhost
gather_facts: false
vars:
stub: [["mystub.example.net", [["ns1.mystub.example.net", ["192.0.2.4"]]]]]
stub2:
- - mystub2,example.net
- - - ns1.mystub2.example.net
- - 192.0.2.5
tasks:
- debug: var=stub
- debug: var=stub2
Gives:
TASK [debug] ***********************************
ok: [localhost] => {
"stub": [
[
"mystub.example.net",
[
[
"ns1.mystub.example.net",
[
"192.0.2.4"
]
]
]
]
]
}
TASK [debug] ***********************************
ok: [localhost] => {
"stub2": [
[
"mystub2,example.net",
[
[
"ns1.mystub2.example.net",
[
"192.0.2.5"
]
]
]
]
]
}
As you can see thees two are identical.
> Fully correct the yams represantion is:
>
> stub2:
> -
> - mystub2,example.net
> -
> -
> - ns1.mystub2.example.net
> -
> - 192.0.2.
> stub2:
> - - mystub2,example.net
> - - - - ns1.mystub2.example.net
> - - 192.0.2.5
>
> but that was easy to fix myself, so thanks again.
But this gives me
TASK [debug] **************************************
ok: [localhost] => {
"stub3": [
[
"mystub2,example.net",
[
[
[
"ns1.mystub2.example.net"
],
[
"192.0.2.5"
]
]
]
]
]
}
And this is *not* the same as your example in your first mail.
--
Kai Stian Olstad
--
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/fe52768c-f314-cce8-e6ff-0877f02ce5cf%40olstad.com.
For more options, visit https://groups.google.com/d/optout.