Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

diff_against parameter in eos_config module does not use "rollback clean-config" #501

Open
philippebureau opened this issue Nov 30, 2023 · 0 comments · May be fixed by #503
Open

diff_against parameter in eos_config module does not use "rollback clean-config" #501

philippebureau opened this issue Nov 30, 2023 · 0 comments · May be fixed by #503
Assignees
Labels
has_pr This issue has an associated PR.

Comments

@philippebureau
Copy link

philippebureau commented Nov 30, 2023

SUMMARY

When using parameter "diff_against = validate_config", the configuration session does not run "rollback clean-config"
This causes the returned "after" value to merge the running-config "before" and provided "intended_config"

The outcome of a diff between "before" and "after" returned value show added lines but not lines that would be removed by a config replace.

This is due to line 592 in "arista.eos/plugins/modules/eos_config.py"

replace = module.params["replace"] == "config"

I believe this should be set to line

ISSUE TYPE
  • Bug Report
COMPONENT NAME

module: eos_config
parameter: diff_against

ANSIBLE VERSION
ansible [core 2.14.6]
  config file = /home/phil/Documents/GitHub/AVD-CI-Demo/ansible.cfg
  configured module search path = ['/home/phil/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/phil/.local/lib/python3.10/site-packages/ansible
  ansible collection location = /home/phil/Documents/GitHub/ansible-cvp:/home/phil/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/phil/.local/bin/ansible
  python version = 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] (/usr/bin/python3)
  jinja version = 3.1.2
  libyaml = True
COLLECTION VERSION
Collection Version
---------- -------
arista.eos 6.2.2  
CONFIGURATION
Irrelevant
OS / ENVIRONMENT

Ubuntu 22.04

STEPS TO REPRODUCE
    - name: diff the running config against designated config
      arista.eos.eos_config:
        diff_against: validate_config
        intended_config: "{{ lookup('file', playbook_dir + '/../inventory/intended/configs/' + inventory_hostname + '.cfg') }}"
      register: config_diff

    - name: Show the difference
      ansible.utils.fact_diff:
        before: "{{ config_diff['diff']['before'] }}"
        after: "{{ config_diff['diff']['after'] }}"
EXPECTED RESULTS

see added and removed lines if a config replace would be executed

--- before
+++ after
@@ -1,18 +1,12 @@
-! Command: show running-config
+! Command: show session-configuration named ansible_170137009236
 ! device: dc1-leaf1 (vEOS-lab, EOS-4.30.2F)
 !
 ! boot system flash:/CloudEOS.swi
 !
 no aaa root
 !
-username ec2-user shell /bin/bash nopassword
-username ec2-user ssh-key ssh-rsa ssh-rsa <removed>
-username service shell /bin/bash secret sha512 <removed>
-!
-agent KernelFib environment KERNELFIB_PROGRAM_ALL_ECMP='true'
+username test_user privilege 15 role network-admin secret sha512 <removed>
 daemon TerminAttr
    exec /usr/bin/TerminAttr -cvaddr=192.168.0.5:9910 -cvauth=token,/tmp/token -smashexcludes=ale,flexCounter,hardware,kni,pulse,strata -ingestexclude=/Sysdb/cell/1/agent,/Sysdb/cell/2/agent -taillogs

image

ACTUAL RESULTS

only new lines are showed

--- before
+++ after
@@ -1,4 +1,4 @@
-! Command: show running-config
+! Command: show session-configuration named ansible_170137049678
 ! device: dc1-leaf1 (vEOS-lab, EOS-4.30.2F)
 !
 ! boot system flash:/CloudEOS.swi
@@ -11,6 +11,7 @@
 username ec2-user shell /bin/bash nopassword
 username ec2-user ssh-key ssh-rsa ssh-rsa <removed>
 username service shell /bin/bash secret sha512 <removed>
+username test_user privilege 15 role network-admin secret sha512 <removed>
 !
 agent KernelFib environment KERNELFIB_PROGRAM_ALL_ECMP='true'
 !

image

@roverflow roverflow added the has_pr This issue has an associated PR. label Dec 6, 2023
@rohitthakur2590 rohitthakur2590 self-assigned this Dec 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
has_pr This issue has an associated PR.
Projects
None yet
3 participants