Ok, given the following group_vars:
iloms:
- gateway: 10.224.64.1
mask: 255.255.248.0
- gateway: 10.85.0.1
mask: 255.255.254.0
and an ip from a lookup:
ilom_ip: "{{ lookup('dig', 'mgmt-' + ansible_local.system_facts.host_serial
+ '.example.com') }}"
I need to compare ilom_ip to {{ item.gateway }}/{{ item.mask }} and if it
is in the same subnet, use those values (and if not, test the next, etc)
I know I can concatenate the gw and mask:
ilom_net = '{{ item.gateway }}/{{ item.mask }}'
with_items: iloms
and that I can test if ilom_ip is in the same subnet as ilom_net with:
{{ ilom_ip | ipaddr(ilom_net) }}
But how do I combine these into a task and reliably get the correct gw/mask
to use in additional tasks (setting ip/gw/netmask on on ilom)
--
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/b8d1f3ec-a0af-4a30-a4c7-06e08a715781%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.