On 22. nov. 2016 21:18, Don Jackson wrote:
> Here is a truncated version of a fact for one network interface on a server:
>
> "ansible_eth2": {
> "active": true,
> "device": "eth2",
> "macaddress": "30:0e:d5:cb:11:fe",
> "type": "ether"
> },
>
>
> And there are similar facts for each network interface.
>
> Given that, I need to be able to find the value for "device" for a specific
> macaddress value.
>
> How would I do that?
Something like this.
mac.yml
---
- debug: msg="This is the mac"
when: hostvars[inventory_hostname]['ansible_' + item].macaddress |
default() == "xx:xx:xx:xx:xx:xx"
play.yml
---
- hosts: all
tasks:
- include: mac.yml
with_items: "{{ ansible_interfaces }}"
--
Kai Stian Olstad
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/c461af0c-abb9-c06b-1d15-0328b5fce792%40olstad.com.
For more options, visit https://groups.google.com/d/optout.