Ansible filter & search facts

33 views
Skip to first unread message

Lemming1988

unread,
Oct 6, 2015, 8:39:38 AM10/6/15
to Ansible Project
Hi guys,

i have a RHEL7 vm with this facts that show the network configi:

[root@****** /etc/ansible]# ansible testserver -m setup -a 'filter=ansible_eno16777728'
********** | success >> {
    "ansible_facts": {
        "ansible_eno16777728": {
            "active": true,
            "device": "eno16777728",
            "macaddress": "00:50:56:9d:3e:fe",
            "module": "e1000",
            "mtu": 1500,
            "promisc": false,
            "type": "ether"
        }
    },
    "changed": false
}

Is there a way to obtain the fact "device" that display the network device name from the macaddress?

Somethig like this:

 - name: Print device name know the macaddress
  debug: msg="UUDI={{ ansible_eno*.device }}"
 when ansible_eno*.macaddress == '00:50:56:9d:3e:fe'

Any idea?

Thanks in advance!
Reply all
Reply to author
Forward
0 new messages