Facts

10 views
Skip to first unread message

Tcpip

unread,
Apr 12, 2018, 6:30:53 PM4/12/18
to Ansible Project
Hi all,

I have the following playbook 

---                                                                                                                                                                                                                                           
- hosts: r2
  gather_facts: true
  connection: local
  vars:
    creds:
      host: "{{ ansible_host }}"
      username: cisco
      password: cisco
 
  tasks:
    - name: ios_facts
      ios_facts:
         provider: "{{ creds }}"
 
    - debug:
        var: ansible_net_interfaces


If I do a debut I get this output

"ansible_net_interfaces": {
        "Ethernet0/0": {
            "bandwidth": 10000, 
            "description": null, 
            "duplex": null, 
            "ipv4": [
                {
                    "address": "10.10.10.12", 
                    "subnet": "24"
                }
            ], 
            "lineprotocol": "up ", 
            "macaddress": "aabb.cc00.2000", 
            "mediatype": null, 
            "mtu": 1500, 
            "operstatus": "up", 
            "type": "AmdP2"
        }, 
        "Ethernet0/1": {
            "bandwidth": 10000, 
            "description": null, 
            "duplex": null, 
            "ipv4": [], 
            "lineprotocol": "down ", 
            "macaddress": "aabb.cc00.2010", 
            "mediatype": null, 
            "mtu": 1500, 
            "operstatus": "administratively down", 
            "type": "AmdP2"



What im trying to do is to check if the fact "lineprotocol" is up or down, but when I put the fact in my var is not working, how should I do this?

thanks
Reply all
Reply to author
Forward
0 new messages