ansible-collections / arista.eos

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

eos_config save_when action creates separate connection #356

Open paullavelle opened 2 years ago

paullavelle commented 2 years ago
SUMMARY

The eos_config module creates a separate connection when the save_when action is used.

For example:

eos_config:
    src: "update_user_password.config"    <-- Connection 1: Updates the user's password in the running-config
    save_when: always                     <-- Connection 2: Runs the 'copy running-config startup-confg' command

In the case of a password change the save_when: always action fails as the password is now invalid.

Can the save_when action be updated to (re)use a single connection?

ISSUE TYPE
COMPONENT NAME

eos_config

ANSIBLE VERSION
ansible [core 2.11.11] 
  config file = None
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.6/site-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.6.8 (default, Nov 16 2020, 16:55:22) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]
  jinja version = 3.0.3
  libyaml = True
COLLECTION VERSION
# /usr/local/lib/python3.6/site-packages/ansible_collections
Collection Version
---------- -------
arista.eos 2.2.0  
CONFIGURATION
OS / ENVIRONMENT

Arista EOS 4.25 / 4.26 / 4.27

STEPS TO REPRODUCE
  1. Create an eos_config task with save_when: always. For example:
eos_config:
    src: "update_user_password.config"    <-- Connection 1: Updates the user's password in the running-config
    save_when: always                     <-- Connection 2: Runs the 'copy running-config startup-confg' command
  1. Monitor CapiApp agent logs on the switch and see two connections:

show agent CapiApp logs

EXPECTED RESULTS
ACTUAL RESULTS
GomathiselviS commented 2 years ago

Hi @paullavelle Thanks for submitting the issue. But I am unable to reproduce the issue. I tried with the following playbook

 - name: eos_config
    arista.eos.eos_config:
      src: 'intended_config.txt'
      save_when: always

intended_config.txt

interface Ethernet1
  description test
  no shutdown
!
interface Ethernet2
  description test2
  no shut
!
username ansible secret admin1
!

Tried with 'eos 4.24' , 'ansible-devel, stable-2.11' , 'collection eos-5.0.0 and 2.2.0' The playbook works fine as expected. Can you please try the latest eos collection?