On 14.12.2022 08:14, Dick Visser wrote:
On Wed, 14 Dec 2022 at 00:31, Adrian Sevcenco <[email protected]
<mailto:[email protected]>>
_network_reduced: "{{ ansible_all_ipv4_addresses |
ansible.utils.reduce_on_network('XX.XXX.XX.0/24') }}"
Something unrelated, but I had not heard of this filter. Looking at the docs on
https://docs.ansible.com/ansible/latest/collections/ansible/utils/reduce_on_network_filter.html
<https://docs.ansible.com/ansible/latest/collections/ansible/utils/reduce_on_network_filter.html>, it seems to me that
it is doing the same thing as:
ansible.utils.ipaddr('XX.XXX.XX.0/24')
Or am I missing something?
yeah, ipaddr just validate the input to being a valid ip
reduce_on network take a list of ips, and returns a list of ips that matched
the given network, see
https://docs.ansible.com/ansible/latest/collections/ansible/utils/reduce_on_network_filter.html#ansible-collections-ansible-utils-reduce-on-network-filter
the purpose was to copy a specific to network configuration file depending on
the host ip.
Ideally i should customize the name of the file depending on this (and not the
task)
but i do not know yet to write jinja "if else return" type of code
Thanks!
Adrian
--
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/3f3b22cc-4342-b2f7-e9b2-713d0649d9a5%40gmail.com.