juniper_junos_software installs software but task fails due to "No handlers.."

450 views Asked by At

Im trying to install 12.3X48-D70 on an SRX550 using the juniper_junos_software module, and while it successfully installs and reboots the device the task returns as failed because of a "No handlers" errors.

Playbook:

- name: Upgrade Juniper devices
  juniper_junos_software:
    host: "{{ inventory_hostname }}"
    local_package: "junos-srxsme-12.3X48-D70.3-domestic.tgz"
    reboot: yes
    version: "12.3X48-D70.3"
    user: user
    passwd: "{{ secret }}"
    port: 22
  ignore_errors: True
  register: junos_upgrade
  when: junos_before|success

Verbose output:

TASK [code_upgrade : Upgrade Juniper devices] ***********************************************************
task path: /etc/ansible/new_test/.git/dev/code_upgrade/roles/code_upgrade/tasks/main2.yml:13
fatal: [lab-3]: FAILED! => {
    "changed": false,
    "module_stderr": "No handlers could be found for logger \"ncclient.transport.session\"\nTraceback (most recent call last):\n  File \"/tmp/ansible_0fR5rt/ansible_module_juniper_junos_software.py\", line 747, in <module>\n    main()\n  File \"/tmp/ansible_0fR5rt/ansible_module_juniper_junos_software.py\", line 743, in main\n    junos_module.exit_json(**results)\n  File \"/tmp/ansible_0fR5rt/ansible_modlib.zip/ansible/module_utils/juniper_junos_common.py\", line 792, in exit_json\n  File \"/tmp/ansible_0fR5rt/ansible_modlib.zip/ansible/module_utils/juniper_junos_common.py\", line 1327, in close\n  File \"/usr/lib/python2.7/site-packages/jnpr/junos/device.py\", line 1317, in close\n    self._conn.close_session()\n  File \"/usr/lib/python2.7/site-packages/ncclient/manager.py\", line 162, in wrapper\n    return self.execute(op_cls, *args, **kwds)\n  File \"/usr/lib/python2.7/site-packages/ncclient/manager.py\", line 232, in execute\n    raise_mode=self._raise_mode).request(*args, **kwds)\n  File \"/usr/lib/python2.7/site-packages/ncclient/operations/session.py\", line 28, in request\n    return self._request(new_ele(\"close-session\"))\n  File \"/usr/lib/python2.7/site-packages/ncclient/operations/rpc.py\", line 343, in _request\n    raise TimeoutExpiredError('ncclient timed out while waiting for an rpc reply.')\nncclient.operations.errors.TimeoutExpiredError: ncclient timed out while waiting for an rpc reply.\n",
    "module_stdout": "",
    "msg": "MODULE FAILURE",
    "rc": 1

The error shows up shortly after the device initiates a reboot and goes offline. I do not have this problem with any of the other juniper modules.

Im running Ansible 2.4.2, junos-eznc 2.1.8, python 2.7.5, and the Juniper.junos role is 2.1.0

1

There are 1 answers

0
Baptiste Mille-Mathias On

Someone already reported such problem to the developers of Junos, it seems you are hit by bugs https://github.com/Juniper/ansible-junos-stdlib/pull/361 and https://github.com/Juniper/py-junos-eznc/issues/651.

However the fix is present in the release 2.1.0 of ansible-junos-stdlib (the one you have) so it is not clear to me if this is the same bug or another closely related.

The best way to solve this is to contact the developers to report the issue on Github, to confirm this is the same bug or another and make it fixed.