Take a look at this page,
https://docs.ansible.com/ansible/latest/playbooks_filters_ipaddr.html
Doesn’t seem to be working when I implement it in my code:
- name: If the IP address is destined for the .1 subnet…
when: set_machinename | ipaddr(‘192.168.1.0/24’)
It still skips over this range even if I specify set_machinename to ‘192.168.1.4’.
In your earlier mail you wrote /24 now you are using /32?
192.168.1.4 is not part of 192.168.1.0/32, only 192.168.1.0 is that.
Yea, no I corrected that mistake. I meant to say /24, not /32. Still gets bypassed when I run the ansible script.
What I can say it's working for me.
test.yml
I got it. Thanks Kai. Wrong variable referenced.