community.general.spectrum_model_attrs (8.5.0) — module

Enforce a model's attributes in CA Spectrum

| "added in version" 2.5.0 of community.general"

Authors: Tyler Gates (@tgates81)

Install collection

Install with ansible-galaxy collection install community.general:==8.5.0


Add to requirements.yml

  collections:
    - name: community.general
      version: 8.5.0

Description

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

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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

Inputs

    
url:
    description:
    - URL of OneClick server.
    required: true
    type: str

name:
    description:
    - Model name.
    required: true
    type: str

type:
    description:
    - Model type.
    required: true
    type: str

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

attributes:
    description:
    - A list of attribute names and values to enforce.
    - All values and parameters are case sensitive and must be provided as strings only.
    elements: dict
    required: true
    suboptions:
      name:
        description:
        - Attribute name OR hex ID.
        - 'Currently defined names are:'
        - '                 C(App_Manufacturer) (C(0x230683))'
        - '                 C(CollectionsModelNameString) (C(0x12adb))'
        - '                 C(Condition) (C(0x1000a))'
        - '                 C(Criticality) (C(0x1290c))'
        - '                 C(DeviceType) (C(0x23000e))'
        - '                 C(isManaged) (C(0x1295d))'
        - '                 C(Model_Class) (C(0x11ee8))'
        - '                 C(Model_Handle) (C(0x129fa))'
        - '                 C(Model_Name) (C(0x1006e))'
        - '                 C(Modeltype_Handle) (C(0x10001))'
        - '                 C(Modeltype_Name) (C(0x10000))'
        - '                 C(Network_Address) (C(0x12d7f))'
        - '                 C(Notes) (C(0x11564))'
        - '                 C(ServiceDesk_Asset_ID) (C(0x12db9))'
        - '                 C(TopologyModelNameString) (C(0x129e7))'
        - '                 C(sysDescr) (C(0x10052))'
        - '                 C(sysName) (C(0x10b5b))'
        - '                 C(Vendor_Name) (C(0x11570))'
        - '                 C(Description) (C(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.'
        required: true
        type: str
      value:
        description:
        - Attribute value. Empty strings should be V("") or V(null).
        required: true
        type: str
    type: list

url_password:
    aliases:
    - password
    description:
    - OneClick password.
    required: true
    type: str

url_username:
    aliases:
    - username
    description:
    - OneClick username.
    required: true
    type: str

validate_certs:
    default: true
    description:
    - Validate SSL certificates. Only change this to V(false) if you can guarantee that
      you are talking to the correct endpoint and there is no man-in-the-middle attack
      happening.
    required: false
    type: bool

Outputs

changed_attrs:
  description: 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'
  type: dict
msg:
  description: Informational message on the job result.
  returned: always
  sample: Success
  type: str