community.general.spectrum_model_attrs module – Enforce a model’s attributes in CA Spectrum

Note

This module is part of the community.general collection (version 5.8.3).

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. You need further requirements to be able to use this module, see Requirements for details.

To use it in a playbook, specify: community.general.spectrum_model_attrs.

New in community.general 2.5.0

Synopsis

  • This module can be used to enforce a model’s attributes in CA Spectrum.

Requirements

The below requirements are needed on the host that executes this module.

  • python >= 2.7

Parameters

Parameter

Comments

attributes

list / elements=dictionary / required

A list of attribute names and values to enforce.

All values and parameters are case sensitive and must be provided as strings only.

name

string / required

Attribute name OR hex ID.

Currently defined names are:

App_Manufacturer (0x230683)

CollectionsModelNameString (0x12adb)

Condition (0x1000a)

Criticality (0x1290c)

DeviceType (0x23000e)

isManaged (0x1295d)

Model_Class (0x11ee8)

Model_Handle (0x129fa)

Model_Name (0x1006e)

Modeltype_Handle (0x10001)

Modeltype_Name (0x10000)

Network_Address (0x12d7f)

Notes (0x11564)

ServiceDesk_Asset_ID (0x12db9)

TopologyModelNameString (0x129e7)

sysDescr (0x10052)

sysName (0x10b5b)

Vendor_Name (0x11570)

Description (0x230017)

Hex IDs are the direct identifiers in Spectrum and will always work.

To lookup hex IDs go to the UI: Locator -> Devices -> By Model Name -> <enter any model> -> Attributes tab.

value

string / required

Attribute value. Empty strings should be "" or null.

name

string / required

Model name.

type

string / required

Model type.

url

string / required

URL of OneClick server.

url_password

aliases: password

string / required

OneClick password.

url_username

aliases: username

string / required

OneClick username.

use_proxy

boolean

if false, 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

Validate SSL certificates. Only change this to false if you can guarantee that you are talking to the correct endpoint and there is no man-in-the-middle attack happening.

Choices:

  • false

  • true ← (default)

Notes

Note

Examples

- name: Enforce maintenance mode for modelxyz01 with a note about why
  community.general.spectrum_model_attrs:
    url: "http://oneclick.url.com"
    username: "{{ oneclick_username }}"
    password: "{{ oneclick_password }}"
    name: "modelxyz01"
    type: "Host_Device"
    validate_certs: true
    attributes:
      - name: "isManaged"
        value: "false"
      - name: "Notes"
        value: "MM set on {{ ansible_date_time.iso8601 }} via CO {{ CO }} by {{ tower_user_name | default(ansible_user_id) }}"
  delegate_to: localhost
  register: spectrum_model_attrs_status

Return Values

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

Key

Description

changed_attrs

dictionary

Dictionary of changed name or hex IDs (whichever was specified) to their new corresponding values.

Returned: always

Sample: {"Notes": "MM set on 2021-02-03T22:04:02Z via CO CO9999 by tgates", "isManaged": "true"}

msg

string

Informational message on the job result.

Returned: always

Sample: "Success"

Authors

  • Tyler Gates (@tgates81)