'issue with ipaddr filter to filter mac adress
I would check the entered mac_address syntax with the ipaddr filter which requires netaddr python package to use it.
The netaddr is already installed in my controller
Requirement already satisfied: netaddr in /usr/lib/python3.6/site-packages (0.7.19)
but when i run the playbook this what i get
---
- name: test MAC address manipulation
hosts: all
strategy: free
gather_facts: no
connection: local
no_log: false
# vars_prompt:
# - name: "macaddress"
# prompt: "mac address?"
# private: no
vars:
macaddress: "1a-2b-3c-4d-5e-6f"
tasks:
- name: display all the formats
ignore_errors: true
debug:
msg:
- Original = {{ macaddress }}
- ""
- "{ macaddress | ansible.utils.hwaddr('bool') } = {{ macaddress | ansible.utils.hwaddr('bool') }}"
Playbook execution
*
fatal: [Control]: FAILED! => {"msg": "The hwaddr filter requires python's netaddr be installed on the ansible controller"}
...ignoring
fatal: [Ansible1]: FAILED! => {"msg": "The hwaddr filter requires python's netaddr be installed on the ansible controller"}
...ignoring
fatal: [Ansible2]: FAILED! => {"msg": "The hwaddr filter requires python's netaddr be installed on the ansible controller"}
...ignoring
fatal: [Tower]: FAILED! => {"msg": "The hwaddr filter requires python's netaddr be installed on the ansible controller"}
...ignoring
fatal: [ansible3]: FAILED! => {"msg": "The hwaddr filter requires python's netaddr be installed on the ansible controller"}
...ignoring
fatal: [Ubuntu]: FAILED! => {"msg": "The hwaddr filter requires python's netaddr be installed on the ansible controller"}
...ignoring
PLAY RECAP *******************************************************************************************************************
Ansible1 : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=1
Ansible2 : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=1
Control : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=1
Tower : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=1
Ubuntu : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=1
ansible3 : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=1
this is the ansible and python version
ansible [core 2.12.5]
config file = /etc/ansible/ansible.cfg
configured module search path = ['/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3.8/site-packages/ansible
ansible collection location = /home/x/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/bin/ansible
python version = 3.8.12 (default, Sep 21 2021, 00:10:52) [GCC 8.5.0 20210514 (Red Hat 8.5.0-3)]
jinja version = 2.10.3
libyaml = True
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
