ansible-junos-stdlib icon indicating copy to clipboard operation
ansible-junos-stdlib copied to clipboard

juniper_junos_software - command is not valid on the mx40-t

Open eregimbald opened this issue 6 years ago • 3 comments

Issue Type

  • Bug Report

Module Name

juniper_junos_software

Juniper.Junos role and Python libraries version

ansible 2.4.2.0
  config file = /ansible/network-ansible/ansible.cfg
  configured module search path = [u'/home/eregimbald/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.5 (default, Nov  6 2016, 00:28:07) [GCC 4.8.5 20150623 (Red Hat 4.8.5-11)]

ansible==2.4.2.0
appdirs==1.4.3
asn1crypto==0.24.0
Babel==0.9.6
backports.ssl-match-hostname==3.4.0.2
bcrypt==3.1.4
cffi==1.11.3
chainmap==1.0.2
chardet==2.2.1
colorama==0.3.9
configobj==4.7.2
configparser==3.5.0
cryptography==2.1.4
decorator==3.4.0
dnspython==1.15.0
ecdsa==0.13
enum34==1.1.6
ez-setup==0.9
future==0.16.0
httplib2==0.7.7
icdiff==1.9.1
idna==2.6
imageio==2.1.2
iniparse==0.4
ipaddress==1.0.19
Jinja2==2.8
jmespath==0.9.3
jsnapy==1.3.0
jtextfsm==0.3.1
junos-eznc==2.1.7
junos-netconify==1.0.2
jxmlease==1.0.1
kitchen==1.1.1
librouteros==1.0.2
lxml==4.1.1
MarkupSafe==1.0
moviepy==0.2.2.13
music21==3.1.0
mysql-connector-python-rf==2.2.2
napalm==1.2.0
napalm-base==0.23.2
napalm-eos==0.5.6
napalm-fortios==0.3.1
napalm-ios==0.6.1
napalm-iosxr==0.4.8
napalm-junos==0.6.6
napalm-nxos==0.5.1
napalm-panos==0.4.0
napalm-pluribus==0.5.1
napalm-ros==0.2.2
napalm-vyos==0.1.3
ncclient==0.5.3
netaddr==0.7.19
netmiko==1.3.0
numpy==1.12.1
olefile==0.44
packaging==16.8
pan-python==0.10.0
paramiko==2.4.0
perf==0.1
Pillow==4.0.0
pyasn1==0.4.2
pycparser==2.18
pycrypto==2.6.1
pycurl==7.19.0
pyeapi==0.8.0
pyfg==0.47
pygobject==3.14.0
pygpgme==0.3
pyIOSXR==0.41
pyliblzma==0.5.3
PyNaCl==1.2.1
pynxos==0.0.3
pyparsing==2.2.0
pyPluribus==0.3.1
pyserial==3.4
python-keyczar==0.71rc0
pyudev==0.15
pyxattr==0.5.1
PyYAML==3.12
requests==2.13.0
requests-toolbelt==0.7.1
scp==0.10.2
six==1.11.0
slip==0.4.0
slip.dbus==0.4.0
SSSDConfig==1.14.0
tqdm==4.11.2
unroll==0.1.0
urlgrabber==3.10
VyattaConfParser==0.4.4
xmltodict==0.10.2
yum-metadata-parser==1.1.4

OS / Environment

Freshly purchased MX40-T

Model: mx40-t Junos: 15.1R6.7

Summary

Attempting to run a firmware upgrade to 15.7R7.8 gives me the error: command is not valid on the mx40-t

Steps to reproduce

Using juniper_junos_software to send this package: jinstall-ppc-15.1R7.8-export-signed.tgz To an mx-40t

---
# group_vars
firmware:
  EX2200-48T-4G: jinstall-ex-2200-12.3R12.4-domestic-signed.tgz
  MX40-T: jinstall-ppc-15.1R7.8-export-signed.tgz
  SRX345: junos-srxsme-15.1X49-D130.6-domestic.tgz
  SRX1500: junos-srxentedge-15.1X49-D140.2-domestic.tgz
  QFX5100-48S-6Q: jinstall-host-qfx-5-15.1R6.7-domestic-signed.tgz


---
- name: Software Update
  connection: local
  gather_facts: no
  serial: 1
  roles:
    - Juniper.junos
  vars:
    playbook: Software Update
    commit: "True"
    comment: "Updating firmware for {{ target }}"

  vars_prompt:
    - name: "target"
      prompt: "Enter host or inventory group"
      private: no

  hosts: "{{target}}"

  tasks:
    - block:
      - include_role:
          name: Juniper.junos
      - include_role:
          name: base/workcomplete    # This sends the "comment" to Slack
      - name: Getting device facts      # Get the device model number
        juniper_junos_facts:
          host: '{{ inventory_hostname }}'
          user: '{{ user }}'
        register: results
        
      - debug: msg="{{results.ansible_facts.junos.model}}"
      
      - name: Installing software package
        juniper_junos_software:
          host: '{{ inventory_hostname }}'
          user: '{{ user }}'
          local_package: 'library/packages/{{firmware[results.ansible_facts.junos.model]}}'
          all_re: true
          cleanfs: false
          no_copy: false
          validate: false
          force_host: true
          reboot: true
  
    - rescue:
      - include_role:
          name: base/workfailed
          
# You need to have the image files stored in library/packages/

eregimbald avatar Jun 21 '18 20:06 eregimbald

[eregimbald@bos-ansible1 network-ansible]$ ansible-playbook software-update.yml -vvvv
ansible-playbook 2.4.2.0
  config file = /ansible/network-ansible/ansible.cfg
  configured module search path = [u'/home/eregimbald/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible-playbook
  python version = 2.7.5 (default, Nov  6 2016, 00:28:07) [GCC 4.8.5 20150623 (Red Hat 4.8.5-11)]
Using /ansible/network-ansible/ansible.cfg as config file
setting up inventory plugins
Parsed /ansible/network-ansible/fuze.hosts inventory source with ini plugin
Loading callback plugin default of type stdout, v2.0 from /usr/lib/python2.7/site-packages/ansible/plugins/callback/__init__.pyc
Loading callback plugin jsnapy of type aggregate, v2.0 from /usr/lib/python2.7/site-packages/ansible/plugins/callback/__init__.pyc

PLAYBOOK: software-update.yml **************************************************************************************
1 plays in software-update.yml
Enter host or inventory group: rtr-bdr-sin*

PLAY [Software Update] *********************************************************************************************
META: ran handlers

TASK [include_role] ************************************************************************************************
task path: /ansible/network-ansible/software-update.yml:22

TASK [include_role] ************************************************************************************************
task path: /ansible/network-ansible/software-update.yml:24

TASK [base/workcomplete : Sending a Slack notification] ************************************************************
task path: /ansible/network-ansible/roles/base/workcomplete/tasks/main.yml:4
Using module file /usr/lib/python2.7/site-packages/ansible/modules/notification/slack.py
<rtr-bdr-sin2> ESTABLISH LOCAL CONNECTION FOR USER: eregimbald
<rtr-bdr-sin2> EXEC /bin/sh -c 'echo ~ && sleep 0'
<rtr-bdr-sin2> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/eregimbald/.ansible/tmp/ansible-tmp-1529612384.33-95472209651165 `" && echo ansible-tmp-1529612384.33-95472209651165="` echo /home/eregimbald/.ansible/tmp/ansible-tmp-1529612384.33-95472209651165 `" ) && sleep 0'
<rtr-bdr-sin2> PUT /tmp/tmpJnN6NY TO /home/eregimbald/.ansible/tmp/ansible-tmp-1529612384.33-95472209651165/slack.py
<rtr-bdr-sin2> EXEC /bin/sh -c 'chmod u+x /home/eregimbald/.ansible/tmp/ansible-tmp-1529612384.33-95472209651165/ /home/eregimbald/.ansible/tmp/ansible-tmp-1529612384.33-95472209651165/slack.py && sleep 0'
<rtr-bdr-sin2> EXEC /bin/sh -c '/usr/bin/python /home/eregimbald/.ansible/tmp/ansible-tmp-1529612384.33-95472209651165/slack.py; rm -rf "/home/eregimbald/.ansible/tmp/ansible-tmp-1529612384.33-95472209651165/" > /dev/null 2>&1 && sleep 0'
ok: [rtr-bdr-sin2] => {
    "changed": false, 
    "invocation": {
        "module_args": {
            "attachments": null, 
            "channel": null, 
            "color": "normal", 
            "domain": null, 
            "icon_emoji": ":ansible:", 
            "icon_url": "https://www.ansible.com/favicon.ico", 
            "link_names": 1, 
            "msg": "Ansible playbook *Software Update* deployed by `eregimbald` \n *Comment:* Updating firmware for rtr-bdr-sin*", 
            "parse": null, 
            "token": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", 
            "username": "Ansibot", 
            "validate_certs": true
        }
    }, 
    "msg": "OK"
}

TASK [Getting device facts] ****************************************************************************************
task path: /ansible/network-ansible/software-update.yml:26
Using module file /etc/ansible/roles/Juniper.junos/library/juniper_junos_facts.py
<rtr-bdr-sin2> ESTABLISH LOCAL CONNECTION FOR USER: eregimbald
<rtr-bdr-sin2> EXEC /bin/sh -c 'echo ~ && sleep 0'
<rtr-bdr-sin2> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/eregimbald/.ansible/tmp/ansible-tmp-1529612385.89-148048480337352 `" && echo ansible-tmp-1529612385.89-148048480337352="` echo /home/eregimbald/.ansible/tmp/ansible-tmp-1529612385.89-148048480337352 `" ) && sleep 0'
<rtr-bdr-sin2> PUT /tmp/tmpHm_Dxf TO /home/eregimbald/.ansible/tmp/ansible-tmp-1529612385.89-148048480337352/juniper_junos_facts.py
<rtr-bdr-sin2> EXEC /bin/sh -c 'chmod u+x /home/eregimbald/.ansible/tmp/ansible-tmp-1529612385.89-148048480337352/ /home/eregimbald/.ansible/tmp/ansible-tmp-1529612385.89-148048480337352/juniper_junos_facts.py && sleep 0'
<rtr-bdr-sin2> EXEC /bin/sh -c '/usr/bin/python /home/eregimbald/.ansible/tmp/ansible-tmp-1529612385.89-148048480337352/juniper_junos_facts.py; rm -rf "/home/eregimbald/.ansible/tmp/ansible-tmp-1529612385.89-148048480337352/" > /dev/null 2>&1 && sleep 0'
ok: [rtr-bdr-sin2] => {
    "ansible_facts": {
        "junos": {
            "HOME": "/var/home/ansible", 
            "RE0": {
                "last_reboot_reason": "Router rebooted after a normal shutdown.", 
                "mastership_state": "master", 
                "model": "RE-MX40-T", 
                "status": "OK", 
                "up_time": "2 days, 1 hour, 20 minutes, 51 seconds"
            }, 
            "RE1": null, 
            "RE_hw_mi": false, 
            "current_re": [
                "re0", 
                "master", 
                "node", 
                "fwdd", 
                "member", 
                "pfem"
            ], 
            "domain": null, 
            "fqdn": "rtr-bdr-sin2", 
            "has_2RE": false, 
            "hostname": "rtr-bdr-sin2", 
            "hostname_info": {
                "re0": "rtr-bdr-sin2"
            }, 
            "ifd_style": "CLASSIC", 
            "junos_info": {
                "re0": {
                    "object": {
                        "build": 7, 
                        "major": [
                            15, 
                            1
                        ], 
                        "minor": "6", 
                        "type": "R"
                    }, 
                    "text": "15.1R6.7"
                }
            }, 
            "master": "RE0", 
            "master_state": true, 
            "model": "MX40-T", 
            "model_info": {
                "re0": "MX40-T"
            }, 
            "personality": "MX", 
            "re_info": {
                "default": {
                    "0": {
                        "last_reboot_reason": "Router rebooted after a normal shutdown.", 
                        "mastership_state": "master", 
                        "model": "RE-MX40-T", 
                        "status": "OK"
                    }, 
                    "default": {
                        "last_reboot_reason": "Router rebooted after a normal shutdown.", 
                        "mastership_state": "master", 
                        "model": "RE-MX40-T", 
                        "status": "OK"
                    }
                }
            }, 
            "re_master": {
                "default": "0"
            }, 
            "re_name": "re0", 
            "serialnumber": "BG947", 
            "srx_cluster": null, 
            "srx_cluster_id": null, 
            "srx_cluster_redundancy_group": null, 
            "switch_style": "BRIDGE_DOMAIN", 
            "vc_capable": false, 
            "vc_fabric": null, 
            "vc_master": null, 
            "vc_mode": null, 
            "version": "15.1R6.7", 
            "version_RE0": "15.1R6.7", 
            "version_RE1": null, 
            "version_info": {
                "build": 7, 
                "major": [
                    15, 
                    1
                ], 
                "minor": "6", 
                "type": "R"
            }, 
            "virtual": false
        }
    }, 
    "changed": false, 
    "facts": {
        "HOME": "/var/home/ansible", 
        "RE0": {
            "last_reboot_reason": "Router rebooted after a normal shutdown.", 
            "mastership_state": "master", 
            "model": "RE-MX40-T", 
            "status": "OK", 
            "up_time": "2 days, 1 hour, 20 minutes, 51 seconds"
        }, 
        "RE1": null, 
        "RE_hw_mi": false, 
        "current_re": [
            "re0", 
            "master", 
            "node", 
            "fwdd", 
            "member", 
            "pfem"
        ], 
        "domain": null, 
        "fqdn": "rtr-bdr-sin2", 
        "has_2RE": false, 
        "hostname": "rtr-bdr-sin2", 
        "hostname_info": {
            "re0": "rtr-bdr-sin2"
        }, 
        "ifd_style": "CLASSIC", 
        "junos_info": {
            "re0": {
                "object": {
                    "build": 7, 
                    "major": [
                        15, 
                        1
                    ], 
                    "minor": "6", 
                    "type": "R"
                }, 
                "text": "15.1R6.7"
            }
        }, 
        "master": "RE0", 
        "master_state": true, 
        "model": "MX40-T", 
        "model_info": {
            "re0": "MX40-T"
        }, 
        "personality": "MX", 
        "re_info": {
            "default": {
                "0": {
                    "last_reboot_reason": "Router rebooted after a normal shutdown.", 
                    "mastership_state": "master", 
                    "model": "RE-MX40-T", 
                    "status": "OK"
                }, 
                "default": {
                    "last_reboot_reason": "Router rebooted after a normal shutdown.", 
                    "mastership_state": "master", 
                    "model": "RE-MX40-T", 
                    "status": "OK"
                }
            }
        }, 
        "re_master": {
            "default": "0"
        }, 
        "re_name": "re0", 
        "serialnumber": "BG947", 
        "srx_cluster": null, 
        "srx_cluster_id": null, 
        "srx_cluster_redundancy_group": null, 
        "switch_style": "BRIDGE_DOMAIN", 
        "vc_capable": false, 
        "vc_fabric": null, 
        "vc_master": null, 
        "vc_mode": null, 
        "version": "15.1R6.7", 
        "version_RE0": "15.1R6.7", 
        "version_RE1": null, 
        "version_info": {
            "build": 7, 
            "major": [
                15, 
                1
            ], 
            "minor": "6", 
            "type": "R"
        }, 
        "virtual": false
    }, 
    "invocation": {
        "module_args": {
            "attempts": null, 
            "baud": null, 
            "config_format": null, 
            "console": null, 
            "host": "rtr-bdr-sin2", 
            "logdir": null, 
            "logfile": null, 
            "mode": null, 
            "passwd": null, 
            "port": 830, 
            "provider": null, 
            "savedir": null, 
            "ssh_private_key_file": null, 
            "timeout": 30, 
            "user": "ansible"
        }
    }
}

TASK [debug] *******************************************************************************************************
task path: /ansible/network-ansible/software-update.yml:32
ok: [rtr-bdr-sin2] => {
    "msg": "jinstall-ppc-15.1R7.8-export-signed.tgz"
}

TASK [Installing software package] *********************************************************************************
task path: /ansible/network-ansible/software-update.yml:34
Using module file /etc/ansible/roles/Juniper.junos/library/juniper_junos_software.py
<rtr-bdr-sin2> ESTABLISH LOCAL CONNECTION FOR USER: eregimbald
<rtr-bdr-sin2> EXEC /bin/sh -c 'echo ~ && sleep 0'
<rtr-bdr-sin2> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/eregimbald/.ansible/tmp/ansible-tmp-1529612392.18-25999831801916 `" && echo ansible-tmp-1529612392.18-25999831801916="` echo /home/eregimbald/.ansible/tmp/ansible-tmp-1529612392.18-25999831801916 `" ) && sleep 0'
<rtr-bdr-sin2> PUT /tmp/tmp9aZD41 TO /home/eregimbald/.ansible/tmp/ansible-tmp-1529612392.18-25999831801916/juniper_junos_software.py
<rtr-bdr-sin2> EXEC /bin/sh -c 'chmod u+x /home/eregimbald/.ansible/tmp/ansible-tmp-1529612392.18-25999831801916/ /home/eregimbald/.ansible/tmp/ansible-tmp-1529612392.18-25999831801916/juniper_junos_software.py && sleep 0'
<rtr-bdr-sin2> EXEC /bin/sh -c '/usr/bin/python /home/eregimbald/.ansible/tmp/ansible-tmp-1529612392.18-25999831801916/juniper_junos_software.py; rm -rf "/home/eregimbald/.ansible/tmp/ansible-tmp-1529612392.18-25999831801916/" > /dev/null 2>&1 && sleep 0'
fatal: [rtr-bdr-sin2]: FAILED! => {
    "changed": false, 
    "module_stderr": "", 
    "module_stdout": "[rtr-bdr-sin2] computing checksum on local package: /ansible/network-ansible/library/packages/jinstall-ppc-15.1R7.8-export-signed.tgz\n[rtr-bdr-sin2] before copy, computing checksum on remote package: /var/tmp/jinstall-ppc-15.1R7.8-export-signed.tgz\nConnected (version 2.0, client OpenSSH_6.9)\nAuthentication (publickey) successful!\n[rtr-bdr-sin2] jinstall-ppc-15.1R7.8-export-signed.tgz: 29114368 / 291139119 (10%)\n[rtr-bdr-sin2] jinstall-ppc-15.1R7.8-export-signed.tgz: 58228736 / 291139119 (20%)\n[rtr-bdr-sin2] jinstall-ppc-15.1R7.8-export-signed.tgz: 87343104 / 291139119 (30%)\n[rtr-bdr-sin2] jinstall-ppc-15.1R7.8-export-signed.tgz: 116457472 / 291139119 (40%)\n[rtr-bdr-sin2] jinstall-ppc-15.1R7.8-export-signed.tgz: 145571840 / 291139119 (50%)\n[rtr-bdr-sin2] jinstall-ppc-15.1R7.8-export-signed.tgz: 174686208 / 291139119 (60%)\n[rtr-bdr-sin2] jinstall-ppc-15.1R7.8-export-signed.tgz: 203800576 / 291139119 (70%)\n[rtr-bdr-sin2] jinstall-ppc-15.1R7.8-export-signed.tgz: 232914944 / 291139119 (80%)\n[rtr-bdr-sin2] jinstall-ppc-15.1R7.8-export-signed.tgz: 262029312 / 291139119 (90%)\n[rtr-bdr-sin2] jinstall-ppc-15.1R7.8-export-signed.tgz: 291139119 / 291139119 (100%)\n[rtr-bdr-sin2] after copy, computing checksum on remote package: /var/tmp/jinstall-ppc-15.1R7.8-export-signed.tgz\n[rtr-bdr-sin2] checksum check passed.\n[rtr-bdr-sin2] installing software ... please be patient ...\n\n{\"exception\": \"  File \\\"/tmp/ansible_TyVf6M/ansible_module_juniper_junos_software.py\\\", line 701, in main\\n    ok = junos_module.sw.install(**install_params)\\n  File \\\"/usr/lib/python2.7/site-packages/jnpr/junos/utils/sw.py\\\", line 891, in install\\n    **kwargs)\\n  File \\\"/usr/lib/python2.7/site-packages/jnpr/junos/utils/sw.py\\\", line 235, in pkgadd\\n    rsp = self.rpc.request_package_add(**args)\\n  File \\\"/usr/lib/python2.7/site-packages/jnpr/junos/rpcmeta.py\\\", line 345, in _exec_rpc\\n    return self._junos.execute(rpc, **dec_args)\\n  File \\\"/usr/lib/python2.7/site-packages/jnpr/junos/decorators.py\\\", line 76, in wrapper\\n    return function(*args, **kwargs)\\n  File \\\"/usr/lib/python2.7/site-packages/jnpr/junos/decorators.py\\\", line 23, in wrapper\\n    result = function(*args, **kwargs)\\n  File \\\"/usr/lib/python2.7/site-packages/jnpr/junos/device.py\\\", line 790, in execute\\n    errs=ex)\\n\", \"changed\": true, \"check_mode\": false, \"failed\": true, \"invocation\": {\"module_args\": {\"checksum_algorithm\": \"md5\", \"vmhost\": false, \"attempts\": null, \"checksum_timeout\": 300, \"force_host\": true, \"port\": 830, \"console\": null, \"logdir\": null, \"provider\": null, \"nssu\": false, \"baud\": null, \"passwd\": null, \"host\": \"rtr-bdr-sin2\", \"user\": \"ansible\", \"validate\": false, \"logfile\": null, \"checksum\": null, \"issu\": false, \"mode\": null, \"timeout\": 30, \"cleanfs_timeout\": 300, \"ssh_private_key_file\": null}}, \"msg\": \"Installation failed. Error: RpcError(severity: error, bad_element: None, message: command is not valid on the mx40-t)\"}\n", 
    "msg": "MODULE FAILURE", 
    "rc": 0
}

PLAY RECAP *********************************************************************************************************
rtr-bdr-sin2               : ok=3    changed=0    unreachable=0    failed=1   

eregimbald avatar Jun 21 '18 20:06 eregimbald

Getting the same error on an SRX1500

Error: RpcError(severity: error, bad_element: None, message: command is not valid on the srx1500)

eregimbald avatar Jun 22 '18 15:06 eregimbald

Hi,

This is a very old issue, marking it as inactive. In case the issue still is relevant, kindly share the netconf logs captured on device for the execution. Refer - https://www.juniper.net/documentation/us/en/software/junos/junos-xml-protocol/topics/example/netconf-traceoptions-configuring.html

rahkumar651991 avatar Sep 16 '21 18:09 rahkumar651991