# Build a list of Adtran AP mac addresses found on directly connected switch ports
- name: PARSE AND FILTER MAC ADDRESS-TABLE
ansible.builtin.set_fact:
macs: "{{ macs + [item] }}"
loop: "{{ macs_raw.stdout[0] | ansible.netcommon.parse_cli_textfsm('templates/cisco_ios_show_mac-address-table.textfsm') }}"
when:
- item.DESTINATION_PORT[0] not in neighbors.keys() # Ignore macs found on neighboring switches
- item.DESTINATION_ADDRESS is search('^0019\.92.*$') # Ignore macs that aren't Adtran APs
我收到以下弃用警告:
[DEPRECATION WARNING]: Use 'ansible.utils.hwaddr' 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.
ansible --version
ansible [core 2.16.6]
config file = /workspaces/git/my-repo/ansible/ansible.cfg
configured module search path = ['/home/vscode/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/python/3.11.6/lib/python3.11/site-packages/ansible
ansible collection location = /home/vscode/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/local/python/current/bin/ansible
python version = 3.11.6 (main, Dec 19 2023, 21:21:06) [GCC 11.4.0] (/usr/local/python/3.11.6/bin/python)
jinja version = 3.1.4
libyaml = True
为什么?
hwaddr、ipaddr 过滤器组的一部分已移动。两次,从 ansible 预集合到 ansible.netcommon,然后到 ansible.utils。他们不想将普遍有用的基于 netaddr 的实用程序与 ansible.netcommon 中的管理网络设备代码联系起来。
正如警告所述,ansible.utils 是要使用的名称。在所有内容中搜索
hwaddr
过滤器参考。