Juniper / ansible-junos-stdlib

Junos modules for Ansible
Apache License 2.0
307 stars 158 forks source link

juniper_junos_software giving errors #342

Closed achhabr1 closed 5 years ago

achhabr1 commented 6 years ago

Hi I am trying to upgrade Junos using juniper_junos_software ansible module and getting following errors.

Would you be able to help?

TASK [Install Junos OS package] ** task path: /home/ac043s/software/ansible_development/ucpe_configuration_template/porter_software_upgrade.yml:29 Using module file /home/ac043s/.virtualenvs/ac043s_automation_env/lib/python2.7/site-packages/ansible/roles/Juniper.junos/library/juniper_junos_software.py fd:192:168:132::156:1 ESTABLISH LOCAL CONNECTION FOR USER: ac043s fd:192:168:132::156:1 EXEC /bin/sh -c 'echo ~ && sleep 0' fd:192:168:132::156:1 EXEC /bin/sh -c '( umask 77 && mkdir -p "echo /home/ac043s/.ansible/tmp/ansible-tmp-1521142635.74-53018444773131" && echo ansible-tmp-1521142635.74-53018444773131="echo /home/ac043s/.ansible/tmp/ansible-tmp-1521142635.74-53018444773131" ) && sleep 0' fd:192:168:132::156:1 PUT /tmp/tmpTVMbZZ TO /home/ac043s/.ansible/tmp/ansible-tmp-1521142635.74-53018444773131/juniper_junos_software.py fd:192:168:132::156:1 EXEC /bin/sh -c 'chmod u+x /home/ac043s/.ansible/tmp/ansible-tmp-1521142635.74-53018444773131/ /home/ac043s/.ansible/tmp/ansible-tmp-1521142635.74-53018444773131/juniper_junos_software.py && sleep 0' fd:192:168:132::156:1 EXEC /bin/sh -c '/home/ac043s/.virtualenvs/ac043s_automation_env/bin/python /home/ac043s/.ansible/tmp/ansible-tmp-1521142635.74-53018444773131/juniper_junos_software.py; rm -rf "/home/ac043s/.ansible/tmp/ansible-tmp-1521142635.74-53018444773131/" > /dev/null 2>&1 && sleep 0' The full traceback is: Traceback (most recent call last): File "/tmp/ansible_drUN4l/ansible_module_juniper_junos_software.py", line 788, in main() File "/tmp/ansible_drUN4l/ansible_module_juniper_junos_software.py", line 700, in main junos_module.add_sw() File "/home/ac043s/.virtualenvs/ac043s_automation_env/lib/python2.7/site-packages/ansible/roles/Juniper.junos/module_utils/juniper_junos_common.py", line 1306, in add_sw self.sw = jnpr.junos.utils.sw.SW(self.dev) File "/home/ac043s/.virtualenvs/ac043s_automation_env/lib/python2.7/site-packages/jnpr/junos/utils/sw.py", line 92, in init 'localre' in dev.facts['current_re']) TypeError: argument of type 'NoneType' is not iterable fatal: [fd:192:168:132::156:1]: FAILED! => { "changed": false, "module_stderr": "Traceback (most recent call last):\n File "/tmp/ansible_drUN4l/ansible_module_juniper_junos_software.py", line 788, in \n main()\n File "/tmp/ansible_drUN4l/ansible_module_juniper_junos_software.py", line 700, in main\n junos_module.add_sw()\n File "/home/ac043s/.virtualenvs/ac043s_automation_env/lib/python2.7/site-packages/ansible/roles/Juniper.junos/module_utils/juniper_junos_common.py", line 1306, in add_sw\n self.sw = jnpr.junos.utils.sw.SW(self.dev)\n File "/home/ac043s/.virtualenvs/ac043s_automation_env/lib/python2.7/site-packages/jnpr/junos/utils/sw.py", line 92, in init\n 'localre' in dev.facts['current_re'])\nTypeError: argument of type 'NoneType' is not iterable\n", "module_stdout": "", "msg": "MODULE FAILURE", "rc": 0 } to retry, use: --limit @/home/ac043s/software/ansible_development/ucpe_configuration_template/porter_software_upgrade.retry

PLAY RECAP *** fd:192:168:132::156:1 : ok=1 changed=0 unreachable=0 failed=1

(ac043s_automation_env) [ac043s@SDNAUTOS02 ucpe_configuration_template]$

stacywsmith commented 6 years ago

What version of PyEZ do you have intalled?

Please provide the content of your porter_software_upgrade.yml playbook file.

Please provide the facts output for this device from the juniper_junos_facts module.

achhabr1 commented 6 years ago

junos-eznc (2.1.7)


achhabr1 commented 6 years ago

(ac043s_automation_env) [ac043s@SDNAUTOS02 ucpe_configuration_template]$ ansible-playbook -i hosts porter_software_version_test.yml -u juniper -k SSH password:

PLAY [Get Device Facts] **

TASK [Checking NETCONF connectivity] ***** ok: [fd:192:168:132::156:1]

TASK [Retrieve information from devices running Junos OS] **** ok: [fd:192:168:132::156:1]

TASK [version] *** ok: [fd:192:168:132::156:1] => { "msg": { "HOME": "/var/home/juniper", "RE0": null, "RE1": null, "RE_hw_mi": null, "current_re": null, "domain": null, "fqdn": null, "has_2RE": null, "hostname": "SDWAN-Flexware-E56-u412-jdm", "hostname_info": { "re0": "SDWAN-Flexware-E56-u412-jdm" }, "ifd_style": "CLASSIC", "junos_info": { "re0": { "object": { "build": 8, "major": [ 15, 1 ], "minor": [ 53, "D", 46 ], "type": "X" }, "text": "15.1X53-D46.8" } }, "master": null, "master_state": null, "model": "NFX250_ATT_S2_10_T", "model_info": { "re0": "NFX250_ATT_S2_10_T" }, "personality": "NFX", "re_info": null, "re_master": null, "re_name": null, "serialnumber": null, "srx_cluster": null, "srx_cluster_id": null, "srx_cluster_redundancy_group": null, "switch_style": "NONE", "vc_capable": false, "vc_fabric": null, "vc_master": null, "vc_mode": null, "version": "15.1X53-D46.8", "version_RE0": "15.1X53-D46.8", "version_RE1": null, "version_info": { "build": 8, "major": [ 15, 1 ], "minor": [ 53, "D", 46 ], "type": "X" }, "virtual": false } }

PLAY RECAP *** fd:192:168:132::156:1 : ok=3 changed=0 unreachable=0 failed=0

(ac043s_automation_env) [ac043s@SDNAUTOS02 ucpe_configuration_template]$

stacywsmith commented 6 years ago

@vnitinv The issue is here

Suggest changing this:

self._single_re_issu = bool('current_re' in dev.facts and
                            'localre' in dev.facts['current_re'])

to:

self._single_re_issu = bool('current_re' in dev.facts and
                            dev.facts['current_re'] is not None and
                            'localre' in dev.facts['current_re'])
achhabr1 commented 6 years ago
EXEC /bin/sh -c '/home/ac043s/.virtualenvs/ac043s_automation_env/bin/python /home/ac043s/.ansible/tmp/ansible-tmp-1521576330.87-204047292077343/juniper_junos_software.py; rm -rf "/home/ac043s/.ansible/tmp/ansible-tmp-1521576330.87-204047292077343/" > /dev/null 2>&1 && sleep 0' The full traceback is: File "/tmp/ansible_nWmZu3/ansible_module_juniper_junos_software.py", line 375, in from urllib.parse import urlparse fatal: [fd:192:168:132::156:1]: FAILED! => { "changed": true, "check_mode": false, "invocation": { "module_args": { "attempts": null, "baud": null, "checksum": null, "checksum_algorithm": "md5", "checksum_timeout": 300, "cleanfs_timeout": 300, "console": null, "force_host": false, "host": "fd:192:168:132::156:1", "issu": false, "logdir": null, "logfile": "/home/ac043s//software.log", "mode": null, "nssu": false, "passwd": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", "port": 830, "provider": null, "ssh_private_key_file": null, "timeout": 30, "user": "root", "validate": true, "vmhost": false } }, "msg": "Unable to install the software" } to retry, use: --limit @/home/ac043s/software/ansible_development/ucpe_configuration_template/porter_software_upgrade.retry PLAY RECAP *************************************************************************************************************************************************** fd:192:168:132::156:1 : ok=1 changed=0 unreachable=0 failed=1 (ac043s_automation_env) [ac043s@SDNAUTOS02 ucpe_configuration_template]$ python Getting this error. Looks like Python3 and Python2.7 problem. Trying changing from: from urllib.parse import urlparse to from urlparse import urlparse
achhabr1 commented 6 years ago

I was able to move script forward and saw the OS file getting transferred.

I still get unable to install software error. Attaching log session out put

2018-03-20 17:09:23,380 - jnpr.ansible_module.juniper_junos_software - INFO - [fd:192:168:132::156:1] jinstall-nfx-2-flex-15.1X53-D470.5.secure-domestic-signed.tgz: 121716736 / 1217105706 (10%) 2018-03-20 17:09:26,753 - jnpr.ansible_module.juniper_junos_software - INFO - [fd:192:168:132::156:1] jinstall-nfx-2-flex-15.1X53-D470.5.secure-domestic-signed.tgz: 243433472 / 1217105706 (20%) 2018-03-20 17:09:29,658 - jnpr.ansible_module.juniper_junos_software - INFO - [fd:192:168:132::156:1] jinstall-nfx-2-flex-15.1X53-D470.5.secure-domestic-signed.tgz: 365133824 / 1217105706 (30%) 2018-03-20 17:09:33,429 - jnpr.ansible_module.juniper_junos_software - INFO - [fd:192:168:132::156:1] jinstall-nfx-2-flex-15.1X53-D470.5.secure-domestic-signed.tgz: 486850560 / 1217105706 (40%) 2018-03-20 17:09:34,945 - paramiko.transport - DEBUG - Rekeying (hit 32648 packets, 536880352 bytes sent) 2018-03-20 17:09:34,979 - paramiko.transport - DEBUG - kex algos:[u'curve25519-sha256@libssh.org', u'ecdh-sha2-nistp256', u'ecdh-sha2-nistp384', u'ecdh-sha2-nistp521', u'diffie-hellman-group-exchange-sha256', u'diffie-hellman-group-exchange-sha1', u'diffie-hellman-group14-sha1', u'diffie-hellman-group1-sha1'] server key:[u'ssh-rsa', u'ssh-dss', u'ecdsa-sha2-nistp256'] client encrypt:[u'aes128-ctr', u'aes192-ctr', u'aes256-ctr', u'arcfour256', u'arcfour128', u'aes128-gcm@openssh.com', u'aes256-gcm@openssh.com', u'chacha20-poly1305@openssh.com', u'aes128-cbc', u'3des-cbc', u'blowfish-cbc', u'cast128-cbc', u'aes192-cbc', u'aes256-cbc', u'arcfour', u'rijndael-cbc@lysator.liu.se'] server encrypt:[u'aes128-ctr', u'aes192-ctr', u'aes256-ctr', u'arcfour256', u'arcfour128', u'aes128-gcm@openssh.com', u'aes256-gcm@openssh.com', u'chacha20-poly1305@openssh.com', u'aes128-cbc', u'3des-cbc', u'blowfish-cbc', u'cast128-cbc', u'aes192-cbc', u'aes256-cbc', u'arcfour', u'rijndael-cbc@lysator.liu.se'] client mac:[u'hmac-md5-etm@openssh.com', u'hmac-sha1-etm@openssh.com', u'umac-64-etm@openssh.com', u'umac-128-etm@openssh.com', u'hmac-sha2-256-etm@openssh.com', u'hmac-sha2-512-etm@openssh.com', u'hmac-ripemd160-etm@openssh.com', u'hmac-sha1-96-etm@openssh.com', u'hmac-md5-96-etm@openssh.com', u'hmac-md5', u'hmac-sha1', u'umac-64@openssh.com', u'umac-128@openssh.com', u'hmac-sha2-256', u'hmac-sha2-512', u'hmac-ripemd160', u'hmac-ripemd160@openssh.com', u'hmac-sha1-96', u'hmac-md5-96'] server mac:[u'hmac-md5-etm@openssh.com', u'hmac-sha1-etm@openssh.com', u'umac-64-etm@openssh.com', u'umac-128-etm@openssh.com', u'hmac-sha2-256-etm@openssh.com', u'hmac-sha2-512-etm@openssh.com', u'hmac-ripemd160-etm@openssh.com', u'hmac-sha1-96-etm@openssh.com', u'hmac-md5-96-etm@openssh.com', u'hmac-md5', u'hmac-sha1', u'umac-64@openssh.com', u'umac-128@openssh.com', u'hmac-sha2-256', u'hmac-sha2-512', u'hmac-ripemd160', u'hmac-ripemd160@openssh.com', u'hmac-sha1-96', u'hmac-md5-96'] client compress:[u'none', u'zlib@openssh.com'] server compress:[u'none', u'zlib@openssh.com'] client lang:[u''] server lang:[u''] kex follows?False 2018-03-20 17:09:34,979 - paramiko.transport - DEBUG - Kex agreed: ecdh-sha2-nistp256 2018-03-20 17:09:34,979 - paramiko.transport - DEBUG - HostKey agreed: ssh-rsa 2018-03-20 17:09:34,980 - paramiko.transport - DEBUG - Cipher agreed: aes128-ctr 2018-03-20 17:09:34,980 - paramiko.transport - DEBUG - MAC agreed: hmac-sha2-256 2018-03-20 17:09:34,980 - paramiko.transport - DEBUG - Compression agreed: none 2018-03-20 17:09:34,991 - paramiko.transport - DEBUG - Switch to new keys ... 2018-03-20 17:09:37,085 - jnpr.ansible_module.juniper_junos_software - INFO - [fd:192:168:132::156:1] jinstall-nfx-2-flex-15.1X53-D470.5.secure-domestic-signed.tgz: 608567296 / 1217105706 (50%) 2018-03-20 17:09:41,213 - jnpr.ansible_module.juniper_junos_software - INFO - [fd:192:168:132::156:1] jinstall-nfx-2-flex-15.1X53-D470.5.secure-domestic-signed.tgz: 730267648 / 1217105706 (60%) 2018-03-20 17:09:44,991 - jnpr.ansible_module.juniper_junos_software - INFO - [fd:192:168:132::156:1] jinstall-nfx-2-flex-15.1X53-D470.5.secure-domestic-signed.tgz: 851984384 / 1217105706 (70%) 2018-03-20 17:09:48,414 - jnpr.ansible_module.juniper_junos_software - INFO - [fd:192:168:132::156:1] jinstall-nfx-2-flex-15.1X53-D470.5.secure-domestic-signed.tgz: 973684736 / 1217105706 (80%) 2018-03-20 17:09:50,031 - paramiko.transport - DEBUG - Rekeying (hit 32641 packets, 536879168 bytes sent) 2018-03-20 17:09:50,037 - paramiko.transport - DEBUG - kex algos:[u'curve25519-sha256@libssh.org', u'ecdh-sha2-nistp256', u'ecdh-sha2-nistp384', u'ecdh-sha2-nistp521', u'diffie-hellman-group-exchange-sha256', u'diffie-hellman-group-exchange-sha1', u'diffie-hellman-group14-sha1', u'diffie-hellman-group1-sha1'] server key:[u'ssh-rsa', u'ssh-dss', u'ecdsa-sha2-nistp256'] client encrypt:[u'aes128-ctr', u'aes192-ctr', u'aes256-ctr', u'arcfour256', u'arcfour128', u'aes128-gcm@openssh.com', u'aes256-gcm@openssh.com', u'chacha20-poly1305@openssh.com', u'aes128-cbc', u'3des-cbc', u'blowfish-cbc', u'cast128-cbc', u'aes192-cbc', u'aes256-cbc', u'arcfour', u'rijndael-cbc@lysator.liu.se'] server encrypt:[u'aes128-ctr', u'aes192-ctr', u'aes256-ctr', u'arcfour256', u'arcfour128', u'aes128-gcm@openssh.com', u'aes256-gcm@openssh.com', u'chacha20-poly1305@openssh.com', u'aes128-cbc', u'3des-cbc', u'blowfish-cbc', u'cast128-cbc', u'aes192-cbc', u'aes256-cbc', u'arcfour', u'rijndael-cbc@lysator.liu.se'] client mac:[u'hmac-md5-etm@openssh.com', u'hmac-sha1-etm@openssh.com', u'umac-64-etm@openssh.com', u'umac-128-etm@openssh.com', u'hmac-sha2-256-etm@openssh.com', u'hmac-sha2-512-etm@openssh.com', u'hmac-ripemd160-etm@openssh.com', u'hmac-sha1-96-etm@openssh.com', u'hmac-md5-96-etm@openssh.com', u'hmac-md5', u'hmac-sha1', u'umac-64@openssh.com', u'umac-128@openssh.com', u'hmac-sha2-256', u'hmac-sha2-512', u'hmac-ripemd160', u'hmac-ripemd160@openssh.com', u'hmac-sha1-96', u'hmac-md5-96'] server mac:[u'hmac-md5-etm@openssh.com', u'hmac-sha1-etm@openssh.com', u'umac-64-etm@openssh.com', u'umac-128-etm@openssh.com', u'hmac-sha2-256-etm@openssh.com', u'hmac-sha2-512-etm@openssh.com', u'hmac-ripemd160-etm@openssh.com', u'hmac-sha1-96-etm@openssh.com', u'hmac-md5-96-etm@openssh.com', u'hmac-md5', u'hmac-sha1', u'umac-64@openssh.com', u'umac-128@openssh.com', u'hmac-sha2-256', u'hmac-sha2-512', u'hmac-ripemd160', u'hmac-ripemd160@openssh.com', u'hmac-sha1-96', u'hmac-md5-96'] client compress:[u'none', u'zlib@openssh.com'] server compress:[u'none', u'zlib@openssh.com'] client lang:[u''] server lang:[u''] kex follows?False 2018-03-20 17:09:50,037 - paramiko.transport - DEBUG - Kex agreed: ecdh-sha2-nistp256 2018-03-20 17:09:50,037 - paramiko.transport - DEBUG - HostKey agreed: ssh-rsa 2018-03-20 17:09:50,038 - paramiko.transport - DEBUG - Cipher agreed: aes128-ctr 2018-03-20 17:09:50,038 - paramiko.transport - DEBUG - MAC agreed: hmac-sha2-256 2018-03-20 17:09:50,038 - paramiko.transport - DEBUG - Compression agreed: none 2018-03-20 17:09:50,047 - paramiko.transport - DEBUG - Switch to new keys ... 2018-03-20 17:09:50,880 - jnpr.ansible_module.juniper_junos_software - INFO - [fd:192:168:132::156:1] jinstall-nfx-2-flex-15.1X53-D470.5.secure-domestic-signed.tgz: 1095401472 / 1217105706 (90%) 2018-03-20 17:09:53,687 - jnpr.ansible_module.juniper_junos_software - INFO - [fd:192:168:132::156:1] jinstall-nfx-2-flex-15.1X53-D470.5.secure-domestic-signed.tgz: 1217105706 / 1217105706 (100%) 2018-03-20 17:09:53,703 - paramiko.transport - DEBUG - [chan 0] EOF sent (0) 2018-03-20 17:09:53,711 - paramiko.transport - DEBUG - EOF in transport thread 2018-03-20 17:09:53,711 - jnpr.ansible_module.juniper_junos_software - INFO - [fd:192:168:132::156:1] after copy, computing checksum on remote package: /var/tmp/jinstall-nfx-2-flex-15.1X53-D470.5.secure-domestic-signed.tgz 2018-03-20 17:09:53,712 - ncclient.operations.rpc - INFO - Requesting 'ExecuteRpc' 2018-03-20 17:09:53,712 - ncclient.transport.session - DEBUG - queueing <?xml version="1.0" encoding="UTF-8"?>/var/tmp/jinstall-nfx-2-flex-15.1X53-D470.5.secure-domestic-signed.tgz</nc:rpc> 2018-03-20 17:09:53,712 - ncclient.operations.rpc - DEBUG - Sync request, will wait for timeout=300 2018-03-20 17:09:53,726 - ncclient.transport.ssh - DEBUG - Sending message 2018-03-20 17:09:53,726 - ncclient.transport.ssh - DEBUG - Sending: <?xml version="1.0" encoding="UTF-8"?>/var/tmp/jinstall-nfx-2-flex-15.1X53-D470.5.secure-domestic-signed.tgz</nc:rpc>]]>]]> 2018-03-20 17:09:53,735 - ncclient.transport.ssh - DEBUG - Selecting netconf:base:1.0 for encoding 2018-03-20 17:09:53,735 - ncclient.transport.ssh - DEBUG - parsing netconf v1.0 2018-03-20 17:09:58,803 - ncclient.transport.ssh - DEBUG - Selecting netconf:base:1.0 for encoding 2018-03-20 17:09:58,803 - ncclient.transport.ssh - DEBUG - parsing netconf v1.0 2018-03-20 17:09:58,804 - ncclient.transport.session - DEBUG - dispatching message to <ncclient.operations.rpc.RPCReplyListener object at 0x7fc2e909d410>:

xml

</nc:rpc-reply> 2018-03-20 17:09:58,804 - ncclient.operations.rpc - DEBUG - Delivering to <ncclient.operations.third_party.juniper.rpc.ExecuteRpc object at 0x7fc2e907eed0> 2018-03-20 17:09:58,804 - ncclient.transport.session - DEBUG - dispatching message to <ncclient.transport.session.NotificationHandler object at 0x7fc2ea737fd0>:

xml

</nc:rpc-reply> 2018-03-20 17:09:58,804 - ncclient.transport.session - DEBUG - dispatching message to <jnpr.junos.device.DeviceSessionListener object at 0x7fc2ea737f50>:

xml

</nc:rpc-reply> 2018-03-20 17:09:58,804 - ncclient.transport.ssh - DEBUG - Trying another round of parsing since there is still data 2018-03-20 17:09:58,804 - ncclient.transport.ssh - DEBUG - parsing netconf v1.0 2018-03-20 17:09:58,837 - jnpr.ansible_module.juniper_junos_software - INFO - [fd:192:168:132::156:1] checksum check failed. 2018-03-20 17:09:58,838 - ncclient.operations.rpc - INFO - Requesting 'CloseSession' 2018-03-20 17:09:58,838 - ncclient.transport.session - DEBUG - queueing <?xml version="1.0" encoding="UTF-8"?></nc:rpc> 2018-03-20 17:09:58,838 - ncclient.operations.rpc - DEBUG - Sync request, will wait for timeout=30 2018-03-20 17:09:58,905 - ncclient.transport.ssh - DEBUG - Sending message 2018-03-20 17:09:58,905 - ncclient.transport.ssh - DEBUG - Sending: <?xml version="1.0" encoding="UTF-8"?></nc:rpc>]]>]]> 2018-03-20 17:09:58,907 - ncclient.transport.ssh - DEBUG - Selecting netconf:base:1.0 for encoding 2018-03-20 17:09:58,907 - ncclient.transport.ssh - DEBUG - parsing netconf v1.0 2018-03-20 17:09:58,908 - ncclient.transport.session - DEBUG - dispatching message to <ncclient.operations.rpc.RPCReplyListener object at 0x7fc2e909d410>:

</nc:rpc-reply> 2018-03-20 17:09:58,908 - ncclient.operations.rpc - DEBUG - Delivering to <ncclient.operations.session.CloseSession object at 0x7fc2e909de50> 2018-03-20 17:09:58,908 - ncclient.transport.session - DEBUG - dispatching message to <ncclient.transport.session.NotificationHandler object at 0x7fc2ea737fd0>:

</nc:rpc-reply> 2018-03-20 17:09:58,908 - ncclient.transport.session - DEBUG - dispatching message to <jnpr.junos.device.DeviceSessionListener object at 0x7fc2ea737f50>:

</nc:rpc-reply> 2018-03-20 17:09:58,908 - ncclient.transport.ssh - DEBUG - Trying another round of parsing since there is still data 2018-03-20 17:09:58,909 - ncclient.transport.ssh - DEBUG - parsing netconf v1.0 2018-03-20 17:09:58,910 - ncclient.transport.ssh - DEBUG - [chan netconf-subsystem-0] EOF received (netconf-subsystem-0) 2018-03-20 17:09:58,910 - ncclient.transport.ssh - DEBUG - Selecting netconf:base:1.0 for encoding 2018-03-20 17:09:58,911 - ncclient.transport.ssh - DEBUG - parsing netconf v1.0 2018-03-20 17:09:58,911 - ncclient.transport.ssh - DEBUG - [chan netconf-subsystem-0] EOF sent (netconf-subsystem-0) 2018-03-20 17:09:58,912 - ncclient.transport.ssh - DEBUG - Broke out of main loop, error=SessionCloseError('Unexpected session close\nIN_BUFFER: \n<!-- session end at 2018-03-20 21:14:17 UTC -->\n',) 2018-03-20 17:09:58,913 - ncclient.transport.session - DEBUG - dispatching error to <ncclient.operations.rpc.RPCReplyListener object at 0x7fc2e909d410> 2018-03-20 17:09:58,913 - ncclient.transport.session - DEBUG - dispatching error to <ncclient.transport.session.NotificationHandler object at 0x7fc2ea737fd0> 2018-03-20 17:09:58,913 - ncclient.transport.session - DEBUG - dispatching error to <jnpr.junos.device.DeviceSessionListener object at 0x7fc2ea737f50> 2018-03-20 17:09:58,953 - jnpr.ansible_module.juniper_junos_software - DEBUG - [fd:192:168:132::156:1] Device closed. 2018-03-20 17:09:58,953 - jnpr.ansible_module.juniper_junos_software - DEBUG - [fd:192:168:132::156:1] Fail JSON: {'msg': 'Unable to install the software', 'failed': True, 'changed': True, 'check_mode': False} 2018-03-20 17:09:59,012 - ncclient.transport.ssh - DEBUG - EOF in transport thread

ghost commented 6 years ago

Hi, software copied but I'm getting similar error message

EXEC /bin/sh -c 'rm -f -r /home/username/.ansible/tmp/ansible-tmp-1529076500.15-91464863803852/ > /dev/null 2>&1 && sleep 0' The full traceback is: File "/tmp/ansible_ps20oc/ansible_module_juniper_junos_software.py", line 375, in from urllib.parse import urlparse

fatal: [HOSTNAME]: FAILED! => { "changed": true, "check_mode": false, "invocation": { "module_args": { "attempts": null, "baud": null, "checksum": null, "checksum_algorithm": "md5", "checksum_timeout": 300, "cleanfs_timeout": 300, "console": null, "force_host": false, "host": "HOSTNAME", "issu": false, "logdir": null, "logfile": null, "mode": null, "nssu": false, "passwd": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", "port": 830, "ssh_private_key_file": null, "timeout": 30, "user": "lb61183", "validate": false, "vmhost": false } }, "msg": "Unable to install the software" } to retry, use: --limit @/home/username/ansible-playbooks/junos-install-os.retry

PLAY RECAP ** HOSTNAME : ok=1 changed=0 unreachable=0 failed=1

ghost commented 6 years ago

The second problem - logfile is empty not able to check where the actual problem is

vars: credentials: host: "{{ inventory_hostname }}" username: "{{ tacacs_username }}" password: "{{ password }}" OS_version: 14.1X53-D47.3 OS_package: jinstall-ex-4300-14.1X53-D47.3-domestic-signed.tgz pkg_dir: /apps/software/junos log_dir: /var/log/ansible netconf_port: 830 wait_time: 3600

tasks:

jas2061461 commented 5 years ago

I have the same problem. No matter what i enter into logdir, it is always "null" when I debug.

rsmekala commented 5 years ago

@sergeysj @jas2061461 Can you share facts output for this device from the juniper_junos_facts module ??

imkwx commented 5 years ago

I'm encountering the same bug. I'll provide more details ASAP. (juniper_junos_facts output) platform: ex2300-48P and ex3400-48P Seems like it's a bug inherent of the version provided with the switches we received (version:18.1R3.3) I'll try to do an update using the "no-copy" statement to see if it changes anything

imkwx commented 5 years ago

So far, I'm not even able to upgrade by hand. Found this: https://kb.juniper.net/InfoCenter/index?page=content&id=KB31198&actp=METADATA I think this bug is not a library/ansible issue but more a bug inside junos (in my case). I'm trying to pass the following kwargs: no-copy unlink and force, and see if it changes anything.

I'll provide my findings ASAP

imkwx commented 5 years ago

Okay good news ! I was able to upgrade by hand AND through ansible. It was exactly what I thought the running version was bugged and was preventing me of upgrading. BUT ! Using the informations and commands provided in the KB I was able to launch the upgrade process by hand.

For ansible, I used this:

   - name: Install new junos
      juniper_junos_software:
        provider:
          host: "{{inventory_hostname}}"
          user: "{{switch_user}}"
          passwd: "{{switch_passwd}}"
          port: 22
        reboot: yes
        version: "18.2R3-S1"
        local_package: config/junos-arm-32-18.2R3-S1.7.tgz
        cleanfs: true
        kwargs: {"no-copy": true,"force": true,"unlink": true}

Note the kwargs argument: it provides the 3 statements used in the command

request system software add /var/tmp/junos-arm-32-18.2R3-S1.7.tgz no-copy force unlink

I hope this helps !

rsmekala commented 5 years ago

@imkwx Thanks for the great info 👍 . It does help a lot.

Will mark this issue as closed. Please do reopen, if needed.