-
-
Save myh-st/c042cfbba35605e725a4f65231730187 to your computer and use it in GitHub Desktop.
Ansible: Get mac addresses of all interfaces except local
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- hosts: all | |
tasks: | |
- name: Get mac addresses of all interfaces except local | |
debug: | |
msg: "{{ ansible_interfaces | difference(['lo']) | map('regex_replace', '^(.*)$', 'ansible_\\1' ) | map('extract', hostvars[inventory_hostname], 'macaddress') | list }}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment