ansible-collections / arista.eos

Ansible Network Collection for Arista EOS
GNU General Public License v3.0
81 stars 64 forks source link

"eos_vrf" doesn't check what is configured on the devices and always makes changes #546

Open ivanchakarov opened 1 week ago

ivanchakarov commented 1 week ago
SUMMARY

The "eos_vrf" doesn't work corectly. It does not check what is configured on the device and always makes changes.

ISSUE TYPE
COMPONENT NAME

arista.eos.eos_snmp_vrf

ANSIBLE VERSION
ansible [core 2.15.8]
  config file = /home/ichakarov/arista-switches/ansible.cfg
  configured module search path = ['/home/ichakarov/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  ansible collection location = /home/ichakarov/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] (/usr/bin/python3)
  jinja version = 3.0.3
  libyaml = True
COLLECTION VERSION
# /home/ichakarov/.ansible/collections/ansible_collections
Collection Version
---------- -------
arista.eos 9.0.0  
CONFIGURATION
CONFIG_FILE() = /home/ichakarov/arista-switches/ansible.cfg
OS / ENVIRONMENT

Arista vEOS-lab Software image version: 4.31.1F

STEPS TO REPRODUCE

Run a play which configures VRFs and assign interfaces to it. The play works as expected if this is new configuration. Unfortunately, if the configuration is already present on the device, it doesn't care and push the same changes. For example we already have the following configuration applied on a switch and we run the task:

interface Vlan10
   vrf blue_vrf
   ip address 10.1.1.1/30
!
interface Vlan20
   vrf red_vrf
   ip address 10.1.2.1/30
  arista.eos.eos_vrf: 
    aggregate:
      - name: blue_vrf
        interfaces:
          - Vlan10
      - name: red_vrf
        interfaces:
          - Vlan20
EXPECTED RESULTS

I expect that Ansible checks the running configuration of the switch, sees that the configuration is already there and does nothing.

ACTUAL RESULTS
changed: [lab-switch] => {
    "changed": true,
    "commands": [
        "interface vlan10",
        "vrf blue_vrf",
        "interface vlan20",
        "vrf red_vrf"
    ],
    "invocation": {
        "module_args": {
            "aggregate": [
                {
                    "associated_interfaces": null,
                    "delay": 10,
                    "interfaces": [
                        "vlan10"
                    ],
                    "name": "blue_vrf",
                    "rd": null,
                    "state": "present"
                },
                {
                    "associated_interfaces": null,
                    "delay": 10,
                    "interfaces": [
                        "vlan20"
                    ],
                    "name": "red_vrf",
                    "rd": null,
                    "state": "present"
                }
            ],
            "associated_interfaces": null,
            "delay": 10,
            "interfaces": null,
            "name": null,
            "purge": false,
            "rd": null,
            "state": "present"
        }
    },
    "session_name": "ansible_171888830004"
}