Hi all,
Having some issues calling a specific plugin - ansible.utils.ipmath - with ansible core 2.18.6.
When I call “ipmath”, I get my expected output. However, this is using ansible.netcommon.ipmath which is deprecated
[DEPRECATION WARNING]: Filter "ansible.netcommon.ipmath" has been deprecated. Use 'ansible.utils.ipmath' module instead. This feature will be removed from ansible.netcommon in a release after 2024-01-01.
Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
If I explicitly call either of those (ansible.netcommon.ipmath, or ansible.utils.ipmath) directly I get errors.
FAILED! => {"msg": "lookup plugin (ansible.netcommon.ipmath) not found"}
FAILED! => {"msg": "lookup plugin (ansible.utils.ipmath) not found"}
despite the collection being installed
(.venv) user@Ansible:~/AnsibleProject$ ansible-galaxy collection install ansible.utils
Starting galaxy collection install process
Nothing to do. All requested collections are already installed. If you want to reinstall them, consider using `--force`.
Is there a way of explicitly telling ansible I don’t want to use netcommon, and use utils instead? I’m presuming it would work as the collection is already installed, and despite me not being able to call the full name, ansible would find the appropriate plugin from utils, as it is doing with netcommon currently.
Thanks
Task code:
- name: Generate SVI and HSRP IPs per VLAN
set_fact:
svis: >-
{% set result = [] %}
{% for vlan in vlans | default([]) %}
{% if 'subnet' in vlan %}
{% set subnet = vlan.subnet %}
{% set prefix = vlan.subnet.split('/')[-1] %}
{% set hsrp_ip = subnet | ipmath(1) %}
{% set svi_ip = subnet | ipmath(1 + switch_id) %}
{% set _ = result.append({
'vlan_id': vlan.vlan_id,
'ip': svi_ip ~ '/' ~ prefix,
'hsrp_ip': hsrp_ip
}) %}
{% endif %}
{% endfor %}
{{ result }}