Junos Automation (Scripting)
Junos Automation (Scripting)

How to do NSSU with Ansible via SSH/NetConf as session disconnects when REs flip

[ Edited ]
‎05-13-2019 11:32 AM


I have an issue using Ansible to do a NSSU on a QFX5100-VC.  The problem is that when NSSU installs the software onto the master then goes to switch the RE to the backup (which has already been upgraded via the play) the netconf session drops out. 


The upgrade contiunes but the ansible play with fail because it never gets a responce back that the final member was sucessful.


it seems that whenever a RE flip happens any SSH or Netconf session gets disconnected.  Anyone got a work around for this?  

THis is the play:


- name: Install Junos 
    install_timeout: 2000
    cleanfs: no
    local_package: "/opt/ansible/software/qfximage.tgz"
    remote_package: "/var/tmpqfximage.tgz"
    nssu: yes
    reboot: true
    validate: false
    logfile: /var/log/ansible/{{ inventory_hostname }}-logs.log
    user: "{{ username }}"
    passwd: "{{ password }}"
  register: sw

- name: Check Status
    var: sw



Junos Automation (Scripting)

Re: How to do NSSU with Ansible via SSH/NetConf as session disconnects when REs flip

‎06-12-2019 04:49 AM



Sorry for the late reply.  My approach whenever performing an upgrade is to not reboot the device as part of the juniper_junos_software task.  Instead I manage the reboot as its own task using juniper_junos_system.


Once the reboot has been triggered by the task it doesn't complain that a disconnection has taken place.  The subsequent tasks that I then trigger are a short delay (2mins), which I expect that afterwards the reboot process is in full swing and then I use wait_for so that I can resume subsequent tasks once connectivity to the device is restored.