ansible.builtin.intersight_rest_api (v2.9.13) — module

REST API configuration for Cisco Intersight

| "added in version" 2.8 of ansible.builtin"

Authors: David Soper (@dsoper2), CiscoUcs (@CiscoUcs)

preview | supported by community

Install Ansible via pip

Install with pip install ansible==2.9.13

Description

Direct REST API configuration for Cisco Intersight.

All REST API resources and properties must be specified.

For more information see L(Cisco Intersight,https://intersight.com/apidocs).

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Configure Boot Policy
  intersight_rest_api:
    api_private_key: "{{ api_private_key }}"
    api_key_id: "{{ api_key_id }}"
    api_key_uri: "{{ api_key_uri }}"
    validate_certs: "{{ validate_certs }}"
    resource_path: /boot/PrecisionPolicies
    query_params:
      $filter: "Name eq 'vmedia-localdisk'"
    api_body: {
      "Name": "vmedia-hdd",
      "ConfiguredBootMode": "Legacy",
      "BootDevices": [
        {
          "ObjectType": "boot.VirtualMedia",
          "Enabled": true,
          "Name": "remote-vmedia",
          "Subtype": "cimc-mapped-dvd"
        },
        {
          "ObjectType": "boot.LocalDisk",
          "Enabled": true,
          "Name": "localdisk",
          "Slot": "MRAID",
          "Bootloader": null
        }
      ],
    }
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Delete Boot Policy
  intersight_rest_api:
    api_private_key: "{{ api_private_key }}"
    api_key_id: "{{ api_key_id }}"
    api_key_uri: "{{ api_key_uri }}"
    validate_certs: "{{ validate_certs }}"
    resource_path: /boot/PrecisionPolicies
    query_params:
      $filter: "Name eq 'vmedia-localdisk'"
    state: absent

Inputs

    
state:
    choices:
    - present
    - absent
    default: present
    description:
    - 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.

api_uri:
    default: https://intersight.com/api/v1
    description:
    - URI used to access the Intersight API.
    - If not set, the value of the INTERSIGHT_API_URI environment variable is used.
    type: str

api_body:
    description:
    - The payload for API requests used to modify resources.
    type: dict

use_proxy:
    default: true
    description:
    - If C(no), it will not use a proxy, even if one is defined in an environment variable
      on the target hosts.
    type: bool

api_key_id:
    description:
    - 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: true
    type: str

query_params:
    description:
    - Query parameters for the Intersight API query language.
    type: dict

resource_path:
    description:
    - Resource URI being configured related to api_uri.
    required: true
    type: str

update_method:
    choices:
    - patch
    - post
    default: patch
    description:
    - The HTTP method used for update operations.
    - Some Intersight resources require POST operations for modifications.
    type: str

validate_certs:
    default: true
    description:
    - Boolean control for verifying the api_uri TLS certificate
    type: bool

api_private_key:
    description:
    - 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-----
    - '    <your private key data>'
    - '    -----END EC PRIVATE KEY-----'''
    - If not set, the value of the INTERSIGHT_API_PRIVATE_KEY environment variable is
      used.
    required: true
    type: str

Outputs

api_repsonse:
  description: The API response output returned by the specified resource.
  returned: always
  sample:
    api_response:
      BootDevices:
      - Enabled: true
        Name: remote-vmedia
        ObjectType: boot.VirtualMedia
        Subtype: cimc-mapped-dvd
      - Bootloader: null
        Enabled: true
        Name: boot-lun
        ObjectType: boot.LocalDisk
        Slot: MRAID
      ConfiguredBootMode: Legacy
      Name: vmedia-localdisk
      ObjectType: boot.PrecisionPolicy
  type: dict