community.general.ocapi_command (8.5.0) — module

Manages Out-Of-Band controllers using Open Composable API (OCAPI)

| "added in version" 6.3.0 of community.general"

Authors: Mike Moerk (@mikemoerk)

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 OCAPI URIs locally and sends them to remote OOB controllers to perform an action.

Manages OOB controller such as Indicator LED, Reboot, Power Mode, Firmware Update.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
  - name: Set the power state to low
    community.general.ocapi_command:
      category: Chassis
      command: PowerModeLow
      baseuri: "{{ baseuri }}"
      username: "{{ username }}"
      password: "{{ password }}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
  - name: Set the power state to normal
    community.general.ocapi_command:
      category: Chassis
      command: PowerModeNormal
      baseuri: "{{ baseuri }}"
      username: "{{ username }}"
      password: "{{ password }}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
  - name: Set chassis indicator LED to on
    community.general.ocapi_command:
      category: Chassis
      command: IndicatorLedOn
      baseuri: "{{ baseuri }}"
      proxy_slot_number: 2
      username: "{{ username }}"
      password: "{{ password }}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
  - name: Set chassis indicator LED to off
    community.general.ocapi_command:
      category: Chassis
      command: IndicatorLedOff
      baseuri: "{{ baseuri }}"
      proxy_slot_number: 2
      username: "{{ username }}"
      password: "{{ password }}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
  - name: Reset Enclosure
    community.general.ocapi_command:
      category: Systems
      command: PowerGracefulRestart
      baseuri: "{{ baseuri }}"
      proxy_slot_number: 2
      username: "{{ username }}"
      password: "{{ password }}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
  - name: Firmware Upload
    community.general.ocapi_command:
      category: Update
      command: FWUpload
      baseuri: "iom1.wdc.com"
      proxy_slot_number: 2
      username: "{{ username }}"
      password: "{{ password }}"
      update_image_path: "/path/to/firmware.tar.gz"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
  - name: Firmware Update
    community.general.ocapi_command:
      category: Update
      command: FWUpdate
      baseuri: "iom1.wdc.com"
      proxy_slot_number: 2
      username: "{{ username }}"
      password: "{{ password }}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
  - name: Firmware Activate
    community.general.ocapi_command:
      category: Update
      command: FWActivate
      baseuri: "iom1.wdc.com"
      proxy_slot_number: 2
      username: "{{ username }}"
      password: "{{ password }}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
  - name: Delete Job
    community.general.ocapi_command:
      category: Jobs
      command: DeleteJob
      job_name: FirmwareUpdate
      baseuri: "{{ baseuri }}"
      proxy_slot_number: 2
      username: "{{ username }}"
      password: "{{ password }}"

Inputs

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

command:
    description:
    - Command to execute on OOB controller.
    required: true
    type: str

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

job_name:
    description:
    - For O(command=DeleteJob) command, the name of the job to delete.
    required: false
    type: str

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

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

proxy_slot_number:
    description: For proxied inband requests, the slot number of the IOM.  Only applies
      if O(baseuri) is a proxy server.
    type: int

update_image_path:
    description:
    - For O(command=FWUpload), the path on the local filesystem of the firmware update
      image.
    required: false
    type: str

Outputs

jobUri:
  description: URI to use to monitor status of the operation.  Returned for async
    commands such as Firmware Update, Firmware Activate.
  returned: when supported
  sample: https://ioma.wdc.com/Storage/Devices/openflex-data24-usalp03020qb0003/Jobs/FirmwareUpdate/
  type: str
msg:
  description: Message with action result or error description.
  returned: always
  sample: Action was successful
  type: str
operationStatusId:
  description: OCAPI State ID (see OCAPI documentation for possible values).
  returned: when supported
  sample: 2
  type: int