The source nested dictionary is for instance the following:
vpc:
provider:
- net_type: 'db'
net_ipv4_subnet: '10.0.0.0/16'
net_ipv6_subnet: 'FD00::/64'
net_id: '0'
nic_ids:
- 1111111111
- 2222222222
- net_type: 'dns'
net_ipv4_subnet: '10.1.0.0/16'
net_ipv6_subnet: 'FD01::/64'
net_id: '1'
nic_ids:
- 3333333333
- 4444444444
- net_type: 'ns'
net_ipv4_subnet: '10.2.0.0/16'
net_ipv6_subnet: 'FD02::/64'
net_id: '2'
nic_ids:
- 5555555555
- 6666666666
We need to remove the item ''4444444444 from the list <nic_ids> located
inside the dictionary matched by the key/value net_id=='1'.
Selecting the <nic_ids> list inside the right dictionary is easy with:
vpc.provider | selectattr('net_id', 'eq', '1') | map(attribute= 'nic_ids'),
but I have no idea how to remove the item from list and build the new
vpc.provider?
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/ea7107ba-2836-49ac-b3fb-a3a1e26fad20n%40googlegroups.com.