검색

Chapter 4. Ansible IPMI modules in RHEL

download PDF

4.1. The rhel_mgmt collection

The Intelligent Platform Management Interface (IPMI) is a specification for a set of standard protocols to communicate with baseboard management controller (BMC) devices. The IPMI modules allow you to enable and support hardware management automation. The IPMI modules are available in:

  • The rhel_mgmt Collection. The package name is ansible-collection-redhat-rhel_mgmt.
  • The RHEL 7.9 AppStream, as part of the new ansible-collection-redhat-rhel_mgmt package.

The following IPMI modules are available in the rhel_mgmt collection:

  • ipmi_boot: Management of boot device order
  • ipmi_power: Power management for machine

The mandatory parameters used for the IPMI Modules are:

  • ipmi_boot parameters:
Module nameDescription

name

Hostname or ip address of the BMC

password

Password to connect to the BMC

bootdev

Device to be used on next boot

* network

* floppy

* hd

* safe

* optical

* setup

* default

User

Username to connect to the BMC

  • ipmi_power parameters:
Module nameDescription

name

BMC Hostname or IP address

password

Password to connect to the BMC

user

Username to connect to the BMC

State

Check if the machine is on the desired status

* on

* off

* shutdown

* reset

* boot

4.2. Installing the rhel mgmt Collection using the CLI

You can install the rhel_mgmt Collection using the command line.

Prerequisites

  • The ansible-core package is installed.

Procedure

  • Install the collection via RPM package:

    # yum install ansible-collection-redhat-rhel_mgmt

    After the installation is finished, the IPMI modules are available in the redhat.rhel_mgmt Ansible collection.

Additional resources

  • The ansible-playbook man page.

4.3. Example using the ipmi_boot module

The following example shows how to use the ipmi_boot module in a playbook to set a boot device for the next boot. For simplicity, the examples use 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 rhel_mgmt collection is installed.
  • The pyghmi library in the python3-pyghmi package is installed in one of the following locations:

    • The host where you execute the playbook.
    • The managed host. If you use localhost as the managed host, install the python3-pyghmi package on the host where you execute the playbook instead.
  • The IPMI BMC that you want to control is accessible via network from the host where you execute the playbook, or the managed host (if not using localhost as the managed host). Note that the host whose BMC is being configured by the module is generally different from the host where the module is executing (the Ansible managed host), as the module contacts the BMC over the network using the IPMI protocol.
  • You have credentials to access BMC with an appropriate level of access.

Procedure

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

    ---
    - name: Sets which boot device will be used on next boot
      hosts: localhost
        tasks:
        - redhat.rhel_mgmt.ipmi_boot:
           name: bmc.host.example.com
             user: admin_user
             password: basics
             bootdev: hd
  2. Execute the playbook against localhost:

    # ansible-playbook playbook.yml

As a result, the output returns the value “success”.

4.4. Example using the ipmi_power module

This example shows how to use the ipmi_boot module in a playbook to check if the system is turned on. For simplicity, the examples use 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 rhel_mgmt collection is installed.
  • The pyghmi library in the python3-pyghmi package is installed in one of the following locations:

    • The host where you execute the playbook.
    • The managed host. If you use localhost as the managed host, install the python3-pyghmi package on the host where you execute the playbook instead.
  • The IPMI BMC that you want to control is accessible via network from the host where you execute the playbook, or the managed host (if not using localhost as the managed host). Note that the host whose BMC is being configured by the module is generally different from the host where the module is executing (the Ansible managed host), as the module contacts the BMC over the network using the IPMI protocol.
  • You have credentials to access BMC with an appropriate level of access.

Procedure

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

    ---
    - name: Turn the host on
      hosts: localhost
        tasks:
        - redhat.rhel_mgmt.ipmi_power:
           name: bmc.host.example.com
             user: admin_user
             password: basics
             state: on
  2. Execute the playbook:

    # ansible-playbook playbook.yml

The output returns the value “true”.

Red Hat logoGithubRedditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

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

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

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

Red Hat 소개

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

© 2024 Red Hat, Inc.