dell / dellemc-openmanage-ansible-modules

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

dellemc_idrac_firmware #41

Closed Nathan-UK closed 4 years ago

Nathan-UK commented 5 years ago

I've been developing process to deploy R740s and C6420 and have been using these modules from the fw_update_url branch.

On my Dev node (Centos 7.6 Ansible 2.7.8) all is fine. We've deployed new CENTOS7.6 hosts as part of our testing. Now the dellemc_idrac_firmware is always failing with he following message:

FAILED! => {"msg": "Could not find imported module support code for dellemc_idrac_firmware. Looked for either iDRACConnection.py or dellemc_idrac.py"}

or

TASK [deploy-dell : Update firmware from repository on a HTTP Share] ***** An exception occurred during task execution. To see the full traceback, use -vvv. The error was: NameError: global name 'iDRACLicense' is not defined

or other global name XXX is not defined.

I've followed the following steps to install post Ansible 2.7.8

git clone https://github.com/dell/omsdk.git cd omsdk/ git checkout fw_updateurl sh build.sh 1.2 345 cd dist sudo pip install omsdk-1.2.345-py2.py3-none-any.whl cd .. git clone https://github.com/dell/dellemc-openmanage-ansible-modules.git cd dellemc-openmanage-ansible-modules/ git checkout fw_update_url git branch sudo python install.py

Pip freeze output has been matched from working node

adal==1.2.0 ansible==2.7.8 ansible-lint==3.4.21 ansible-review==0.13.4 appdirs==1.4.0 applicationinsights==0.11.7 argcomplete==1.9.4 asn1crypto==0.24.0 azure-cli-core==2.0.35 azure-cli-nspkg==3.0.2 azure-common==1.1.11 azure-graphrbac==0.40.0 azure-keyvault==1.0.0a1 azure-mgmt-batch==4.1.0 azure-mgmt-compute==2.1.0 azure-mgmt-containerinstance==0.4.0 azure-mgmt-containerregistry==2.0.0 azure-mgmt-containerservice==3.0.1 azure-mgmt-dns==1.2.0 azure-mgmt-keyvault==0.40.0 azure-mgmt-marketplaceordering==0.1.0 azure-mgmt-monitor==0.5.2 azure-mgmt-network==1.7.1 azure-mgmt-nspkg==2.0.0 azure-mgmt-rdbms==1.2.0 azure-mgmt-resource==1.2.2 azure-mgmt-sql==0.7.1 azure-mgmt-storage==1.5.0 azure-mgmt-trafficmanager==0.50.0 azure-mgmt-web==0.32.0 azure-nspkg==2.0.0 azure-storage==0.35.1 Babel==0.9.6 backports.ssl-match-hostname==3.5.0.1 bcrypt==3.1.4 bigsuds==1.0.4 certifi==2018.10.15 cffi==1.11.5 chardet==3.0.4 colorama==0.4.0 configparser==3.5.0 cryptography==2.2.2 dnspython==1.16.0 entrypoints==0.2.3 enum34==1.1.6 f5-icontrol-rest==1.3.11 f5-sdk==3.0.17 flake8==2.0 future==0.17.1 httplib2==0.9.2 humanfriendly==4.17 idna==2.6 iniparse==0.4 ipaddress==1.0.22 isodate==0.6.0 Jinja2==2.10 jmespath==0.9.0 keyring==16.0.2 kitchen==1.1.1 knack==0.3.3 MarkupSafe==1.0 mccabe==0.6.1 monotonic==1.5 msrest==0.4.29 msrestazure==0.4.31 netaddr==0.7.19 ntlm-auth==1.2.0 oauthlib==2.1.0 omsdk===1.2.345- packaging==18.0 paramiko==2.4.1 passlib==1.7.1 pep8==1.4.6 ply==3.4 pyasn1==0.4.2 pycparser==2.18 pycryptodomex==3.7.0 pycurl==7.19.0 pyflakes==1.3.0 Pygments==2.2.0 pygobject==3.22.0 pygpgme==0.3 PyJWT==1.6.4 pyliblzma==0.5.3 PyNaCl==1.2.1 pyOpenSSL==18.0.0 pyparsing==2.3.0 pysmi==0.3.2 pysnmp==4.4.6 pysnmp-mibs==0.1.6 python-dateutil==2.7.5 python-version==0.0.2 pyvmomi==6.5.0.2017.5.post1 pywinrm==0.2.2 pyxattr==0.5.1 PyYAML==3.12 requests==2.20.1 requests-ntlm==1.1.0 requests-oauthlib==1.0.0 SecretStorage==2.3.1 six==1.11.0 suds==0.4 tabulate==0.8.2 unidiff==0.5.4 urlgrabber==3.10 urllib3==1.24.1 xmltodict==0.11.0 yum-metadata-parser==1.1.4

Nathan-UK commented 5 years ago

The full traceback is: Traceback (most recent call last): File "/home/XXX/.ansible/tmp/ansible-tmp-1553099447.13-174085394283652/AnsiballZ_dellemc_idrac_firmware.py", line 113, in _ansiballz_main() File "/home/XXX/.ansible/tmp/ansible-tmp-1553099447.13-174085394283652/AnsiballZ_dellemc_idrac_firmware.py", line 105, in _ansiballz_main invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS) File "/home/XXX/.ansible/tmp/ansible-tmp-1553099447.13-174085394283652/AnsiballZ_dellemc_idrac_firmware.py", line 48, in invoke_module imp.load_module('main', mod, module, MOD_DESC) File "/tmp/ansible_dellemc_idrac_firmware_payload_XfxA9d/main.py", line 467, in File "/tmp/ansible_dellemc_idrac_firmware_payload_XfxA9d/main.py", line 457, in main File "/tmp/ansible_dellemc_idrac_firmware_payload_XfxA9d/ansible_dellemc_idrac_firmware_payload.zip/ansible/module_utils/remote_management/dellemc/dellemc_idrac.py", line 49, in enter File "/usr/lib/python2.7/site-packages/omsdk/sdkinfra.py", line 144, in get_driver return self._create_driver(mod, ipaddr, creds, protopref, pOptions) File "/usr/lib/python2.7/site-packages/omsdk/sdkinfra.py", line 165, in _create_driver drv = self.disc_modules[mod].is_entitytype(self, ipaddr, creds, protopref, mod, pOptions) File "/usr/lib/python2.7/site-packages/omsdk/sdkbase.py", line 143, in is_entitytype entity = self.my_entitytype(pinfra, ipaddr, creds, protofactory) File "/usr/lib/python2.7/site-packages/omdrivers/iDRAC.py", line 3225, in my_entitytype return iDRACEntity(self.ref, protofactory, ipaddr, creds, self.srcdir, 'iDRAC') File "/usr/lib/python2.7/site-packages/omdrivers/iDRAC.py", line 3244, in init self.license_mgr = iDRACLicense(self) NameError: global name 'iDRACLicense' is not defined

failed: [XXX10DSL01 -> 127.0.0.1] (item=AAA01APP02) => { "changed": false, "item": { "Chassis_SN": #########, "DNS1": "x.x.x.x", "DNS2": "x.x.x.x", "GW": "x.x.x.x", "IP": "x.x.x.x", "iDRAC": "x.x.x.x", "idrac_pwd": ##########, "idrac_user": #########, "mgtvlan": 13, "name": "AAA01APP02", "network": "NIC", "platform": "Dell", "tower": "tower" }, "module_stderr": "See above", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1 }

anupamaloke commented 5 years ago

@Nathan-UK, on a first glance, this looks like a python path issue. Could you please try installing the ansible, omsdk, openmanage ansible modules in a python virtualenv and see if it is working? Make sure to set the ansible python interpreter to use the python from the virtualenv.

# Install virtualenv
sudo pip install virtualenv
virtualenv my_project
cd my_project
source bin/activate

# install ansible
pip install ansible==2.7.8

# install omsdk
git clone https://github.com/dell/omsdk.git
sh build.sh 1.2 345
cd dist
pip install omsdk-1.2.345_-py2.py3-none-any.whl
cd ../../

# install om ansible modules
git clone https://github.com/dell/dellemc-openmanage-ansible-modules.git
cd dellemc-openmanage-ansible-modules
python install.py
Nathan-UK commented 5 years ago

@anupamaloke, Thanks for coming back on this. Have tried in virtualenv with the same results

anupamaloke commented 5 years ago

@Nathan-UK, that is strange as it is working properly in my virtualenv setup. Are you setting the ansible_python_interpreter correctly, something like below in your playbook:

vars:
  ansible_python_interpreter: python

OR, from the command-line:

ansible-playbook -vvvv <my_playbook.yml> -i <my_inventory_file> -e 'ansible_python_interpreter=python'
anupamaloke commented 5 years ago

@Nathan-UK, if you are able to run the playbook with above changes, then could you please let us know whether I can close this issue?

Nathan-UK commented 5 years ago

I got re assigned to another priority, I'll be re looking at this shortly

Nathan-UK commented 5 years ago

This made no difference

mariomelofilho commented 5 years ago

@Nathan-UK , try become: False in your playbooks.

Nathan-UK commented 5 years ago

I've been working with my Linux colleague on this, using the latest 2.01 release, virtualenvs & Ansible 2.8 we've got it working as expected. I'll get more details from him to share with the thread as I'm still new to this

rajeevarakkal commented 4 years ago

@Nathan-UK Thanks for update. As you got things back on working we are closing issue