Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save andrewgdunn/bd8dc605932a6fb5ecc8caef4efcd25b to your computer and use it in GitHub Desktop.
Save andrewgdunn/bd8dc605932a6fb5ecc8caef4efcd25b to your computer and use it in GitHub Desktop.
- name: get the device name of the nic of a given mac
command: bash -c "ip a | grep {{macaddress}} -B 1 | awk '{print $2; ; exit}' | sed s/://g"
register: network_device_name
- name: get the pciid of the network device using facts
debug:
msg: "{{ansible_facts[network_device_name.stdout].pciid}}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment