ansible / ansible.utils / 4.0.0 / filter / macaddr macaddr / MAC address filters | "added in version" 2.5.0 of ansible.utils" Authors: Ashwini Mhatre (@amhatre)ansible.utils.macaddr (4.0.0) — filter
Install with ansible-galaxy collection install ansible.utils:==4.0.0
collections: - name: ansible.utils version: 4.0.0
This filter check if string is a MAC address and filter it
You can use the macaddr() filter to check if a given string is a MAC address or convert it between various formats.
#### examples - name: Check if given string is a MAC address debug: msg: "{{ '1a:2b:3c:4d:5e:6f' | ansible.utils.macaddr }}"
- name: Convert MAC address to Cisco format debug: msg: "{{ '1a:2b:3c:4d:5e:6f' | ansible.utils.macaddr('cisco') }}"
query: default: '' description: query string. Example. cisco,linux,unix etc type: str value: description: HW/MAC address. required: true type: str
data: description: - mac/Hw address type: str