Ce contenu n'est pas disponible dans la langue sélectionnée.
Chapter 5. The Redfish modules in RHEL
The Redfish modules for remote management of devices are now part of the redhat.rhel_mgmt Ansible collection. With the Redfish modules, you can easily use management automation on bare-metal servers and platform hardware by getting information about the servers or control them through an Out-Of-Band (OOB) controller, using the standard HTTPS transport and JSON format.
5.1. The Redfish modules Copier lienLien copié sur presse-papiers!
The redhat.rhel_mgmt Ansible collection provides the Redfish modules to support hardware management in Ansible over Redfish. The redhat.rhel_mgmt collection is available in the ansible-collection-redhat-rhel_mgmt package. To install it, see Installing the redhat.rhel_mgmt Collection using the CLI.
The following Redfish modules are available in the redhat.rhel_mgmt collection:
-
redfish_info: Theredfish_infomodule retrieves information about the remote Out-Of-Band (OOB) controller such as systems inventory. -
redfish_command: Theredfish_commandmodule performs Out-Of-Band (OOB) controller operations like log management and user management, and power operations such as system restart, power on and off. -
redfish_config: Theredfish_configmodule performs OOB controller operations such as changing OOB configuration, or setting the BIOS configuration.
5.2. Redfish modules parameters Copier lienLien copié sur presse-papiers!
The parameters used for the Redfish modules are:
redfish_info parameters: | Description |
|---|---|
|
| (Mandatory) - Base URI of OOB controller. |
|
| (Mandatory) - List of categories to execute on OOB controller. The default value is ["Systems"]. |
|
| (Mandatory) - List of commands to execute on OOB controller. |
|
| Username for authentication to OOB controller. |
|
| Password for authentication to OOB controller. |
redfish_command parameters: | Description |
|---|---|
|
| (Mandatory) - Base URI of OOB controller. |
|
| (Mandatory) - List of categories to execute on OOB controller. The default value is ["Systems"]. |
|
| (Mandatory) - List of commands to execute on OOB controller. |
|
| Username for authentication to OOB controller. |
|
| Password for authentication to OOB controller. |
redfish_config parameters: | Description |
|---|---|
|
| (Mandatory) - Base URI of OOB controller. |
|
| (Mandatory) - List of categories to execute on OOB controller. The default value is ["Systems"]. |
|
| (Mandatory) - List of commands to execute on OOB controller. |
|
| Username for authentication to OOB controller. |
|
| Password for authentication to OOB controller. |
|
| BIOS attributes to update. |
5.3. Using the redfish_info module Copier lienLien copié sur presse-papiers!
The following example shows how to use the redfish_info module in a playbook to get information about the CPU inventory. For simplicity, the example uses the same host as the Ansible control host and managed host, thus executing the modules on the same host where the playbook is executed.
Prerequisites
-
The
redhat.rhel_mgmtcollection is installed. -
The
pyghmilibrary in thepython3-pyghmipackage is installed on the managed host. If you use localhost as the managed host, install thepython3-pyghmipackage on the host where you execute the playbook. - OOB controller access details.
Procedure
Create a new playbook.yml file with the following content:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Execute the playbook against localhost:
ansible-playbook playbook.yml
# ansible-playbook playbook.ymlCopy to Clipboard Copied! Toggle word wrap Toggle overflow
As a result, the output returns the CPU inventory details.
5.4. Using the redfish_command module Copier lienLien copié sur presse-papiers!
The following example shows how to use the redfish_command module in a playbook to turn on a system. For simplicity, the example uses the same host as the Ansible control host and managed host, thus executing the modules on the same host where the playbook is executed.
Prerequisites
-
The
redhat.rhel_mgmtcollection is installed. -
The
pyghmilibrary in thepython3-pyghmipackage is installed on the managed host. If you use localhost as the managed host, install thepython3-pyghmipackage on the host where you execute the playbook. - OOB controller access details.
Procedure
Create a new playbook.yml file with the following content:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Execute the playbook against localhost:
ansible-playbook playbook.yml
# ansible-playbook playbook.ymlCopy to Clipboard Copied! Toggle word wrap Toggle overflow
As a result, the system powers on.
5.5. Using the redfish_config module Copier lienLien copié sur presse-papiers!
The following example shows how to use the redfish_config module in a playbook to configure a system to boot with UEFI. For simplicity, the example uses the same host as the Ansible control host and managed host, thus executing the modules on the same host where the playbook is executed.
Prerequisites
-
The
redhat.rhel_mgmtcollection is installed. -
The
pyghmilibrary in thepython3-pyghmipackage is installed on the managed host. If you use localhost as the managed host, install thepython3-pyghmipackage on the host where you execute the playbook. - OOB controller access details.
Procedure
Create a new playbook.yml file with the following content:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Execute the playbook against localhost:
ansible-playbook playbook.yml
# ansible-playbook playbook.ymlCopy to Clipboard Copied! Toggle word wrap Toggle overflow
As a result, the system boot mode is set to UEFI.