cisco.intersight.intersight_resource_group module – Resource Group configuration for Cisco Intersight

Note

This module is part of the cisco.intersight collection (version 2.18.0).

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 cisco.intersight.

To use it in a playbook, specify: cisco.intersight.intersight_resource_group.

Synopsis

  • Manages Resource Group configuration on Cisco Intersight.

  • Resource Groups define a set of resources that can be used for access control and organization assignment.

  • Users specify Intersight-managed UCS domains by their target name (as shown in the Intersight Targets page).

  • Optionally, specific servers (sub-targets) within a domain can be selected by serial number.

  • Resource Groups are account-level resources and are not scoped to an organization.

  • For more information see Cisco Intersight.

Parameters

Parameter

Comments

api_key_id

string / required

Public API Key ID associated with the private key.

If not set, the value of the INTERSIGHT_API_KEY_ID environment variable is used.

api_private_key

path / required

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.

api_uri

string

URI used to access the Intersight API.

If not set, the value of the INTERSIGHT_API_URI environment variable is used.

Default: "https://intersight.com/api/v1"

description

aliases: descr

string

The user-defined description for the Resource Group.

name

string / required

The name assigned to the Resource Group.

The name must be between 1 and 62 alphanumeric characters, allowing special characters :-_.

resources

list / elements=dictionary

List of Intersight-managed UCS domain resources to include in the Resource Group.

Required when state is present.

Each entry specifies a domain by its target name as shown in the Intersight GUI Targets page.

When resources[].sub_targets is provided, only the specified servers (by serial number) are included instead of the full domain.

Multiple entries can be mixed, some with sub-targets and some without.

domain_name

string / required

The name of the Intersight-managed UCS domain target.

Must match the target name exactly as displayed in the Intersight Targets page.

sub_targets

list / elements=string

List of server serial numbers to include as sub-targets within the domain.

When specified, only these servers are included instead of the entire domain.

Servers are automatically classified as Blades or RackUnits via the Intersight API.

state

string

If present, will verify the resource is present and will create if needed.

If absent, will verify the resource is absent and will delete if needed.

Choices:

  • "present" ← (default)

  • "absent"

tags

list / elements=dictionary

List of tags in Key:<user-defined key> Value:<user-defined value> format.

use_proxy

boolean

If no, it will not use a proxy, even if one is defined in an environment variable on the target hosts.

Choices:

  • false

  • true ← (default)

validate_certs

boolean

Boolean control for verifying the api_uri TLS certificate

Choices:

  • false

  • true ← (default)

Examples

- name: Create Resource Group for full UCS domains
  cisco.intersight.intersight_resource_group:
    api_private_key: "{{ api_private_key }}"
    api_key_id: "{{ api_key_id }}"
    name: "ucs-domains-group"
    description: "Resource group for two UCS domains"
    resources:
      - domain_name: "ucs-domain-1"
      - domain_name: "ucs-domain-2"
    state: present

- name: Create Resource Group with sub-targets (specific servers)
  cisco.intersight.intersight_resource_group:
    api_private_key: "{{ api_private_key }}"
    api_key_id: "{{ api_key_id }}"
    name: "specific-servers-group"
    description: "Only specific servers from the domain"
    resources:
      - domain_name: "ucs-domain-1"
        sub_targets:
          - "FCH26387BD1"
          - "FCH243974ZD"
          - "WZP26030TAV"
    state: present

- name: Create Resource Group with mixed resources
  cisco.intersight.intersight_resource_group:
    api_private_key: "{{ api_private_key }}"
    api_key_id: "{{ api_key_id }}"
    name: "mixed-resources-group"
    description: "Full domain and specific servers from another"
    resources:
      - domain_name: "ucs-domain-1"
      - domain_name: "ucs-domain-2"
        sub_targets:
          - "FCH26387BD1"
          - "WZP26030TAV"
    state: present

- name: Delete Resource Group
  cisco.intersight.intersight_resource_group:
    api_private_key: "{{ api_private_key }}"
    api_key_id: "{{ api_key_id }}"
    name: "ucs-domains-group"
    state: absent

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

api_response

dictionary

The API response output returned by the specified resource.

Returned: always

Sample: {"api_response": {"Description": "Resource group for two UCS domains", "Moid": "507f1f77bcf86cd799439099", "Name": "ucs-domains-group", "ObjectType": "resource.Group"}}

Authors

  • Ron Gershburg (@rgershbu)