community.general.ocapi_command module – Manages Out-Of-Band controllers using Open Composable API (OCAPI)
Note
This module is part of the community.general collection (version 10.7.5).
You might already have this collection installed if you are using the ansible package.
It is not included in ansible-core.
To check whether it is installed, run ansible-galaxy collection list.
To install it, use: ansible-galaxy collection install community.general.
To use it in a playbook, specify: community.general.ocapi_command.
New in community.general 6.3.0
Synopsis
- 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. 
Parameters
| Parameter | Comments | 
|---|---|
| Base URI of OOB controller. | |
| Category to execute on OOB controller. | |
| Command to execute on OOB controller. | |
| For  | |
| Password for authenticating to OOB controller. | |
| For proxied inband requests, the slot number of the IOM. Only applies if  | |
| Timeout in seconds for URL requests to OOB controller. Default:  | |
| For  | |
| Username for authenticating to OOB controller. | 
Attributes
| Attribute | Support | Description | 
|---|---|---|
| Support: full | Can run in  | |
| Support: none | Will return details on what has changed (or possibly needs changing in  | 
Examples
- name: Set the power state to low
  community.general.ocapi_command:
    category: Chassis
    command: PowerModeLow
    baseuri: "{{ baseuri }}"
    username: "{{ username }}"
    password: "{{ password }}"
- name: Set the power state to normal
  community.general.ocapi_command:
    category: Chassis
    command: PowerModeNormal
    baseuri: "{{ baseuri }}"
    username: "{{ username }}"
    password: "{{ password }}"
- 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 }}"
- 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 }}"
- name: Reset Enclosure
  community.general.ocapi_command:
    category: Systems
    command: PowerGracefulRestart
    baseuri: "{{ baseuri }}"
    proxy_slot_number: 2
    username: "{{ username }}"
    password: "{{ password }}"
- 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"
- name: Firmware Update
  community.general.ocapi_command:
    category: Update
    command: FWUpdate
    baseuri: "iom1.wdc.com"
    proxy_slot_number: 2
    username: "{{ username }}"
    password: "{{ password }}"
- name: Firmware Activate
  community.general.ocapi_command:
    category: Update
    command: FWActivate
    baseuri: "iom1.wdc.com"
    proxy_slot_number: 2
    username: "{{ username }}"
    password: "{{ password }}"
- name: Delete Job
  community.general.ocapi_command:
    category: Jobs
    command: DeleteJob
    job_name: FirmwareUpdate
    baseuri: "{{ baseuri }}"
    proxy_slot_number: 2
    username: "{{ username }}"
    password: "{{ password }}"
Return Values
Common return values are documented here, the following are the fields unique to this module:
| Key | Description | 
|---|---|
| URI to use to monitor status of the operation. Returned for async commands such as Firmware Update, Firmware Activate. Returned: when supported Sample:  | |
| Message with action result or error description. Returned: always Sample:  | |
| OCAPI State ID (see OCAPI documentation for possible values). Returned: when supported Sample:  | 
