HewlettPackard / ilo-ansible-collection

Ansible Collection and Sample Playbooks for HPE iLO
Apache License 2.0
40 stars 20 forks source link

Not able to set the iLO hostname #22

Open wally007 opened 9 months ago

wally007 commented 9 months ago

There is an issue with community.general.redfish_config and setting up the iLO hostname.

Please see below

playbook

- name: Turn system power off before we add it to oneview
  community.general.redfish_command:
    category: Systems
    command: PowerForceOff
    baseuri: "{{ inventory_hostname }}-mgt.ref"
    username: "{{ ilo_username }}"
    password: "{{ ilo_password }}"
  delegate_to: localhost

- name: Set Manager NIC
  community.general.redfish_config:
    category: Manager
    command: SetManagerNic
    nic_config:
      HostName: "{{ inventory_hostname }}-mgt"
    baseuri: "{{ inventory_hostname }}-mgt.ref"
    username: "{{ ilo_username }}"
    password: "{{ ilo_password }}"
  delegate_to: localhost

The server gets turned off (1st task) but 2nd task results in an error


TASK [os_provision_bm : Turn system power off before we add it to oneview] *****
ok: [refinst-capture1 -> localhost]

TASK [os_provision_bm : Set Manager NIC] ***************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: KeyError: 'ret'
fatal: [refinst-capture1 -> localhost]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n  File \"/root/.ansible/tmp/ansible-tmp-1696842931.6232207-36-22336732954983/AnsiballZ_redfish_config.py\", line 107, in <module>\n    _ansiballz_main()\n  File \"/root/.ansible/tmp/ansible-tmp-1696842931.6232207-36-22336732954983/AnsiballZ_redfish_config.py\", line 99, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/root/.ansible/tmp/ansible-tmp-1696842931.6232207-36-22336732954983/AnsiballZ_redfish_config.py\", line 47, in invoke_module\n    runpy.run_module(mod_name='ansible_collections.community.general.plugins.modules.redfish_config', init_globals=dict(_module_fqn='ansible_collections.community.general.plugins.modules.redfish_config', _modlib_path=modlib_path),\n  File \"/usr/lib64/python3.9/runpy.py\", line 225, in run_module\n    return _run_module_code(code, init_globals, run_name, mod_spec)\n  File \"/usr/lib64/python3.9/runpy.py\", line 97, in _run_module_code\n    _run_code(code, mod_globals, init_globals,\n  File \"/usr/lib64/python3.9/runpy.py\", line 87, in _run_code\n    exec(code, run_globals)\n  File \"/tmp/ansible_community.general.redfish_config_payload_gl0tgrl4/ansible_community.general.redfish_config_payload.zip/ansible_collections/community/general/plugins/modules/redfish_config.py\", line 476, in <module>\n  File \"/tmp/ansible_community.general.redfish_config_payload_gl0tgrl4/ansible_community.general.redfish_config_payload.zip/ansible_collections/community/general/plugins/modules/redfish_config.py\", line 466, in main\nKeyError: 'ret'\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}

PLAY RECAP *********************************************************************

Username/Password and URI must be correct, since I'm able to turn off the server with the same parameters in the 1st task

Server info: DL325 Gen 11, iLo6 1.40

Ansible info: 2.15, python3.9, all other collections are latest versions as of today (installed ilo collection and all dependencies today s per README.md)

wally007 commented 9 months ago

I think I found the problem.

The issue is differenec between how community.general.redfish_command and community.general.redfish_config handle self signed or mismatched SSL certificates.

Is there anyway to disable verify SSL certificate of the ilo using any of these redfish modules ? I couldnt find it in the documentation.

wally007 commented 8 months ago

The above problem manifests when you try to change hostname from DHCP acqired to static IP with different domain. The community.general.redfish_command works - while community.general.redfish_config does not (the above error is thrown)

Bhavya06 commented 8 months ago

Hi @wally007 , We will look into it and get back to you.

a-dawg commented 3 months ago

I think I found the problem.

The issue is differenec between how community.general.redfish_command and community.general.redfish_config handle self signed or mismatched SSL certificates.

Is there anyway to disable verify SSL certificate of the ilo using any of these redfish modules ? I couldnt find it in the documentation.

same error here. Have you found any workaround?