intersight_rest_api
REST API configuration for Cisco Intersight
Collection: cisco.intersight
Full Name: cisco.intersight.intersight_rest_api
Synopsis
REST API configuration for Cisco Intersight
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| api_private_key | string | Filename (absolute path) or string of PEM formatted private key data to be used for Intersight API authentication. If a string is used, Ansible vault should be used to encrypt string data. Ex. ansible-vault encrypt_string –vault-id tme@/Users/dsoper/Documents/vault_password_file ‘—–BEGIN EC PRIVATE KEY—– | ||
| api_uri | string | https://intersight.com/api/v1 | URI used to access the Intersight API. If not set, the value of the INTERSIGHT_API_URI environment variable is used. | |
| api_key_id | string | Public API Key ID associated with the private key. If not set, the value of the INTERSIGHT_API_KEY_ID environment variable is used. Required if I(api_bearer_token) is not provided. | ||
| api_bearer_token | string | Bearer token for OAuth2 authentication with the Intersight API. When provided, I(api_key_id) and I(api_private_key) are not required and the C(cryptography) Python library is not needed. If not set, the value of the INTERSIGHT_API_BEARER_TOKEN environment variable is used. Secret value; omitted from logs and results. | ||
| validate_certs | bool | true | Boolean control for verifying the api_uri TLS certificate | |
| use_proxy | bool | true | If C(no), it will not use a proxy, even if one is defined in an environment variable on the target hosts. | |
| resource_path | string | yes | Resource URI being configured related to api_uri. | |
| query_params | dict | Query parameters for the Intersight API query languange. | ||
| update_method | string | patch | The HTTP method used for update operations. Some Intersight resources require POST operations for modifications. json-patch is used for partial updates. json-patch is only supported for patch operations on existing resources and requires the list_body to be a list of dictionaries. See L(The Intersight API Docs, https://intersight.com/apidocs/introduction/methods/) for details on JSON Patch. Choices: patch, post, json-patch | |
| api_body | dict | The paylod for API requests used to modify resources. | ||
| list_body | list | The paylod for API requests used to modify resources. Should be used instead of api_body if a list is required in the API payload. | ||
| return_list | bool | false | If C(yes), will return a list of API results in the api_response. By default only the 1st element of the API Results list is returned. Can only be used with GET operations. | |
| state | string | present | If C(present), will verify the resource is present and will create if needed. If C(absent), will verify the resource is absent and will delete if needed. Choices: absent, present |
Example
yaml
- intersight_rest_api:
api_body:
BootDevices:
- Enabled: true
Name: remote-vmedia
ObjectType: boot.VirtualMedia
Subtype: cimc-mapped-dvd
- Bootloader: null
Enabled: true
Name: localdisk
ObjectType: boot.LocalDisk
Slot: MRAID
ConfiguredBootMode: Legacy
Name: vmedia-localdisk
api_key_id: '{{ api_key_id }}'
api_key_uri: '{{ api_key_uri }}'
api_private_key: '{{ api_private_key }}'
query_params:
$filter: Name eq 'vmedia-localdisk'
resource_path: /boot/PrecisionPolicies
state: present
validate_certs: '{{ validate_certs }}'
name: Configure Boot Policy
- intersight_rest_api:
api_key_id: '{{ api_key_id }}'
api_key_uri: '{{ api_key_uri }}'
api_private_key: '{{ api_private_key }}'
query_params:
$filter: Name eq 'vmedia-localdisk'
resource_path: /boot/PrecisionPolicies
state: absent
validate_certs: '{{ validate_certs }}'
name: Delete Boot Policy