community.general.redfish_command (8.5.0) — module

Manages Out-Of-Band controllers using Redfish APIs

Authors: Jose Delarosa (@jose-delarosa), T S Kushal (@TSKushal)

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

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
    community.general.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: Turn system power off
    community.general.redfish_command:
      category: Systems
      command: PowerForceOff
      resource_id: 437XR1138R2
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
  - name: Restart system power forcefully
    community.general.redfish_command:
      category: Systems
      command: PowerForceRestart
      resource_id: 437XR1138R2
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
  - name: Shutdown system power gracefully
    community.general.redfish_command:
      category: Systems
      command: PowerGracefulShutdown
      resource_id: 437XR1138R2
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
  - name: Turn system power on
    community.general.redfish_command:
      category: Systems
      command: PowerOn
      resource_id: 437XR1138R2
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
  - name: Reboot system power
    community.general.redfish_command:
      category: Systems
      command: PowerReboot
      resource_id: 437XR1138R2
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
  - name: Set one-time boot device to {{ bootdevice }}
    community.general.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"
    community.general.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"
    community.general.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 persistent boot device override
    community.general.redfish_command:
      category: Systems
      command: EnableContinuousBootOverride
      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 to BiosSetup
    community.general.redfish_command:
      category: Systems
      command: SetOneTimeBoot
      boot_next: BiosSetup
      boot_override_mode: Legacy
      baseuri: "{{ baseuri }}"
      username: "{{ username }}"
      password: "{{ password }}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
  - name: Disable persistent boot device override
    community.general.redfish_command:
      category: Systems
      command: DisableBootOverride
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
  - name: Set system indicator LED to blink using security token for auth
    community.general.redfish_command:
      category: Systems
      command: IndicatorLedBlink
      resource_id: 437XR1138R2
      baseuri: "{{ baseuri }}"
      auth_token: "{{ result.session.token }}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
  - name: Add user
    community.general.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 with specified account types
    community.general.redfish_command:
      category: Accounts
      command: AddUser
      baseuri: "{{ baseuri }}"
      username: "{{ username }}"
      password: "{{ password }}"
      new_username: "{{ new_username }}"
      new_password: "{{ new_password }}"
      roleid: "{{ roleid }}"
      account_types:
      - Redfish
      - WebUI
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
  - name: Add user using new option aliases
    community.general.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
    community.general.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
    community.general.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
    community.general.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
    community.general.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
    community.general.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
    community.general.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
    community.general.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
    community.general.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
    community.general.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
    community.general.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: Create session
    community.general.redfish_command:
      category: Sessions
      command: CreateSession
      baseuri: "{{ baseuri }}"
      username: "{{ username }}"
      password: "{{ password }}"
    register: result
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
  - name: Set chassis indicator LED to blink using security token for auth
    community.general.redfish_command:
      category: Chassis
      command: IndicatorLedBlink
      resource_id: 1U
      baseuri: "{{ baseuri }}"
      auth_token: "{{ result.session.token }}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
  - name: Delete session using security token created by CreateSesssion above
    community.general.redfish_command:
      category: Sessions
      command: DeleteSession
      baseuri: "{{ baseuri }}"
      auth_token: "{{ result.session.token }}"
      session_uri: "{{ result.session.uri }}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
  - name: Clear Sessions
    community.general.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
    community.general.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
    community.general.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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
  - name: Multipart HTTP push update; timeout is 600 seconds to allow for a
      large image transfer
    community.general.redfish_command:
      category: Update
      command: MultipartHTTPPushUpdate
      baseuri: "{{ baseuri }}"
      username: "{{ username }}"
      password: "{{ password }}"
      timeout: 600
      update_image_file: ~/images/myupdate.img
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
  - name: Multipart HTTP push with additional options; timeout is 600 seconds
      to allow for a large image transfer
    community.general.redfish_command:
      category: Update
      command: MultipartHTTPPushUpdate
      baseuri: "{{ baseuri }}"
      username: "{{ username }}"
      password: "{{ password }}"
      timeout: 600
      update_image_file: ~/images/myupdate.img
      update_targets:
        - /redfish/v1/UpdateService/FirmwareInventory/BMC
      update_oem_params:
        PreserveConfiguration: false
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
  - name: Perform requested operations to continue the update
    community.general.redfish_command:
      category: Update
      command: PerformRequestedOperations
      baseuri: "{{ baseuri }}"
      username: "{{ username }}"
      password: "{{ password }}"
      update_handle: /redfish/v1/TaskService/TaskMonitors/735
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
  - name: Insert Virtual Media
    community.general.redfish_command:
      category: Systems
      command: VirtualMediaInsert
      baseuri: "{{ baseuri }}"
      username: "{{ username }}"
      password: "{{ password }}"
      virtual_media:
        image_url: 'http://example.com/images/SomeLinux-current.iso'
        media_types:
          - CD
          - DVD
      resource_id: 1
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
  - name: Insert Virtual Media
    community.general.redfish_command:
      category: Manager
      command: VirtualMediaInsert
      baseuri: "{{ baseuri }}"
      username: "{{ username }}"
      password: "{{ password }}"
      virtual_media:
        image_url: 'http://example.com/images/SomeLinux-current.iso'
        media_types:
          - CD
          - DVD
      resource_id: BMC
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
  - name: Eject Virtual Media
    community.general.redfish_command:
      category: Systems
      command: VirtualMediaEject
      baseuri: "{{ baseuri }}"
      username: "{{ username }}"
      password: "{{ password }}"
      virtual_media:
        image_url: 'http://example.com/images/SomeLinux-current.iso'
      resource_id: 1
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
  - name: Eject Virtual Media
    community.general.redfish_command:
      category: Manager
      command: VirtualMediaEject
      baseuri: "{{ baseuri }}"
      username: "{{ username }}"
      password: "{{ password }}"
      virtual_media:
        image_url: 'http://example.com/images/SomeLinux-current.iso'
      resource_id: BMC
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
  - name: Restart manager power gracefully
    community.general.redfish_command:
      category: Manager
      command: GracefulRestart
      resource_id: BMC
      baseuri: "{{ baseuri }}"
      username: "{{ username }}"
      password: "{{ password }}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
  - name: Restart manager power gracefully
    community.general.redfish_command:
      category: Manager
      command: PowerGracefulRestart
      resource_id: BMC
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
  - name: Turn manager power off
    community.general.redfish_command:
      category: Manager
      command: PowerForceOff
      resource_id: BMC
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
  - name: Restart manager power forcefully
    community.general.redfish_command:
      category: Manager
      command: PowerForceRestart
      resource_id: BMC
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
  - name: Shutdown manager power gracefully
    community.general.redfish_command:
      category: Manager
      command: PowerGracefulShutdown
      resource_id: BMC
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
  - name: Turn manager power on
    community.general.redfish_command:
      category: Manager
      command: PowerOn
      resource_id: BMC
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
  - name: Reboot manager power
    community.general.redfish_command:
      category: Manager
      command: PowerReboot
      resource_id: BMC
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
  - name: Verify BIOS attributes
    community.general.redfish_command:
      category: Systems
      command: VerifyBiosAttributes
      baseuri: "{{ baseuri }}"
      username: "{{ username }}"
      password: "{{ password }}"
      bios_attributes:
        SubNumaClustering: "Disabled"
        WorkloadProfile: "Virtualization-MaxPerformance"

Inputs

    
id:
    aliases:
    - account_id
    description:
    - ID of account to delete/modify.
    - Can also be used in account creation to work around vendor issues where the ID of
      the new user is required in the POST request.
    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.
    elements: str
    required: true
    type: list

timeout:
    description:
    - Timeout in seconds for HTTP requests to OOB controller.
    - The default value for this param is C(10) but that is being deprecated and it will
      be replaced with C(60) in community.general 9.0.0.
    type: int

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

password:
    description:
    - Password for authenticating to OOB controller.
    type: str

username:
    description:
    - Username for authenticating to OOB controller.
    type: str

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

auth_token:
    description:
    - Security token for authenticating to OOB controller.
    type: str
    version_added: 2.3.0
    version_added_collection: community.general

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

resource_id:
    description:
    - ID of the System, Manager or Chassis to modify.
    required: false
    type: str
    version_added: 0.2.0
    version_added_collection: community.general

session_uri:
    description:
    - URI of the session resource.
    type: str
    version_added: 2.3.0
    version_added_collection: community.general

uefi_target:
    description:
    - UEFI boot 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:
    - Credentials for retrieving the update image.
    required: false
    suboptions:
      password:
        description:
        - Password for retrieving the update image.
        required: false
        type: str
      username:
        description:
        - Username for retrieving the update image.
        required: false
        type: str
    type: dict
    version_added: 0.2.0
    version_added_collection: community.general

account_types:
    aliases:
    - account_accounttypes
    description:
    - Array of account types to apply to a user account.
    elements: str
    required: false
    type: list
    version_added: 7.2.0
    version_added_collection: community.general

update_handle:
    description:
    - Handle to check the status of an update in progress.
    required: false
    type: str
    version_added: 6.1.0
    version_added_collection: community.general

virtual_media:
    description:
    - Options for VirtualMedia commands.
    required: false
    suboptions:
      image_url:
        description:
        - URL of the image to insert or eject.
        required: false
        type: str
      inserted:
        default: true
        description:
        - Indicates that the image is treated as inserted on command completion.
        required: false
        type: bool
      media_types:
        default: []
        description:
        - List of media types appropriate for the image.
        elements: str
        required: false
        type: list
      password:
        description:
        - Password for accessing the image URL.
        required: false
        type: str
      transfer_method:
        description:
        - Transfer method to use with the image.
        required: false
        type: str
      transfer_protocol_type:
        description:
        - Network protocol to use with the image.
        required: false
        type: str
      username:
        description:
        - Username for accessing the image URL.
        required: false
        type: str
      write_protected:
        default: true
        description:
        - Indicates that the media is treated as write-protected.
        required: false
        type: bool
    type: dict
    version_added: 0.2.0
    version_added_collection: community.general

update_targets:
    default: []
    description:
    - List of target resource URIs to apply the update to.
    elements: str
    required: false
    type: list
    version_added: 0.2.0
    version_added_collection: community.general

bios_attributes:
    description:
    - BIOS attributes that needs to be verified in the given server.
    required: false
    type: dict
    version_added: 6.4.0
    version_added_collection: community.general

update_protocol:
    description:
    - Protocol for the update.
    required: false
    type: str
    version_added: 0.2.0
    version_added_collection: community.general

update_username:
    aliases:
    - account_updatename
    description:
    - New user name for updating account_username.
    required: false
    type: str
    version_added: 0.2.0
    version_added_collection: community.general

update_image_uri:
    description:
    - URI of the image for the update.
    required: false
    type: str
    version_added: 0.2.0
    version_added_collection: community.general

oem_account_types:
    aliases:
    - account_oemaccounttypes
    description:
    - Array of OEM account types to apply to a user account.
    elements: str
    required: false
    type: list
    version_added: 7.2.0
    version_added_collection: community.general

strip_etag_quotes:
    default: false
    description:
    - Removes surrounding quotes of etag used in C(If-Match) header of C(PATCH) requests.
    - Only use this option to resolve bad vendor implementation where C(If-Match) only
      matches the unquoted etag string.
    type: bool
    version_added: 3.7.0
    version_added_collection: community.general

update_apply_time:
    choices:
    - Immediate
    - OnReset
    - AtMaintenanceWindowStart
    - InMaintenanceWindowOnReset
    - OnStartUpdateRequest
    description:
    - Time when to apply the update.
    required: false
    type: str
    version_added: 6.1.0
    version_added_collection: community.general

update_image_file:
    description:
    - Filename, with optional path, of the image for the update.
    required: false
    type: path
    version_added: 7.1.0
    version_added_collection: community.general

update_oem_params:
    description:
    - Properties for HTTP Multipart Push Updates.
    required: false
    type: dict
    version_added: 7.5.0
    version_added_collection: community.general

account_properties:
    default: {}
    description:
    - Properties of account service to update.
    required: false
    type: dict
    version_added: 0.2.0
    version_added_collection: community.general

boot_override_mode:
    choices:
    - Legacy
    - UEFI
    description:
    - Boot mode when using an override.
    type: str
    version_added: 3.5.0
    version_added_collection: community.general

Outputs

msg:
  description: Message with action result or error description
  returned: always
  sample: Action was successful
  type: str
return_values:
  description: Dictionary containing command-specific response data from the action.
  returned: on success
  sample:
    update_status:
      handle: /redfish/v1/TaskService/TaskMonitors/735
      messages: []
      resets_requested: []
      ret: true
      status: New
  type: dict
  version_added: 6.1.0
  version_added_collection: community.general