dell / dellemc-openmanage-ansible-modules

Dell OpenManage Ansible Modules
GNU General Public License v3.0
336 stars 163 forks source link

dellemc_install_firmware use case #9

Closed vincentchong1 closed 4 years ago

vincentchong1 commented 6 years ago

I will like to know how to set up the firmware catalog and firmware directory properly, so that I can use the dellemc_install_firmware module to import firmware,

I received following error, "msg": "Error: 'NoneType' object has no attribute 'name'"

My environment,

$ ansible-playbook --version
ansible-playbook 2.5.0
  config file = /home/VChong1/.ansible.cfg
  configured module search path = [u'/usr/lib/python2.7/site-packages/ansible/modules/remote_management/redfish;/usr/lib/python2.7/site-packages/ansible/modules;/usr/lib/python2.7/site-packages/ansible/modules/network/a10;/usr/lib/python2.7/site-packages/ansible/modules/network/f5;/usr/lib/python2.7/site-packages/ansible;/home/vchong/projects/library;/usr/share/my_modules;/usr/lib/python2.7/site-packages/ansible/modules/extras/dellemc/server']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible-playbook
  python version = 2.7.14 (default, Oct 31 2017, 21:12:13) [GCC 6.4.0]

Executing the play below,

$ ansible-playbook -i hosts_dell dell_import_firmware.yml -u root -k -vvvv
ansible-playbook 2.5.0
  config file = /home/VChong1/.ansible.cfg
  configured module search path = [u'/usr/lib/python2.7/site-packages/ansible/modules/remote_management/redfish;/usr/lib/python2.7/site-packages/ansible/modules;/usr/lib/python2.7/site-packages/ansible/modules/network/a10;/usr/lib/python2.7/site-packages/ansible/modules/network/f5;/usr/lib/python2.7/site-packages/ansible;/home/vchong/projects/library;/usr/share/my_modules;/usr/lib/python2.7/site-packages/ansible/modules/extras/dellemc/server']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible-playbook
  python version = 2.7.14 (default, Oct 31 2017, 21:12:13) [GCC 6.4.0]
Using /home/VChong1/.ansible.cfg as config file
SSH password:
setting up inventory plugins
Parsed /home/VChong1/Ansible/DELL/hosts_dell inventory source with ini plugin
Loading callback plugin skippy of type stdout, v2.0 from /usr/lib/python2.7/site-packages/ansible/plugins/callback/skippy.pyc

PLAYBOOK: dell_import_firmware.yml *********************************************************************************************************************************************************************************************
1 plays in dell_import_firmware.yml

PLAY [dell] ********************************************************************************************************************************************************************************************************************

TASK [Gathering Facts] *********************************************************************************************************************************************************************************************************
task path: /home/VChong1/Ansible/DELL/dell_import_firmware.yml:9
Using module file /usr/lib/python2.7/site-packages/ansible/modules/system/setup.py
<10.145.141.116> ESTABLISH LOCAL CONNECTION FOR USER: VChong1
<10.145.141.116> EXEC /bin/sh -c 'echo ~ && sleep 0'
<10.145.141.116> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/VChong1/.ansible/tmp/ansible-tmp-1537808617.72-139810963631391 `" && echo ansible-tmp-1537808617.72-139810963631391="` echo /home/VChong1/.ansible/tmp/ansible-tmp-1537808617.72-139810963631391 `" ) && sleep 0'
<10.145.141.116> PUT /home/VChong1/.ansible/tmp/ansible-local-164d57Kdm/tmpE_Jj8k TO /home/VChong1/.ansible/tmp/ansible-tmp-1537808617.72-139810963631391/setup.py
<10.145.141.116> EXEC /bin/sh -c 'chmod u+x /home/VChong1/.ansible/tmp/ansible-tmp-1537808617.72-139810963631391/ /home/VChong1/.ansible/tmp/ansible-tmp-1537808617.72-139810963631391/setup.py && sleep 0'
<10.145.141.116> EXEC /bin/sh -c '/usr/bin/python /home/VChong1/.ansible/tmp/ansible-tmp-1537808617.72-139810963631391/setup.py && sleep 0'
<10.145.141.116> EXEC /bin/sh -c 'rm -f -r /home/VChong1/.ansible/tmp/ansible-tmp-1537808617.72-139810963631391/ > /dev/null 2>&1 && sleep 0'
ok: [o2cblv13]
META: ran handlers

TASK [dell_import_firmware : Get Installed Firmware Inventory] *****************************************************************************************************************************************************************
task path: /home/VChong1/Ansible/DELL/roles/dell_import_firmware/tasks/main.yml:9
Using module file /usr/lib/python2.7/site-packages/ansible/modules/extras/dellemc/server/dellemc_install_firmware.py
<10.145.141.116> ESTABLISH LOCAL CONNECTION FOR USER: VChong1
<10.145.141.116> EXEC /bin/sh -c 'echo ~ && sleep 0'
<10.145.141.116> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/VChong1/.ansible/tmp/ansible-tmp-1537808622.25-318046750616 `" && echo ansible-tmp-1537808622.25-318046750616="` echo /home/VChong1/.ansible/tmp/ansible-tmp-1537808622.25-318046750616 `" ) && sleep 0'
<10.145.141.116> PUT /home/VChong1/.ansible/tmp/ansible-local-164d57Kdm/tmpLUrO8H TO /home/VChong1/.ansible/tmp/ansible-tmp-1537808622.25-318046750616/dellemc_install_firmware.py
<10.145.141.116> EXEC /bin/sh -c 'chmod u+x /home/VChong1/.ansible/tmp/ansible-tmp-1537808622.25-318046750616/ /home/VChong1/.ansible/tmp/ansible-tmp-1537808622.25-318046750616/dellemc_install_firmware.py && sleep 0'
<10.145.141.116> EXEC /bin/sh -c '/usr/bin/python /home/VChong1/.ansible/tmp/ansible-tmp-1537808622.25-318046750616/dellemc_install_firmware.py && sleep 0'
<10.145.141.116> EXEC /bin/sh -c 'rm -f -r /home/VChong1/.ansible/tmp/ansible-tmp-1537808622.25-318046750616/ > /dev/null 2>&1 && sleep 0'
fatal: [o2cblv13]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "idrac": null,
            "idrac_ip": "10.145.141.116",
            "idrac_port": 443,
            "idrac_pwd": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "idrac_user": "root",
            "job_wait": true,
            "reboot": false,
            "share_mnt": "files********",
            "share_name": "files********TMUS_Magenta_2018Q3_v5_1.00_Catalog.xml",
            "share_pwd": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "share_user": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER"
        }
    },
    "msg": "Error: 'NoneType' object has no attribute 'name'"
}
        to retry, use: --limit @/home/VChong1/Ansible/DELL/dell_import_firmware.retry

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

My roles, playbook and firmware catalog information,

VChong1@wabelhlp0691565 ~/Ansible/DELL
$ pwd
/home/VChong1/Ansible/DELL

VChong1@wabelhlp0691565 ~/Ansible/DELL
$ cat dell_import_firmware.yml
---
# author: Vincent Chong
# email: vincent.chong@t-mobile.com
# version 1.0
# Usage: get dell server firmeware
# ansible-playbook -i hosts dell_get_firmware.yml
#
#
- hosts: dell
  roles:
    - dell_import_firmware
...
VChong1@wabelhlp0691565 ~/Ansible/DELL
$ cat roles/dell_import_firmware/tasks/main.yml
---
# author: Vincent Chong
# email: vincent.chong@t-mobile.com
# version 1.0
# Usage: import dell server firmware
# ansible-playbook -i hosts dell_import_firmware.yml
#
#
- name: Get Installed Firmware Inventory
  dellemc_install_firmware:
    idrac_ip: "{{ ansible_host }}"
    idrac_user: "{{ idrac_user }}"
    idrac_pwd: "{{ idrac_pwd }}"
    share_name: "files/TMUS_Magenta_2018Q3_v5_1.00_Catalog.xml"
    share_user: "/"
    share_pwd:  "/"
    share_mnt: "files/"

#    Dell Repository Manager Information
#    share_name:      "10.94.222.51"
#    share_user:      "adm_vchong1"
#    share_pwd:       "{{ share_pwd }}"
#    share_mnt: "/firmware"

    reboot: False
    job_wait: True
...
VChong1@wabelhlp0691565 ~/Ansible/DELL
$ tree roles/dell_import_firmware/.
roles/dell_import_firmware/.
├── defaults
│   └── main.yml
├── files
│   ├── FOLDER03699392M
│   │   └── 1
│   │       └── SAS-Drive_Firmware_R52VG_WN64_NSF1_A00.EXE
<omitted>
│   └── TMUS_Magenta_2018Q3_v5_1.00_Catalog.xml
├── handlers
│   └── main.yml
├── meta
│   └── main.yml
├── README.md
├── tasks
│   └── main.yml
├── templates
├── tests
│   ├── inventory
│   └── test.yml
└── vars
    └── main.yml

248 directories, 129 files
felixs88 commented 6 years ago

Hi,

Please, check your share_name parameter, it should be NFS/CIFS without a file name.

       share_name: "xx.xx.xx.xx:/share"
       share_user: "xxxx"
       share_pwd:  "xxxxxxxx"
       share_mnt: "/mnt/share"
vincentchong1 commented 6 years ago

is pointing to NFS/CIFS the only way? Can it point to playbook 'files' folder, as indicated below?

VChong1@wabelhlp0691565 ~/Ansible/DELL
$ tree roles/dell_import_firmware/.
roles/dell_import_firmware/.
├── defaults
│   └── main.yml
├── files
│   ├── FOLDER03699392M
│   │   └── 1
│   │       └── SAS-Drive_Firmware_R52VG_WN64_NSF1_A00.EXE
<omitted>
│   └── TMUS_Magenta_2018Q3_v5_1.00_Catalog.xml
├── handlers
│   └── main.yml
├── meta
│   └── main.yml
├── README.md
├── tasks
│   └── main.yml
├── templates
├── tests
│   ├── inventory
│   └── test.yml
└── vars
    └── main.yml
anupamaloke commented 6 years ago

@vincentchong1 , the firmware update module use Server Configuration Profiles for updating the firmware from a repository stored on a network share (CIFS, NFS). Beginning with iDRAC9 firmware 3.00.00.00 and iDRAC7/8 firmware 2.50.50.50, SCP import files support a new attribute RepositoryUpdate which points to a PowerEdge firmware repository created by Dell Repository Manager. The repository file must be stored in the same directory or a sub-directory of the directory holding the SCP import file. RepositoryUpdate can specify a directory, in which case iDRAC will search there for the default repository named "Catalog.xml". Or RepositoryUpdate can explicitly specify the file name of the repository. RepositoryUpdateis supported via network shares only and is not supported by streamed local file SCP import. That's why you need to use the Network Share.

Please note that the firmware repository should be accessible from iDRAC.

vincentchong1 commented 6 years ago

@anupamaloke, since we will like to upload the firmware before the equipment is connected to our network that DRM is resided on, we need the flexibility of pointing the catalog to any file repository/directory. Can this feature be incorporated, so that the catalog can be resided within the ansible playbook files folder?

howels commented 5 years ago

@anupamaloke Can we use HTTP/S for the RepositoryUpdate share path? The iDRAC web UI shows that option but it doesn't appear to exist in this module. Thanks!

anupamaloke commented 5 years ago

@howels, you can use HTTP/HTTPS based firmware repository for update. However, that code is not in the master branch yet and is available in https://github.com/dell/Dell-EMC-Ansible-Modules-for-iDRAC/tree/fw_update_url branch. You also need to build and install the omsdk from https://github.com/dell/omsdk/tree/fw_update_url branch.

NOTE: Make sure that you use a python virtualenv to test the following changes as these are developer versions only.

anshulawasthi commented 5 years ago

@anupamaloke Can we have an Ansible module for getting the joblist from iDRAC job queue. I see omsdk supporting list_idrac_jobs here https://github.com/dell/omsdk/blob/master/omdrivers/lifecycle/iDRAC/iDRACJobs.py

anupamaloke commented 5 years ago

@anshulawasthi, at this point in time the 'list_idrac_jobs' just returns a list of Jobs URIs as similar to following output. If you just need to view the JOB status for a JOB ID, then you can use the dellemc_get_lc_job_status module.

Could you please tell me the exact use case that you are looking at?

{
    "@odata.context": "/redfish/v1/$metadata#DellJobCollection.DellJobCollection",
    "@odata.id": "/redfish/v1/Managers/iDRAC.Embedded.1/Jobs",
    "@odata.type": "#DellJobCollection.DellJobCollection",
    "Description": "Collection of Job Instances",
    "Id": "JobQueue",
    "Members": [
        {
            "@odata.id": "/redfish/v1/Managers/iDRAC.Embedded.1/Jobs/JID_351500880970"
        },
        {
            "@odata.id": "/redfish/v1/Managers/iDRAC.Embedded.1/Jobs/JID_351501698318"
        },
        {
            "@odata.id": "/redfish/v1/Managers/iDRAC.Embedded.1/Jobs/JID_351519935866"
        },
**<OUTPUT TRUNCATED FOR BREVITY>**
    ],
    "Members@odata.count": 52,
    "Name": "JobQueue"
}
rajeevarakkal commented 4 years ago

@anshulawasthi, Our latest module "idrac_firmware" supports now HTTPS repos as well. Am closing this defect as of now; Let us know in case you are facing any issues with the latest versions