ansible / ansible.utils / 4.0.0 / filter / reduce_on_network This filter reduces a list of addresses to only the addresses that match a given network. | "added in version" 2.5.0 of ansible.utils" Authors: Ashwini Mhatre (@amhatre)ansible.utils.reduce_on_network (4.0.0) — filter
Install with ansible-galaxy collection install ansible.utils:==4.0.0
collections: - name: ansible.utils version: 4.0.0
This filter reduces a list of addresses to only the addresses that match a given network.
To check whether multiple addresses belong to a network, use the reduce_on_network filter.
- name: To check whether multiple addresses belong to a network, use the reduce_on_network filter. debug: msg: "{{ ['192.168.0.34', '10.3.0.3', '192.168.2.34'] | ansible.utils.reduce_on_network( '192.168.0.0/24' ) }}"
value: description: the list of addresses to filter on. elements: str required: true type: list network: description: The network to validate against. type: str
data: description: - Returns whether an address or a network passed as argument is in a network. type: bool