community.general.ipmi_power (8.5.0) — module

Power management for machine

Authors: Bulat Gaifullin (@bgaifullin) <gaifullinbf@gmail.com>

Install collection

Install with ansible-galaxy collection install community.general:==8.5.0


Add to requirements.yml

  collections:
    - name: community.general
      version: 8.5.0

Description

Use this module for power management


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Ensure machine is powered on
  community.general.ipmi_power:
    name: test.testdomain.com
    user: admin
    password: password
    state: 'on'
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Ensure machines of which remote target address is 48 and 50 are powered off
  community.general.ipmi_power:
    name: test.testdomain.com
    user: admin
    password: password
    state: 'off'
    machine:
      - targetAddress: 48
      - targetAddress: 50
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Ensure machine of which remote target address is 48 is powered on, and 50 is powered off
  community.general.ipmi_power:
    name: test.testdomain.com
    user: admin
    password: password
    machine:
      - targetAddress: 48
        state: 'on'
      - targetAddress: 50
        state: 'off'

Inputs

    
key:
    description:
    - Encryption key to connect to the BMC in hex format.
    required: false
    type: str
    version_added: 4.1.0
    version_added_collection: community.general

name:
    description:
    - Hostname or ip address of the BMC.
    required: true
    type: str

port:
    default: 623
    description:
    - Remote RMCP port.
    type: int

user:
    description:
    - Username to use to connect to the BMC.
    required: true
    type: str

state:
    choices:
    - 'on'
    - 'off'
    - shutdown
    - reset
    - boot
    description:
    - Whether to ensure that the machine in desired state.
    - 'The choices for state are: - on -- Request system turn on - off -- Request system
      turn off without waiting for OS to shutdown - shutdown -- Have system request OS
      proper shutdown - reset -- Request system reset without waiting for OS - boot --
      If system is off, then ''on'', else ''reset'''
    - Either this option or O(machine) is required.
    type: str

machine:
    description:
    - Provide a list of the remote target address for the bridge IPMI request, and the
      power status.
    - Either this option or O(state) is required.
    elements: dict
    required: false
    suboptions:
      state:
        choices:
        - 'on'
        - 'off'
        - shutdown
        - reset
        - boot
        description:
        - Whether to ensure that the machine specified by O(machine[].targetAddress) in
          desired state.
        - If this option is not set, the power state is set by O(state).
        - If both this option and O(state) are set, this option takes precedence over
          O(state).
        type: str
      targetAddress:
        description:
        - Remote target address for the bridge IPMI request.
        required: true
        type: int
    type: list
    version_added: 4.3.0
    version_added_collection: community.general

timeout:
    default: 300
    description:
    - Maximum number of seconds before interrupt request.
    type: int

password:
    description:
    - Password to connect to the BMC.
    required: true
    type: str

Outputs

powerstate:
  description: The current power state of the machine.
  returned: success and O(machine) is not provided
  sample: 'on'
  type: str
status:
  contains:
    powerstate:
      description: The current power state of the machine specified by RV(status[].targetAddress).
      type: str
    targetAddress:
      description: The remote target address.
      type: int
  description: The current power state of the machine when the machine option is set.
  elements: dict
  returned: success and O(machine) is provided
  sample:
  - powerstate: 'on'
    targetAddress: 48
  - powerstate: 'on'
    targetAddress: 50
  type: list
  version_added: 4.3.0
  version_added_collection: community.general