community.general.redfish_command (0.1.1) — module

Manages Out-Of-Band controllers using Redfish APIs

Authors: Jose Delarosa (@jose-delarosa)

preview | supported by community

Install collection

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


Add to requirements.yml

  collections:
    - name: community.general
      version: 0.1.1

Description

Builds Redfish URIs locally and sends them to remote OOB controllers to perform an action.

Manages OOB controller ex. reboot, log management.

Manages OOB controller users ex. add, remove, update.

Manages system power ex. on, off, graceful and forced reboot.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
  - name: Restart system power gracefully
    redfish_command:
      category: Systems
      command: PowerGracefulRestart
      resource_id: 437XR1138R2
      baseuri: "{{ baseuri }}"
      username: "{{ username }}"
      password: "{{ password }}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
  - name: Set one-time boot device to {{ bootdevice }}
    redfish_command:
      category: Systems
      command: SetOneTimeBoot
      resource_id: 437XR1138R2
      bootdevice: "{{ bootdevice }}"
      baseuri: "{{ baseuri }}"
      username: "{{ username }}"
      password: "{{ password }}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
  - name: Set one-time boot device to UefiTarget of "/0x31/0x33/0x01/0x01"
    redfish_command:
      category: Systems
      command: SetOneTimeBoot
      resource_id: 437XR1138R2
      bootdevice: "UefiTarget"
      uefi_target: "/0x31/0x33/0x01/0x01"
      baseuri: "{{ baseuri }}"
      username: "{{ username }}"
      password: "{{ password }}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
  - name: Set one-time boot device to BootNext target of "Boot0001"
    redfish_command:
      category: Systems
      command: SetOneTimeBoot
      resource_id: 437XR1138R2
      bootdevice: "UefiBootNext"
      boot_next: "Boot0001"
      baseuri: "{{ baseuri }}"
      username: "{{ username }}"
      password: "{{ password }}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
  - name: Set chassis indicator LED to blink
    redfish_command:
      category: Chassis
      command: IndicatorLedBlink
      resource_id: 1U
      baseuri: "{{ baseuri }}"
      username: "{{ username }}"
      password: "{{ password }}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
  - name: Add user
    redfish_command:
      category: Accounts
      command: AddUser
      baseuri: "{{ baseuri }}"
      username: "{{ username }}"
      password: "{{ password }}"
      new_username: "{{ new_username }}"
      new_password: "{{ new_password }}"
      roleid: "{{ roleid }}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
  - name: Add user using new option aliases
    redfish_command:
      category: Accounts
      command: AddUser
      baseuri: "{{ baseuri }}"
      username: "{{ username }}"
      password: "{{ password }}"
      account_username: "{{ account_username }}"
      account_password: "{{ account_password }}"
      account_roleid: "{{ account_roleid }}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
  - name: Delete user
    redfish_command:
      category: Accounts
      command: DeleteUser
      baseuri: "{{ baseuri }}"
      username: "{{ username }}"
      password: "{{ password }}"
      account_username: "{{ account_username }}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
  - name: Disable user
    redfish_command:
      category: Accounts
      command: DisableUser
      baseuri: "{{ baseuri }}"
      username: "{{ username }}"
      password: "{{ password }}"
      account_username: "{{ account_username }}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
  - name: Enable user
    redfish_command:
      category: Accounts
      command: EnableUser
      baseuri: "{{ baseuri }}"
      username: "{{ username }}"
      password: "{{ password }}"
      account_username: "{{ account_username }}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
  - name: Add and enable user
    redfish_command:
      category: Accounts
      command: AddUser,EnableUser
      baseuri: "{{ baseuri }}"
      username: "{{ username }}"
      password: "{{ password }}"
      new_username: "{{ new_username }}"
      new_password: "{{ new_password }}"
      roleid: "{{ roleid }}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
  - name: Update user password
    redfish_command:
      category: Accounts
      command: UpdateUserPassword
      baseuri: "{{ baseuri }}"
      username: "{{ username }}"
      password: "{{ password }}"
      account_username: "{{ account_username }}"
      account_password: "{{ account_password }}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
  - name: Update user role
    redfish_command:
      category: Accounts
      command: UpdateUserRole
      baseuri: "{{ baseuri }}"
      username: "{{ username }}"
      password: "{{ password }}"
      account_username: "{{ account_username }}"
      roleid: "{{ roleid }}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
  - name: Update user name
    redfish_command:
      category: Accounts
      command: UpdateUserName
      baseuri: "{{ baseuri }}"
      username: "{{ username }}"
      password: "{{ password }}"
      account_username: "{{ account_username }}"
      account_updatename: "{{ account_updatename }}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
  - name: Update user name
    redfish_command:
      category: Accounts
      command: UpdateUserName
      baseuri: "{{ baseuri }}"
      username: "{{ username }}"
      password: "{{ password }}"
      account_username: "{{ account_username }}"
      update_username: "{{ update_username }}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
  - name: Update AccountService properties
    redfish_command:
      category: Accounts
      command: UpdateAccountServiceProperties
      baseuri: "{{ baseuri }}"
      username: "{{ username }}"
      password: "{{ password }}"
      account_properties:
        AccountLockoutThreshold: 5
        AccountLockoutDuration: 600
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
  - name: Clear Manager Logs with a timeout of 20 seconds
    redfish_command:
      category: Manager
      command: ClearLogs
      resource_id: BMC
      baseuri: "{{ baseuri }}"
      username: "{{ username }}"
      password: "{{ password }}"
      timeout: 20
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
  - name: Clear Sessions
    redfish_command:
      category: Sessions
      command: ClearSessions
      baseuri: "{{ baseuri }}"
      username: "{{ username }}"
      password: "{{ password }}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
  - name: Simple update
    redfish_command:
      category: Update
      command: SimpleUpdate
      baseuri: "{{ baseuri }}"
      username: "{{ username }}"
      password: "{{ password }}"
      update_image_uri: https://example.com/myupdate.img
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
  - name: Simple update with additional options
    redfish_command:
      category: Update
      command: SimpleUpdate
      baseuri: "{{ baseuri }}"
      username: "{{ username }}"
      password: "{{ password }}"
      update_image_uri: //example.com/myupdate.img
      update_protocol: FTP
      update_targets:
        - /redfish/v1/UpdateService/FirmwareInventory/BMC
      update_creds:
        username: operator
        password: supersecretpwd

Inputs

    
id:
    aliases:
    - account_id
    description:
    - ID of account to delete/modify
    required: false
    type: str

roleid:
    aliases:
    - account_roleid
    description:
    - Role of account to add/modify
    required: false
    type: str

baseuri:
    description:
    - Base URI of OOB controller
    required: true
    type: str

command:
    description:
    - List of commands to execute on OOB controller
    required: true
    type: list

timeout:
    default: 10
    description:
    - Timeout in seconds for URL requests to OOB controller
    type: int

category:
    description:
    - Category to execute on OOB controller
    required: true
    type: str

password:
    description:
    - Password for authentication with OOB controller
    required: true
    type: str

username:
    description:
    - Username for authentication with OOB controller
    required: true
    type: str

boot_next:
    description:
    - BootNext target when bootdevice is "UefiBootNext"
    required: false
    type: str

bootdevice:
    description:
    - bootdevice when setting boot configuration
    required: false
    type: str

resource_id:
    description:
    - The ID of the System, Manager or Chassis to modify
    required: false
    type: str

uefi_target:
    description:
    - UEFI target when bootdevice is "UefiTarget"
    required: false
    type: str

new_password:
    aliases:
    - account_password
    description:
    - New password of account to add/modify
    required: false
    type: str

new_username:
    aliases:
    - account_username
    description:
    - Username of account to add/delete/modify
    required: false
    type: str

update_creds:
    description:
    - The credentials for retrieving the update image
    required: false
    suboptions:
      password:
        description:
        - The password for retrieving the update image
        required: false
        type: str
      username:
        description:
        - The username for retrieving the update image
        required: false
        type: str
    type: dict

update_targets:
    description:
    - The list of target resource URIs to apply the update to
    elements: str
    required: false
    type: list

update_protocol:
    description:
    - The protocol for the update
    required: false
    type: str

update_username:
    aliases:
    - account_updatename
    description:
    - new update user name for account_username
    required: false
    type: str

update_image_uri:
    description:
    - The URI of the image for the update
    required: false
    type: str

account_properties:
    description:
    - properties of account service to update
    required: false
    type: dict

Outputs

msg:
  description: Message with action result or error description
  returned: always
  sample: Action was successful
  type: str