ansible-collections / community.general

Ansible Community General Collection
https://galaxy.ansible.com/ui/repo/published/community/general/
GNU General Public License v3.0
821 stars 1.51k forks source link

idrac_redfish_command HTTP Error 400 submitting configuration job #3826

Open bluikko opened 2 years ago

bluikko commented 2 years ago

Summary

On Dell r730xd trying to submit a BIOS configuration job with idrac_redfish_command first gives a HTTP Error 403 about not enough privileges, but then later gives a HTTP Error 400 about configuration job already submitted. At no point did the module succeed without failure.
On the surface it looks like some of the errors were not valid, and the job was actually submitted even though the Ansible module gave an error.
The BIOS configuration job does indeed run when the server is restarted, so either the first 2 errors or the last error are false. The BIOS configuration job was successfully submitted to the Dell BMC even though only errors were output.

In the log below the task was first run when the user drac_user had following privileges set in iDRAC:

The second error was with following privileges set in iDRAC:

And the third error was with following privileges set in iDRAC:

So how could the third attempt fail with 400 job already submitted, if the previous 2 tries failed because of not enough privileges?

One of the errors must be false because the job was indeed submitted.

Edit:

Had a chance to run a BIOS configuration apply job again, this time with the maximum privileges. Just a single execution of idrac_redfish_command gives the 400 error as before. So the problem is that error 400 is displayed, task fails, but the configuration apply job is scheduled on the Dell server.

Issue Type

Bug Report

Component Name

idrac_redfish_command

Ansible Version

$ ansible --version
ansible [core 2.11.6]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/x/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /opt/ansible/lib64/python3.6/site-packages/ansible
  ansible collection location = /home/x/.ansible/collections:/usr/share/ansible/collections
  executable location = /opt/ansible/bin/ansible
  python version = 3.6.8 (default, Nov 16 2020, 16:55:22) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]
  jinja version = 3.0.2
  libyaml = True

Community.general Version

$ ansible-galaxy collection list community.general

# /usr/share/ansible/collections/ansible_collections
Collection        Version
----------------- -------
community.general 4.1.0

Configuration

$ ansible-config dump --only-changed
doesn't seem relevant

OS / Environment

Steps to Reproduce

- name: apply BIOS config
  community.general.idrac_redfish_command:
    baseuri: "{{ redfish_host }}"
    category: Systems
    command: CreateBiosConfigJob
    username: "{{ drac_user }}"
    password: "{{ drac_password }}"
    timeout: 90
  become: false
  delegate_to: localhost

Expected Results

The configuration job was submitted without error and when server reboots it runs the configuration job.

Actual Results

fatal: [host -> localhost]: FAILED! => changed=false
  msg: 'HTTP Error 403 on POST request to ''https://192.0.2.1/redfish/v1/Managers/iDRAC.Embedded.1/Jobs'', extended message: ''You do not have privileges to perform this operation.'''
[host] HANDLER: biosjob : apply BIOS config (debug)> redo
fatal: [host -> localhost]: FAILED! => changed=false
  msg: 'HTTP Error 403 on POST request to ''https://192.0.2.1/redfish/v1/Managers/iDRAC.Embedded.1/Jobs'', extended message: ''You do not have privileges to perform this operation.'''
[host] HANDLER: biosjob : apply BIOS config (debug)> redo
fatal: [host -> localhost]: FAILED! => changed=false
  msg: 'HTTP Error 400 on POST request to ''https://192.0.2.1/redfish/v1/Managers/iDRAC.Embedded.1/Jobs'', extended message: ''Pending configuration values are already committed, unable to perform another set operation.'''

The third attempt seems to be correct, because when server is restarted the BIOS configuration job is actually run.
The first 2 attempts indeed failed (seems maximum privileges are needed) and the third one was successful in submitting the BIOS configuration job but somehow still ended in an error about an already committed job.

Edit:

HTTP Error 400 is always displayed and the task execution fails. But the BIOS configuration job is submitted successfully and on server reboot the BIOS configuration job runs.

Code of Conduct

ansibullbot commented 2 years ago

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

ansibullbot commented 2 years ago

cc @mraineri @renxulei @tomasg2012 @xmadsen click here for bot help

bluikko commented 2 years ago

After a bit of troubleshooting, I have found out that idrac_redfish_command is not needed after modifying the boot order.
So the idrac_redfish_command fails if there are no changes to apply.
Doesn't this mean it does not work in an idempotent way?

The module should just return with changed=false in that case and not fail.

ansibullbot commented 2 years ago

cc @bhavya06 @rajeevkallur click here for bot help

ansibullbot commented 1 year ago

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

ansibullbot commented 1 year ago

cc @jyundt click here for bot help