just to make sure - this is a list of list of dictionaries.
If this is your source of truth, and you intend to have a list of dicts,
then it could look like this:
domain_definition:
- name: server11
cluster: cluster1
port: '8080'
- name: server12
cluster: cluster2
port: '8090'
- name: server21
cluster: cluster3
port: '9080'
- name: server22
cluster: cluster4
port: '9090'
This will make a difference when manipulating the data.
On Tue, 21 Apr 2020 at 17:40, jean-christophe manciot <
[email protected]> wrote:
> Let's suppose the following list of dictionaries:
> - domain_definition:
> - name: server11
> cluster: cluster1
> port: '8080'
> - name: server12
> cluster: cluster2
> port: '8090'
> - name: server21
> cluster: cluster3
> port: '9080'
> - name: server22
> cluster: cluster4
> port: '9090'
>
> The aim is to extract all ```name: 'value'``` from ```domain_definition```
> into a list:
> - name: server11
> - name: server12
> - name: server21
> - name: server22
>
> I tried for instance the following:
> - set_fact:
> domain_definition_names_list: "{{ ['name'] |
> intersect(domain_definition.keys()|list)
> }}"
> but it fails:
> fatal: [localhost]: FAILED! => {
> "msg": "The task includes an option with an undefined variable. The
> error was: 'list object' has no attribute 'keys'...}
>
> Any suggestion?
>
>
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/0d4429c3-3a17-4078-ade4-38cd1f48ed83%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/0d4429c3-3a17-4078-ade4-38cd1f48ed83%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
--
Dick Visser
Trust & Identity Service Operations Manager
GÉANT
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/CAL8fbwPARCMT9AAtcfU_uM%3D8w2FdH3namShi7%3DXfK7Z%2BUAc8YQ%40mail.gmail.com.