arista.eos
arista.eos copied to clipboard
arista.eos.eos_facts not returning static_routes
SUMMARY
If you do this->
- name: Gather arista eos facts
arista.eos.eos_facts:
gather_subset: config
gather_network_resources: "{{ network_resource | default('!bgp_global,!bgp_address_family') }}"
register: find_the_routes
This will not return anything, its a null issue, this will cause issues with templating out facts https://github.com/network-automation/toolkit/pull/48
ISSUE TYPE
- Bug Report
COMPONENT NAME
ANSIBLE VERSION
I am using https://quay.io/repository/acme_corp/network-ee
51│ version: ▒
52│ details: ansible [core 2.15.9]
COLLECTION VERSION
15│ arista.eos: 7.0.0
CONFIGURATION
OS / ENVIRONMENT
[student@ansible-1 ~]$ cat /etc/*release
NAME="Red Hat Enterprise Linux"
VERSION="9.2 (Plow)"
ID="rhel"
ID_LIKE="fedora"
VERSION_ID="9.2"
PLATFORM_ID="platform:el9"
PRETTY_NAME="Red Hat Enterprise Linux 9.2 (Plow)"
ANSI_COLOR="0;31"
LOGO="fedora-logo-icon"
CPE_NAME="cpe:/o:redhat:enterprise_linux:9::baseos"
HOME_URL="https://www.redhat.com/"
DOCUMENTATION_URL="https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/9"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 9"
REDHAT_BUGZILLA_PRODUCT_VERSION=9.2
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="9.2"
Red Hat Enterprise Linux release 9.2 (Plow)
Red Hat Enterprise Linux release 9.2 (Plow)
STEPS TO REPRODUCE
---
- hosts: arista
gather_facts: false
tasks:
- name: Gather arista eos facts
arista.eos.eos_facts:
gather_subset: config
gather_network_resources: "{{ network_resource | default('!bgp_global,!bgp_address_family') }}"
register: find_the_routes
- name: gather static routes
ansible.builtin.debug:
var: find_the_routes
- name: debug hostvars
debug:
var: hostvars.rtr4
EXPECTED RESULTS
If something does not exist, I would expect something "empty"
"lacp": {},
"lag_interfaces": [],
"lldp_global": {},
"logging_global": {},
that is how the other resources are treated
ACTUAL RESULTS
ok: [rtr4] => {
"hostvars.rtr4": {
"ansible_become": "true",
"ansible_become_method": "enable",
"ansible_check_mode": false,
"ansible_config_file": "/etc/ansible/ansible.cfg",
"ansible_connection": "network_cli",
"ansible_diff_mode": false,
"ansible_facts": {
"net_api": "cliconf",
"net_config": "! Command: show running-config\n! device: rtr4 (vEOS, EOS-4.27.3F-cloud)\n!\n! boot system flash:CloudEOS.swi\n!\nno aaa root\nno username admin\n!\nusername ec2-user nopassword\nusername ec2-user ssh-key ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCXcjkuCrUWbQGXbFjdlBcTYgXuUzkfkS8oTEGNrkjcI5kluXXWK/julyZr+xFyLlMJhEZEdx5UhGGYBL/HNLtGtGnxoHuaZiHI/4k8dUEHZ8j/D13dD5lyLThXHx8UCInzJ+jYGB+l4rsDetA1i6jnNJ0542IXZeqCnf1l59OT3e0i+3qwp0c+oXRIH2nrM74yXBFVo0gU2URMHvND0dnkbVOWFXnhGsxXUwTid5NWvi2IJlExZ50PoGp8tVMb9O722FFscB9o/kqmJZwDu3UT09+zJt+AtBS2hJzs7AFU7ePmbkrNK6zYxgxN2CLycEByCV9XEC2HfxuptxsCTqSJ ddhgm-key\n!\nagent KernelFib environment KERNELFIB_PROGRAM_ALL_ECMP='true'\n!\nswitchport default mode routed\n!\ntransceiver qsfp default-mode 4x10G\n!\nservice routing protocols model ribd\n!\nhostname rtr4\nip name-server vrf default 172.18.0.2\n!\nspanning-tree mode mstp\n!\naaa authentication policy on-success log\naaa authentication policy on-failure log\n!\ninterface Ethernet1\n no switchport\n ip address dhcp\n dhcp client accept default-route\n!\ninterface Ethernet100\n no switchport\n!\ninterface Loopback0\n ip address 192.168.4.4/32\n!\ninterface Tunnel0\n mtu 1394\n ip address 10.101.101.4/24\n ip ospf network point-to-point\n ip ospf area 0.0.0.0\n tunnel mode gre\n tunnel source interface Ethernet1\n tunnel destination 172.18.144.69\n tunnel path-mtu-discovery\n tunnel ttl 10\n!\nip routing\n!\nrouter ospf 1\n router-id 192.168.4.4\n redistribute connected\n max-lsa 12000\n!\nend",
"net_fqdn": "rtr4",
"net_gather_network_resources": [
"lacp_interfaces",
"ntp_global",
"hostname",
"prefix_lists",
"lacp",
"acl_interfaces",
"l2_interfaces",
"ospf_interfaces",
"interfaces",
"logging_global",
"route_maps",
"ospfv3",
"snmp_server",
"lldp_global",
"static_routes",
"vlans",
"lldp_interfaces",
"lag_interfaces",
"acls",
"ospfv2",
"l3_interfaces"
],
"net_gather_subset": [
"default",
"config"
],
"net_hostname": "rtr4",
"net_image": "flash:CloudEOS.swi",
"net_model": "vEOS",
"net_python_version": "3.9.18",
"net_serialnum": "3CED9CADA42F88005AD83D625B1FBCFC",
"net_system": "eos",
"net_version": "4.27.3F-cloud",
"network_resources": {
"acl_interfaces": [
{
"name": "Ethernet1"
},
{
"name": "Ethernet100"
},
{
"name": "Loopback0"
},
{
"name": "Tunnel0"
}
],
"hostname": {
"hostname": "rtr4"
},
"interfaces": [
{
"enabled": true,
"mode": "layer3",
"name": "Ethernet1"
},
{
"enabled": true,
"mode": "layer3",
"name": "Ethernet100"
},
{
"enabled": true,
"name": "Loopback0"
},
{
"enabled": true,
"mtu": 1394,
"name": "Tunnel0"
}
],
"l2_interfaces": [
{
"name": "Ethernet1"
},
{
"name": "Ethernet100"
},
{
"name": "Loopback0"
},
{
"name": "Tunnel0"
}
],
"l3_interfaces": [
{
"ipv4": [
{
"address": "dhcp"
}
],
"name": "Ethernet1"
},
{
"name": "Ethernet100"
},
{
"ipv4": [
{
"address": "192.168.4.4/32"
}
],
"name": "Loopback0"
},
{
"ipv4": [
{
"address": "10.101.101.4/24"
}
],
"name": "Tunnel0"
}
],
"lacp": {},
"lag_interfaces": [],
"lldp_global": {},
"logging_global": {},
"ntp_global": {},
"ospf_interfaces": [
{
"name": "Ethernet1"
},
{
"name": "Ethernet100"
},
{
"name": "Loopback0"
},
{
"address_family": [
{
"afi": "ipv4",
"area": {
"area_id": "0.0.0.0"
},
"network": "point-to-point"
}
],
"name": "Tunnel0"
}
],
"ospfv2": {
"processes": [
{
"max_lsa": {
"count": 12000
},
"process_id": 1,
"redistribute": [
{
"routes": "connected"
}
],
"router_id": "192.168.4.4"
}
]
},
"ospfv3": [],
"prefix_lists": [],
"snmp_server": {}
}
},
"ansible_forks": 5,
"ansible_host": "3.133.145.57",
"ansible_inventory_sources": [
"/home/student/lab_inventory/hosts"
],
"ansible_net_api": "cliconf",
"ansible_net_config": "! Command: show running-config\n! device: rtr4 (vEOS, EOS-4.27.3F-cloud)\n!\n! boot system flash:CloudEOS.swi\n!\nno aaa root\nno username admin\n!\nusername ec2-user nopassword\nusername ec2-user ssh-key ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCXcjkuCrUWbQGXbFjdlBcTYgXuUzkfkS8oTEGNrkjcI5kluXXWK/julyZr+xFyLlMJhEZEdx5UhGGYBL/HNLtGtGnxoHuaZiHI/4k8dUEHZ8j/D13dD5lyLThXHx8UCInzJ+jYGB+l4rsDetA1i6jnNJ0542IXZeqCnf1l59OT3e0i+3qwp0c+oXRIH2nrM74yXBFVo0gU2URMHvND0dnkbVOWFXnhGsxXUwTid5NWvi2IJlExZ50PoGp8tVMb9O722FFscB9o/kqmJZwDu3UT09+zJt+AtBS2hJzs7AFU7ePmbkrNK6zYxgxN2CLycEByCV9XEC2HfxuptxsCTqSJ ddhgm-key\n!\nagent KernelFib environment KERNELFIB_PROGRAM_ALL_ECMP='true'\n!\nswitchport default mode routed\n!\ntransceiver qsfp default-mode 4x10G\n!\nservice routing protocols model ribd\n!\nhostname rtr4\nip name-server vrf default 172.18.0.2\n!\nspanning-tree mode mstp\n!\naaa authentication policy on-success log\naaa authentication policy on-failure log\n!\ninterface Ethernet1\n no switchport\n ip address dhcp\n dhcp client accept default-route\n!\ninterface Ethernet100\n no switchport\n!\ninterface Loopback0\n ip address 192.168.4.4/32\n!\ninterface Tunnel0\n mtu 1394\n ip address 10.101.101.4/24\n ip ospf network point-to-point\n ip ospf area 0.0.0.0\n tunnel mode gre\n tunnel source interface Ethernet1\n tunnel destination 172.18.144.69\n tunnel path-mtu-discovery\n tunnel ttl 10\n!\nip routing\n!\nrouter ospf 1\n router-id 192.168.4.4\n redistribute connected\n max-lsa 12000\n!\nend",
"ansible_net_fqdn": "rtr4",
"ansible_net_gather_network_resources": [
"lacp_interfaces",
"ntp_global",
"hostname",
"prefix_lists",
"lacp",
"acl_interfaces",
"l2_interfaces",
"ospf_interfaces",
"interfaces",
"logging_global",
"route_maps",
"ospfv3",
"snmp_server",
"lldp_global",
"static_routes",
"vlans",
"lldp_interfaces",
"lag_interfaces",
"acls",
"ospfv2",
"l3_interfaces"
],
"ansible_net_gather_subset": [
"default",
"config"
],
"ansible_net_hostname": "rtr4",
"ansible_net_image": "flash:CloudEOS.swi",
"ansible_net_model": "vEOS",
"ansible_net_python_version": "3.9.18",
"ansible_net_serialnum": "3CED9CADA42F88005AD83D625B1FBCFC",
"ansible_net_system": "eos",
"ansible_net_version": "4.27.3F-cloud",
"ansible_network_os": "eos",
"ansible_network_resources": {
"acl_interfaces": [
{
"name": "Ethernet1"
},
{
"name": "Ethernet100"
},
{
"name": "Loopback0"
},
{
"name": "Tunnel0"
}
],
"hostname": {
"hostname": "rtr4"
},
"interfaces": [
{
"enabled": true,
"mode": "layer3",
"name": "Ethernet1"
},
{
"enabled": true,
"mode": "layer3",
"name": "Ethernet100"
},
{
"enabled": true,
"name": "Loopback0"
},
{
"enabled": true,
"mtu": 1394,
"name": "Tunnel0"
}
],
"l2_interfaces": [
{
"name": "Ethernet1"
},
{
"name": "Ethernet100"
},
{
"name": "Loopback0"
},
{
"name": "Tunnel0"
}
],
"l3_interfaces": [
{
"ipv4": [
{
"address": "dhcp"
}
],
"name": "Ethernet1"
},
{
"name": "Ethernet100"
},
{
"ipv4": [
{
"address": "192.168.4.4/32"
}
],
"name": "Loopback0"
},
{
"ipv4": [
{
"address": "10.101.101.4/24"
}
],
"name": "Tunnel0"
}
],
"lacp": {},
"lag_interfaces": [],
"lldp_global": {},
"logging_global": {},
"ntp_global": {},
"ospf_interfaces": [
{
"name": "Ethernet1"
},
{
"name": "Ethernet100"
},
{
"name": "Loopback0"
},
{
"address_family": [
{
"afi": "ipv4",
"area": {
"area_id": "0.0.0.0"
},
"network": "point-to-point"
}
],
"name": "Tunnel0"
}
],
"ospfv2": {
"processes": [
{
"max_lsa": {
"count": 12000
},
"process_id": 1,
"redistribute": [
{
"routes": "connected"
}
],
"router_id": "192.168.4.4"
}
]
},
"ospfv3": [],
"prefix_lists": [],
"snmp_server": {}
},
"ansible_playbook_python": "/usr/bin/python3.9",
"ansible_run_tags": [
"all"
],
"ansible_skip_tags": [],
"ansible_user": "ec2-user",
"ansible_verbosity": 0,
"ansible_version": {
"full": "2.15.9",
"major": 2,
"minor": 15,
"revision": 9,
"string": "2.15.9"
},
"find_the_routes": {
"ansible_facts": {
"ansible_net_api": "cliconf",
"ansible_net_config": "! Command: show running-config\n! device: rtr4 (vEOS, EOS-4.27.3F-cloud)\n!\n! boot system flash:CloudEOS.swi\n!\nno aaa root\nno username admin\n!\nusername ec2-user nopassword\nusername ec2-user ssh-key ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCXcjkuCrUWbQGXbFjdlBcTYgXuUzkfkS8oTEGNrkjcI5kluXXWK/julyZr+xFyLlMJhEZEdx5UhGGYBL/HNLtGtGnxoHuaZiHI/4k8dUEHZ8j/D13dD5lyLThXHx8UCInzJ+jYGB+l4rsDetA1i6jnNJ0542IXZeqCnf1l59OT3e0i+3qwp0c+oXRIH2nrM74yXBFVo0gU2URMHvND0dnkbVOWFXnhGsxXUwTid5NWvi2IJlExZ50PoGp8tVMb9O722FFscB9o/kqmJZwDu3UT09+zJt+AtBS2hJzs7AFU7ePmbkrNK6zYxgxN2CLycEByCV9XEC2HfxuptxsCTqSJ ddhgm-key\n!\nagent KernelFib environment KERNELFIB_PROGRAM_ALL_ECMP='true'\n!\nswitchport default mode routed\n!\ntransceiver qsfp default-mode 4x10G\n!\nservice routing protocols model ribd\n!\nhostname rtr4\nip name-server vrf default 172.18.0.2\n!\nspanning-tree mode mstp\n!\naaa authentication policy on-success log\naaa authentication policy on-failure log\n!\ninterface Ethernet1\n no switchport\n ip address dhcp\n dhcp client accept default-route\n!\ninterface Ethernet100\n no switchport\n!\ninterface Loopback0\n ip address 192.168.4.4/32\n!\ninterface Tunnel0\n mtu 1394\n ip address 10.101.101.4/24\n ip ospf network point-to-point\n ip ospf area 0.0.0.0\n tunnel mode gre\n tunnel source interface Ethernet1\n tunnel destination 172.18.144.69\n tunnel path-mtu-discovery\n tunnel ttl 10\n!\nip routing\n!\nrouter ospf 1\n router-id 192.168.4.4\n redistribute connected\n max-lsa 12000\n!\nend",
"ansible_net_fqdn": "rtr4",
"ansible_net_gather_network_resources": [
"lacp_interfaces",
"ntp_global",
"hostname",
"prefix_lists",
"lacp",
"acl_interfaces",
"l2_interfaces",
"ospf_interfaces",
"interfaces",
"logging_global",
"route_maps",
"ospfv3",
"snmp_server",
"lldp_global",
"static_routes",
"vlans",
"lldp_interfaces",
"lag_interfaces",
"acls",
"ospfv2",
"l3_interfaces"
],
"ansible_net_gather_subset": [
"default",
"config"
],
"ansible_net_hostname": "rtr4",
"ansible_net_image": "flash:CloudEOS.swi",
"ansible_net_model": "vEOS",
"ansible_net_python_version": "3.9.18",
"ansible_net_serialnum": "3CED9CADA42F88005AD83D625B1FBCFC",
"ansible_net_system": "eos",
"ansible_net_version": "4.27.3F-cloud",
"ansible_network_resources": {
"acl_interfaces": [
{
"name": "Ethernet1"
},
{
"name": "Ethernet100"
},
{
"name": "Loopback0"
},
{
"name": "Tunnel0"
}
],
"hostname": {
"hostname": "rtr4"
},
"interfaces": [
{
"enabled": true,
"mode": "layer3",
"name": "Ethernet1"
},
{
"enabled": true,
"mode": "layer3",
"name": "Ethernet100"
},
{
"enabled": true,
"name": "Loopback0"
},
{
"enabled": true,
"mtu": 1394,
"name": "Tunnel0"
}
],
"l2_interfaces": [
{
"name": "Ethernet1"
},
{
"name": "Ethernet100"
},
{
"name": "Loopback0"
},
{
"name": "Tunnel0"
}
],
"l3_interfaces": [
{
"ipv4": [
{
"address": "dhcp"
}
],
"name": "Ethernet1"
},
{
"name": "Ethernet100"
},
{
"ipv4": [
{
"address": "192.168.4.4/32"
}
],
"name": "Loopback0"
},
{
"ipv4": [
{
"address": "10.101.101.4/24"
}
],
"name": "Tunnel0"
}
],
"lacp": {},
"lag_interfaces": [],
"lldp_global": {},
"logging_global": {},
"ntp_global": {},
"ospf_interfaces": [
{
"name": "Ethernet1"
},
{
"name": "Ethernet100"
},
{
"name": "Loopback0"
},
{
"address_family": [
{
"afi": "ipv4",
"area": {
"area_id": "0.0.0.0"
},
"network": "point-to-point"
}
],
"name": "Tunnel0"
}
],
"ospfv2": {
"processes": [
{
"max_lsa": {
"count": 12000
},
"process_id": 1,
"redistribute": [
{
"routes": "connected"
}
],
"router_id": "192.168.4.4"
}
]
},
"ospfv3": [],
"prefix_lists": [],
"snmp_server": {}
}
},
"changed": false,
"failed": false
},
"group_names": [
"arista",
"dc2",
"network",
"routers"
],
"groups": {
"all": [
"rtr1",
"rtr3",
"rtr2",
"rtr4",
"ansible-1"
],
"arista": [
"rtr2",
"rtr4"
],
"cisco": [
"rtr1"
],
"control": [
"ansible-1"
],
"dc1": [
"rtr1",
"rtr3"
],
"dc2": [
"rtr2",
"rtr4"
],
"juniper": [
"rtr3"
],
"network": [
"rtr1",
"rtr2",
"rtr4",
"rtr3"
],
"routers": [
"rtr1",
"rtr2",
"rtr4",
"rtr3"
],
"ungrouped": []
},
"inventory_dir": "/home/student/lab_inventory",
"inventory_file": "/home/student/lab_inventory/hosts",
"inventory_hostname": "rtr4",
"inventory_hostname_short": "rtr4",
"omit": "__omit_place_holder__2037ab60dfa586262bf5c7e5d7db2ac9105ac9e3",
"playbook_dir": "/home/student",
"private_ip": "172.18.122.96",
"restore_credential": "Workshop Credential",
"restore_inventory": "Workshop Inventory",
"restore_project": "Workshop Project"
}
}
Also seems off.... with the eos_static_routes
---
- hosts: arista
gather_facts: false
tasks:
- name: gather static routes
arista.eos.eos_static_routes:
state: gathered
register: static_routes
- name: gather static routes
ansible.builtin.debug:
msg: "{{ static_routes }}"
I am not even convinced the static routes are working at all now... I added a static route
[student@ansible-1 ~]$ ssh rtr2
Last login: Thu Feb 22 19:24:00 2024 from 3.133.158.195
Please register for a CVaaS account at https://www.arista.io/cv!
rtr2>en
rtr2#sh run | i route
switchport default mode routed
dhcp client accept default-route
ip route 3.3.3.3/32 192.168.1.3
router bgp 65001
router-id 192.168.2.2
router ospf 1
router-id 192.168.2.2
then I still get nothing...
here is the entire output from the facts module...
"ansible_network_resources": {
"acl_interfaces": [
{
"name": "Ethernet1"
},
{
"name": "Ethernet100"
},
{
"name": "Loopback0"
},
{
"name": "Tunnel0"
}
],
"hostname": {
"hostname": "rtr4"
},
"interfaces": [
{
"enabled": true,
"mode": "layer3",
"name": "Ethernet1"
},
{
"enabled": true,
"mode": "layer3",
"name": "Ethernet100"
},
{
"enabled": true,
"name": "Loopback0"
},
{
"enabled": true,
"mtu": 1394,
"name": "Tunnel0"
}
],
"l2_interfaces": [
{
"name": "Ethernet1"
},
{
"name": "Ethernet100"
},
{
"name": "Loopback0"
},
{
"name": "Tunnel0"
}
],
"l3_interfaces": [
{
"ipv4": [
{
"address": "dhcp"
}
],
"name": "Ethernet1"
},
{
"name": "Ethernet100"
},
{
"ipv4": [
{
"address": "192.168.4.4/32"
}
],
"name": "Loopback0"
},
{
"ipv4": [
{
"address": "10.101.101.4/24"
}
],
"name": "Tunnel0"
}
],
"lacp": {},
"lag_interfaces": [],
"lldp_global": {},
"logging_global": {},
"ntp_global": {},
"ospf_interfaces": [
{
"name": "Ethernet1"
},
{
"name": "Ethernet100"
},
{
"name": "Loopback0"
},
{
"address_family": [
{
"afi": "ipv4",
"area": {
"area_id": "0.0.0.0"
},
"network": "point-to-point"
}
],
"name": "Tunnel0"
}
],
"ospfv2": {
"processes": [
{
"max_lsa": {
"count": 12000
},
"process_id": 1,
"redistribute": [
{
"routes": "connected"
}
],
"router_id": "192.168.4.4"
}
]
},
"ospfv3": [],
"prefix_lists": [],
"snmp_server": {}
}
},
"changed": false,
"failed": false
},
I don't see static routes at all for it....