W3cubDocs

/Ansible

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

Note

This plugin is part of the community.general collection (version 3.8.1).

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.spectrum_model_attrs.

New in version 2.5.0: of community.general

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 Choices/Defaults 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
string / required
OneClick password.

aliases: password
url_username
string / required
OneClick username.

aliases: username
use_proxy
boolean
    Choices:
  • no
  • yes
if no, it will not use a proxy, even if one is defined in an environment variable on the target hosts.
validate_certs
boolean
    Choices:
  • no
  • yes
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.

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 Returned Description
changed_attrs
dictionary
always
Dictionary of changed name or hex IDs (whichever was specified) to their new corresponding values.

Sample:
{'Notes': 'MM set on 2021-02-03T22:04:02Z via CO CO9999 by tgates', 'isManaged': 'true'}
msg
string
always
Informational message on the job result.

Sample:
Success


Authors

  • Tyler Gates (@tgates81)

© 2012–2018 Michael DeHaan
© 2018–2021 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/collections/community/general/spectrum_model_attrs_module.html