Bug
Module Name
Juniper.Junos role and Python libraries version
ansible 2.7.0
Juniper.junos=2.1.0
OS / Environment
12.3R12S11, 12.3R12.4,15.1R5.5
Summary
module output error while performing an upgrade (but it works) :
fatal: [switch.prod]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n File "/root/.ansible/tmp/ansible-tmp-1546420485.07-272815982682903/AnsiballZ_juniper_junos_software.py", line 113, in \n ansiballz_main()\n File "/root/.ansible/tmp/ansible-tmp-1546420485.07-272815982682903/AnsiballZ_juniper_junos_software.py", line 105, in ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File "/root/.ansible/tmp/ansible-tmp-1546420485.07-272815982682903/AnsiballZ_juniper_junos_software.py", line 48, in invoke_module\n imp.load_module('main', mod, module, MOD_DESC)\n File "/tmp/ansible_juniper_junos_software_payload_3CX16n/main.py", line 747, in \n File "/tmp/ansible_juniper_junos_software_payload_3CX16n/main.py", line 743, in main\n File "/tmp/ansible_juniper_junos_software_payload_3CX16n/ansible_juniper_junos_software_payload.zip/ansible/module_utils/juniper_junos_common.py", line 792, in exit_json\n File "/tmp/ansible_juniper_junos_software_payload_3CX16n/ansible_juniper_junos_software_payload.zip/ansible/module_utils/juniper_junos_common.py", line 1327, in close\n File "/usr/local/lib/python2.7/dist-packages/junos_eznc-2.2.0-py2.7.egg/jnpr/junos/device.py", line 1328, in close\n self._conn.close_session()\n File "build/bdist.linux-i686/egg/ncclient/manager.py", line 216, in execute\n File "build/bdist.linux-i686/egg/ncclient/operations/session.py", line 28, in request\n File "build/bdist.linux-i686/egg/ncclient/operations/rpc.py", line 347, in _request\nncclient.operations.errors.TimeoutExpiredError: ncclient timed out while waiting for an rpc reply.\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
fatal: [switch.prod]: FAILED! => {"changed": false, "msg": "Unable to make a PyEZ connection: ConnectTimeoutError(switch.prod)"}
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ncclient.operations.errors.TimeoutExpiredError: ncclient timed out while waiting for an rpc reply.
Steps to reproduce
ansible-playbook ex2200-firmware-upgrade.yml -i hosts --ask-vault-pass -e "@myvault.yml"
fatal: [switch.prod]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n File "/root/.ansible/tmp/ansible-tmp-1546420485.07-272815982682903/AnsiballZ_juniper_junos_software.py", line 113, in \n ansiballz_main()\n File "/root/.ansible/tmp/ansible-tmp-1546420485.07-272815982682903/AnsiballZ_juniper_junos_software.py", line 105, in ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File "/root/.ansible/tmp/ansible-tmp-1546420485.07-272815982682903/AnsiballZ_juniper_junos_software.py", line 48, in invoke_module\n imp.load_module('main', mod, module, MOD_DESC)\n File "/tmp/ansible_juniper_junos_software_payload_3CX16n/main.py", line 747, in \n File "/tmp/ansible_juniper_junos_software_payload_3CX16n/main.py", line 743, in main\n File "/tmp/ansible_juniper_junos_software_payload_3CX16n/ansible_juniper_junos_software_payload.zip/ansible/module_utils/juniper_junos_common.py", line 792, in exit_json\n File "/tmp/ansible_juniper_junos_software_payload_3CX16n/ansible_juniper_junos_software_payload.zip/ansible/module_utils/juniper_junos_common.py", line 1327, in close\n File "/usr/local/lib/python2.7/dist-packages/junos_eznc-2.2.0-py2.7.egg/jnpr/junos/device.py", line 1328, in close\n self._conn.close_session()\n File "build/bdist.linux-i686/egg/ncclient/manager.py", line 216, in execute\n File "build/bdist.linux-i686/egg/ncclient/operations/session.py", line 28, in request\n File "build/bdist.linux-i686/egg/ncclient/operations/rpc.py", line 347, in _request\nncclient.operations.errors.TimeoutExpiredError: ncclient timed out while waiting for an rpc reply.\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
fatal: [switch.prod]: FAILED! => {"changed": false, "msg": "Unable to make a PyEZ connection: ConnectTimeoutError(switch.prod)"}
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ncclient.operations.errors.TimeoutExpiredError: ncclient timed out while waiting for an rpc reply.
---
- name: Install Junos OS
hosts: switch
roles:
- Juniper.junos
connection: local
gather_facts: no
vars:
OS_version: "12.3R12-S11"
OS_package: "jinstall-ex-2200-12.3R12-S11-domestic-signed.tgz"
pkg_dir: "software"
log_dir: "/Output/"
netconf_port: 830
wait_time: 3600
tasks:
- name: Checking NETCONF connectivity
wait_for:
host: "{{ inventory_hostname }}"
port: "{{ netconf_port }}"
timeout: 5
- name: Install Junos OS package
juniper_junos_software:
user: "{{ user }}"
passwd: "{{ pass }}"
version: "{{ OS_version }}"
local_package: "{{ pkg_dir }}/{{ OS_package }}"
reboot: true
validate: false
logfile: "{{ log_dir }}/{{ inventory_hostname }}-software.log"
nssu: false
register: sw
notify:
- wait_reboot
- name: Print response
debug:
var: sw
handlers:
- name: wait_reboot
wait_for:
host: "{{ inventory_hostname }}"
port: "{{ netconf_port }}"
timeout: "{{ wait_time }}"
when: not sw.check_mode
Expected results
Actual results
module output error while performing an upgrade (but it works) :
Do you mean the Junos package on the target device gets upgraded but module returns an error log ??
Hello, do you know how to resolve this issue?
@davbeny Is the device getting rebooted ??
Hello Rsmekala, yes it's getting rebooted.
@davbeny Can you download the role from the below repository and check if that resolves your error ??
Please use the following command:
ansible-galaxy install git+https://github.com/rsmekala/ansible-junos-stdlib.git,,Juniper.junos
@rsmekala Hello, unfortunatly I don't have time to rebuild another install for the moment. But what i can tell you is that i'm using the Juniper.junos role of the 01/06/2018 2.1.0
I'm also using a custom docker image.
@davbeny Can you make the below changes in Juniper.junos role and verify ??
Note: Please exclude changes to setup.py
https://github.com/Juniper/ansible-junos-stdlib/compare/master...rsmekala:master
@vnitinv Is this the same reboot issue you faced as well ?? Wanted to check.