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

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:

  1. redfish_info: The redfish_info module retrieves information about the remote Out-Of-Band (OOB) controller such as systems inventory.
  2. redfish_command: The redfish_command module performs Out-Of-Band (OOB) controller operations like log management and user management, and power operations such as system restart, power on and off.
  3. redfish_config: The redfish_config module performs OOB controller operations such as changing OOB configuration, or setting the BIOS configuration.

5.2. Redfish modules parameters

The parameters used for the Redfish modules are:

redfish_info parameters:Description

baseuri

(Mandatory) - Base URI of OOB controller.

category

(Mandatory) - List of categories to execute on OOB controller. The default value is ["Systems"].

command

(Mandatory) - List of commands to execute on OOB controller.

username

Username for authentication to OOB controller.

password

Password for authentication to OOB controller.

redfish_command parameters:Description

baseuri

(Mandatory) - Base URI of OOB controller.

category

(Mandatory) - List of categories to execute on OOB controller. The default value is ["Systems"].

command

(Mandatory) - List of commands to execute on OOB controller.

username

Username for authentication to OOB controller.

password

Password for authentication to OOB controller.

redfish_config parameters:Description

baseuri

(Mandatory) - Base URI of OOB controller.

category

(Mandatory) - List of categories to execute on OOB controller. The default value is ["Systems"].

command

(Mandatory) - List of commands to execute on OOB controller.

username

Username for authentication to OOB controller.

password

Password for authentication to OOB controller.

bios_attributes

BIOS attributes to update.

5.3. Using the redfish_info module

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_mgmt collection is installed.
  • The pyghmi library in the python3-pyghmi package is installed on the managed host. If you use localhost as the managed host, install the python3-pyghmi package on the host where you execute the playbook.
  • OOB controller access details.

Procedure

  1. Create a new playbook.yml file with the following content:

    ---
    - name: Get CPU inventory
      hosts: localhost
      tasks:
        - redhat.rhel_mgmt.redfish_info:
            baseuri: "{{ baseuri }}"
            username: "{{ username }}"
            password: "{{ password }}"
            category: Systems
            command: GetCpuInventory
          register: result
  2. Execute the playbook against localhost:

    # ansible-playbook playbook.yml

As a result, the output returns the CPU inventory details.

5.4. Using the redfish_command module

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_mgmt collection is installed.
  • The pyghmi library in the python3-pyghmi package is installed on the managed host. If you use localhost as the managed host, install the python3-pyghmi package on the host where you execute the playbook.
  • OOB controller access details.

Procedure

  1. Create a new playbook.yml file with the following content:

    ---
    - name: Power on system
      hosts: localhost
      tasks:
        - redhat.rhel_mgmt.redfish_command:
            baseuri: "{{ baseuri }}"
            username: "{{ username }}"
            password: "{{ password }}"
            category: Systems
            command: PowerOn
  2. Execute the playbook against localhost:

    # ansible-playbook playbook.yml

As a result, the system powers on.

5.5. Using the redfish_config module

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_mgmt collection is installed.
  • The pyghmi library in the python3-pyghmi package is installed on the managed host. If you use localhost as the managed host, install the python3-pyghmi package on the host where you execute the playbook.
  • OOB controller access details.

Procedure

  1. Create a new playbook.yml file with the following content:

    ---
    - name: "Set BootMode to UEFI"
      hosts: localhost
      tasks:
        - redhat.rhel_mgmt.redfish_config:
            baseuri: "{{ baseuri }}"
            username: "{{ username }}"
            password: "{{ password }}"
            category: Systems
            command: SetBiosAttributes
            bios_attributes:
              BootMode: Uefi
  2. Execute the playbook against localhost:

    # ansible-playbook playbook.yml

As a result, the system boot mode is set to UEFI.

Red Hat logoGithubRedditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

Red Hat을 사용하는 고객은 신뢰할 수 있는 콘텐츠가 포함된 제품과 서비스를 통해 혁신하고 목표를 달성할 수 있습니다. 최신 업데이트를 확인하세요.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

© 2024 Red Hat, Inc.