Anyone use this filter function? It seems like a lookup to see if an IP or subnet is a member of a larger prefix.
https://github.com/ansible-collections/ansible.netcommon/blob/master/plugins/filter/ipaddr.py#L665
I am just not sure on the proper usage.
Thanks!
Hi,
There are some great examples on the ipaddr filter’s documentation page: https://docs.ansible.com/ansible/latest/user_guide/playbooks_filters_ipaddr.html#playbooks-filters-ipaddr
Yes, one of the things you can do is check to see if an IP belongs to a subnet.
Hello Scott,
I’m very familiar with the documented functions of the ipaddr filter. If you look at the link you just sent cidr_lookup is not a documented function, but it is listed in the source code of the filter as I linked to in my original post.
Thanks!
I think what you’re asking for can be found by looking at the example for “By specifying a network range as a query, you can check if a given value is in that range:” in the docs.
An example playbook:
Scott,
I appreciate your patience here. Even when I said I am very familiar with the document, you pressed on and pointed me to the item that was right in front of my face! That worked perfectly
Thanks!