Server Management - Remote Server Management
1819805 Members
3294 Online
109607 Solutions
New Discussion юеВ

How to set boot order via ansible? (community.general.redfish_config)

 
SOLVED
Go to solution
costelter
Occasional Contributor

How to set boot order via ansible? (community.general.redfish_config)

Hi!

I'm trying to configure a new bunch of servers (HPE ProLiant DL385 Gen 10 Plus v2) witn ansible and the community.general collection via redfish_config.

Setting normal bios parameters, ilo config does work as expected.

But the SetBootOrder command fails with a "400 on PATCH request".

fatal: [localhost]: FAILED! => {"changed": false, "msg": "HTTP Error 400 on PATCH request to 'https://10.x.x.11/redfish/v1/Systems/1/', extended message: 'Bad Request'"}

I could read the current bootorder via GetBootOrder:

{
    "BootOptionReference": "Boot001A",
    "DisplayName": "OCP Slot 10 Port 1 : Intel(R) Ethernet Network Adapter I350-T4 for OCP NIC 3.0 (PXE IPv4)"
},
{
    "BootOptionReference": "Boot000E",
    "DisplayName": "Generic USB Boot"
},
{
    "BootOptionReference": "Boot000F",
    "DisplayName": "Storage Slot 12 : HPE MR416i-a Gen10+ - Box 3, Bay 1"
},
{
    "BootOptionReference": "Boot0010",
    "DisplayName": "Storage Slot 12 : HPE MR416i-a Gen10+ - Box 3, Bay 2"
},
{
    "BootOptionReference": "Boot0011",
    "DisplayName": "Storage Slot 12 : HPE MR416i-a Gen10+ - Box 3, Bay 3"
},
{
    "BootOptionReference": "Boot0012",
    "DisplayName": "Storage Slot 12 : HPE MR416i-a Gen10+ - Box 3, Bay 4"
},
{
    "BootOptionReference": "Boot0013",
    "DisplayName": "Storage Slot 12 : HPE MR416i-a Gen10+ - Box 3, Bay 5"
},
{
    "BootOptionReference": "Boot0014",
    "DisplayName": "Storage Slot 12 : HPE MR416i-a Gen10+ - Box 3, Bay 6"
},
{
    "BootOptionReference": "Boot0015",
    "DisplayName": "Storage Slot 12 : HPE MR416i-a Gen10+ - Box 3, Bay 7"
},
{
    "BootOptionReference": "Boot0016",
    "DisplayName": "Storage Slot 12 : HPE MR416i-a Gen10+ - Box 3, Bay 8"
},
{
    "BootOptionReference": "Boot0019",
    "DisplayName": "OCP Slot 10 Port 1 : Intel(R) Ethernet Network Adapter I350-T4 for OCP NIC 3.0 (HTTP(S) IPv4)"
},
{
    "BootOptionReference": "Boot0017",
    "DisplayName": "OCP Slot 10 Port 1 : Intel(R) Ethernet Network Adapter I350-T4 for OCP NIC 3.0 (PXE IPv6)"
},
{
    "BootOptionReference": "Boot0018",
    "DisplayName": "OCP Slot 10 Port 1 : Intel(R) Ethernet Network Adapter I350-T4 for OCP NIC 3.0 (HTTP(S) IPv6)"
}

This is the ansible code for reading:

- name: Get info
  community.general.redfish_info:
    category: Systems
    command: GetBootOrder
    baseuri: "{{ baseuri[item.key] }}"
    username: "{{ username }}"
    password: "{{ credentials[item.key] }}"
  register: just_all

- name: Debug
  ansible.builtin.debug:
    msg: "{{ just_all }}"

and the part for (trying) to set the new order:

- name: Set boot order
  community.general.redfish_config:
    category: Systems
    command: SetBootOrder
    boot_order:
      - Boot000E
      - Boot001A
      - Boot000F
      - Boot0010
      - Boot0011
      - Boot0012
      - Boot0013
      - Boot0014
      - Boot0015
      - Boot0016
      - Boot0019
      - Boot0017
      - Boot0018
    baseuri: "{{ baseuri[item.key] }}"
    auth_token: "{{ result.session.token }}"

Which fails.

Any hints what could be wrong?

Kind regards,

Christian

3 REPLIES 3
Suman_1978
HPE Pro

Re: How to set boot order via ansible? (community.general.redfish_config)

Hi,

I  personally have not tried this script but here is a good documentation to start with.

https://developer.hpe.com/blog/setting-bios-and-storage-controller-properties-with-redfish/
https://developer.hpe.com/blog/master-the-redfish-server-states-to-improve-your-monitoring-and-manageme/

Thank You!
I work with HPE but opinions expressed here are mine.
Recent Support Video Releases



I work at HPE
HPE Support Center offers support for your HPE services and products when and how you need it. Get started with HPE Support Center today.
[Any personal opinions expressed are mine, and not official statements on behalf of Hewlett Packard Enterprise]
Accept or Kudo
costelter
Occasional Contributor
Solution

Re: How to set boot order via ansible? (community.general.redfish_config)

Thanks for the pointers!

I solved it by using a commission script with HPEs ilorest command within the MAAS that we use to deploy the base Ubuntu os installation.

With ilorest it works as expected. If I find the time, I will open an issue for the ansible collection used. May be a contributor to that project has more insight and can help to solved it for the community collection.

Kind regards,

Christian

Sunitha_Mod
Moderator

Re: How to set boot order via ansible? (community.general.redfish_config)

@costelter 

Hello Christian, 

Perfect! 

We are glad to know you were able to find the solution and thank you for keeping us updated. 



Thanks,
Sunitha G
I'm an HPE employee.
HPE Support Center offers support for your HPE services and products when and how you need it. Get started with HPE Support Center today.
[Any personal opinions expressed are mine, and not official statements on behalf of Hewlett Packard Enterprise]
Accept or Kudo