Skip to content

Netconf + Juniper routing engine switch #348

@ric79

Description

@ric79

Summary

Hello,
I'm executing on Juniper "request chassis routing-engine master switch no-confirm" which kills the ssh/netconf connection (it's like a reboot)

After that command all the Juniper tasks raise "Not connected to NETCONF server".
I think it is related to netconf not re-connecting after reboot

Issue Type

Bug Report

Component Name

ansible_connection

Ansible Version

ansible --version
ansible [core 2.11.6]
  config file = None
  configured module search path = ['/home/xxx/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/xxx/python_envs/yyy-env/lib/python3.9/site-packages/ansible
  ansible collection location = /home/xxx/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/xxx/python_envs/yyy-env/bin/ansible
  python version = 3.9.8 (main, Nov 11 2021, 10:03:58) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]
  jinja version = 3.0.3

$ ansible-galaxy collection list | grep jun
junipernetworks.junos         2.6.0
ansible.cfg
[persistent_connection]
connect_timeout = 1800
command_timeout = 1800

Configuration

$ ansible-config dump --only-changed
COLLECTIONS_PATHS(/home/xxx/yyy-prj/yyy/ansible.cfg) = ['/home/xxx/python_envs/${BASE_ANSIBLE_ENV}-ans
DEFAULT_LOG_PATH(/home/xxx/yyy-prj/yyy/ansible.cfg) = /home/xxx/yyy-prj/yyy/logs/l
DEFAULT_ROLES_PATH(/home/xxx/yyy-prj/yyy/ansible.cfg) = ['/home/xxx/python_envs/${BASE_ANSIBLE_ENV}-an
HOST_KEY_CHECKING(/home/xxx/yyy-prj/yyy/ansible.cfg) = False

OS / Environment

$ more /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)

Steps to Reproduce

Here there is my playbook

- name: "Upgrade procedure"
  hosts: "{{ ansible_host }}"
  connection: juniper.device.pyez
  gather_facts: no
  vars:
    ansible_connection: ansible.netcommon.netconf
    ansible_network_os: junipernetworks.junos.junos    

  tasks:  

    - junipernetworks.junos.junos_command:
        commands: request chassis routing-engine master switch check

    # ansible.module_utils.connection.ConnectionError: Unexpected session close
    - junipernetworks.junos.junos_command:
        commands: request chassis routing-engine master switch no-confirm
      ignore_errors: true
  
    - name: "Checking SSH connectivity"
      wait_for:
        host: "{{ ansible_host }}"
        port: 22
        timeout: 900
        delay: 60
    
    - name: "Checking NETCONF connectivity"
      wait_for:
        host: "{{ ansible_host }}"
        port: 830
        timeout: 60

    - name: "Reset ssh/netconf connection"
      meta: reset_connection
      
    - name: "Wait for connection"
      wait_for_connection:  
      timeout: 60
        
    - junipernetworks.junos.junos_command:
        commands: request chassis routing-engine master switch check
      --> msg: Not connected to NETCONF server     

Expected Results

Restore Netconf connection

Actual Results

msg: Not connected to NETCONF server

Code of Conduct

  • I agree to follow the Ansible Code of Conduct

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions