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

juniper_junos_software: NSSU doesn't log progress #432

Open
lucasalvatore opened this issue May 14, 2019 · 1 comment
Open

juniper_junos_software: NSSU doesn't log progress #432

lucasalvatore opened this issue May 14, 2019 · 1 comment

Comments

@lucasalvatore
Copy link

lucasalvatore commented May 14, 2019

Issue Type

  • Bug Report

Module Name

Juniper.Junos role and Python libraries version

$pip freeze
ansible==2.7.10
ansible-netbox-inventory==1.0.9
asn1crypto==0.24.0
bcrypt==3.1.6
certifi==2019.3.9
cffi==1.12.2
chardet==3.0.4
cryptography==2.6.1
enum34==1.1.6
idna==2.8
ipaddress==1.0.22
Jinja2==2.10.1
junos-eznc==2.2.0
jxmlease==1.0.1
lxml==4.3.3
MarkupSafe==1.1.1
ncclient==0.6.4
netaddr==0.7.19
paramiko==2.4.2
pkg-resources==0.0.0
pyasn1==0.4.5
pycparser==2.19
PyNaCl==1.3.0
pyserial==3.4
PyYAML==5.1
requests==2.21.0
scp==0.13.2
selectors2==2.0.1
six==1.12.0

$ansible --version
ansible 2.7.10
  config file = /opt/ansible/ansible.cfg
  configured module search path = [u'/home/luca/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /opt/ansible/ansible-venv/local/lib/python2.7/site-packages/ansible
  executable location = /opt/ansible/ansible-venv/bin/ansible
  python version = 2.7.12 (default, Nov 12 2018, 14:36:49) [GCC 5.4.0 20160609]

OS / Environment

QFX5100-VC / Junos 17.4

Summary

When kicking off a NSSU with ansible using verbose mode, none of the NSSU progress is logged

Steps to reproduce

Use NSSU on a virtual chassis setup

- name: Install Junos OS package QFX5K
  ignore_errors: yes
  juniper_junos_software:
    install_timeout: 2700
    version: "17.4R2-S2.3"
    cleanfs: no
    local_package: "/opt/ansible/software/jinstall-host-qfx-5-17.4R2-S2.3-signed.tgz"
    remote_package: "/var/tmp/jinstall-host-qfx-5-17.4R2-S2.3-signed.tgz"
    nssu: yes
    checksum:
    reboot: true
    validate: false
    force_host: yes
    logfile: /opt/ansible/logs/{{ inventory_hostname }}-logs.log
    user: "{{ username }}"
    passwd: "{{ password }}"
  register: sw

- name: Check Status
  debug:
    var: sw

Expected results

Would be nice to see some of the NSSU progress in the logs defined in logfile

Actual results

The logs show the initial software install command, but then nothing else during the whole process

2019-05-14 14:19:55,268 - jnpr.ansible_module.juniper_junos_software - INFO - [switch1.lab] NSSU: installing software ... please be patient ...
2019-05-14 14:19:55,268 - ncclient.operations.rpc - INFO - [host switch1.lab session-id 2552] Requesting 'ExecuteRpc'
2019-05-14 14:19:55,340 - ncclient.transport.ssh - INFO - [host switch1.lab session-id 2552] Sending:
<?xml version="1.0" encoding="UTF-8"?><nc:rpc xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:77cfa54c-0438-4856-9bdb-e2106052272b"><request-package-nonstop-upgrade><force-host/><package-name>/var/tmp/jinstall-host-qfx-5-17.4R2-S2.3-signed.tgz</package-name></request-package-nonstop-upgrade></nc:rpc>]]>]]>

2019-05-14 15:04:55,270 - ncclient.operations.rpc - INFO - [host switch1.lab session-id 2552] Requesting 'CloseSession'
2019-05-14 15:04:55,309 - ncclient.transport.ssh - INFO - [host switch1.lab session-id 2552] Sending:
<?xml version="1.0" encoding="UTF-8"?><nc:rpc xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:19ee17f8-6000-4cbd-8514-245da96c7edd"><nc:close-session/></nc:rpc>]]>]]>
2019-05-14 15:04:55,310 - ncclient.transport.ssh - ERROR - Socket exception: Connection reset by peer (104)

The ERROR there is because the netconf session dies after the master RE flip, I've reported that bug here #431

@rsmekala
Copy link
Contributor

rsmekala commented Jan 3, 2020

@lucasalvatore1, Streaming logs from a running task isn't supported in Ansible currently, there is a proposal for this at ansible/proposals#92. We will have to wait for this to get implemented to proceed further.

Alternatively, juniper_junos_software logs the progress to the logfile mentioned in the task and is updated in realtime, unlike ansible-playbook output. You could tail the log file to know the progress of the install process.

Sample task:

- name: Execute a basic Junos software upgrade with logging.
  juniper_junos_software:
    local_package: "./images/"
    logfile: install.log
    level: DEBUG

@rsmekala rsmekala removed their assignment Jan 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants