Skip to content

Latest commit

 

History

History
705 lines (652 loc) · 34.4 KB

servicenow.itsm.configuration_item_module.rst

File metadata and controls

705 lines (652 loc) · 34.4 KB

servicenow.itsm.configuration_item module -- Manage ServiceNow configuration items

This module is part of the servicenow.itsm collection (version 2.7.0).

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 servicenow.itsm.

To use it in a playbook, specify: servicenow.itsm.configuration_item.

New in servicenow.itsm 1.0.0

Parameter

Comments

asset_tag

string

Asset tag of the asset logically related to this configuration item.

Read more about the relationship between configuration items and assets at https://docs.servicenow.com/bundle/tokyo-it-asset-management/page/product/asset-management/concept/c_ManagingAssets.html.

assigned_to

string

A person to whom this configuration item is assigned to.

Expected value for assigned_to is user id (usually in the form of first_name.last_name).

attachments

list / elements=dictionary

added in servicenow.itsm 1.2.0

ServiceNow attachments.

name

string

Name of the file to be uploaded.

Serves as unique identifier.

If not specified, the module will use path's base name.

path

string / required

Path to the file to be uploaded.

type

string

MIME type of the file to be attached.

If not specified, the module will try to guess the file's type from its extension.

category

string

Category of the configuration item, for instance Hardware.

configuration_item_mapping

dictionary

added in servicenow.itsm 1.3.0

User mappings for Configuration item object.

Where mapping is not set, the default will be used.

environment

dictionary

The environment to which this configuration item belongs.

install_status

dictionary

The functional status of the configuration item.

Special value that can not be overridden is absent, which would remove a configuration item from ServiceNow.

operational_status

dictionary

The operational status of the configuration item.

environment

string

The environment to which this configuration item belongs.

Default choices are development, production, test, One can override them by setting configuration_item_mapping.environment.

install_status

string

The functional status of the configuration item.

Default choices are implementing, installed, on_order, in_maintenance, pending_install, pending_repair, in_stock, retired, stolen, absent. One can override them by setting configuration_item_mapping.install_status.

instance

dictionary

ServiceNow instance information.

access_token

string

added in servicenow.itsm 2.3.0

Access token obtained via OAuth authentication.

If not set, the value of the SN_ACCESS_TOKEN environment variable will be used.

api_path

string

added in servicenow.itsm 2.4.0

Change the API endpoint of SNOW instance from default 'api/now'.

Default: "api/now"

client_id

string

ID of the client application used for OAuth authentication.

If not set, the value of the SN_CLIENT_ID environment variable will be used.

If provided, it requires client_secret.

client_secret

string

Secret associated with client_id. Used for OAuth authentication.

If not set, the value of the SN_CLIENT_SECRET environment variable will be used.

If provided, it requires client_id.

custom_headers

dictionary

added in servicenow.itsm 2.4.0

A dictionary containing any extra headers which will be passed with the request.

grant_type

string

added in servicenow.itsm 1.1.0

Grant type used for OAuth authentication.

If not set, the value of the SN_GRANT_TYPE environment variable will be used.

Since version 2.3.0, it no longer has a default value in the argument specifications.

If not set by any means, the default value (that is, password) will be set internally to preserve backwards compatibility.

Choices:

  • "password"

  • "refresh_token"

host

string / required

The ServiceNow host name.

If not set, the value of the SN_HOST environment variable will be used.

password

string

Password used for authentication.

If not set, the value of the SN_PASSWORD environment variable will be used.

Required when using basic authentication or when grant_type=password.

refresh_token

string

added in servicenow.itsm 1.1.0

Refresh token used for OAuth authentication.

If not set, the value of the SN_REFRESH_TOKEN environment variable will be used.

Required when grant_type=refresh_token.

timeout

float

Timeout in seconds for the connection with the ServiceNow instance.

If not set, the value of the SN_TIMEOUT environment variable will be used.

username

string

Username used for authentication.

If not set, the value of the SN_USERNAME environment variable will be used.

Required when using basic authentication or when grant_type=password.

validate_certs

boolean

added in servicenow.itsm 2.3.0

If host's certificate is validated or not.

Choices:

  • false

  • true ← (default)

ip_address

string

Primary IP address used by the configuration item.

mac_address

string

MAC address of the configuration item.

name

string

The name of the configuration item.

Required if the configuration item does not yet exist.

operational_status

string

The operational status of the configuration item.

Default choices are operational, non_operational, repair_in_progress, dr_standby, ready, retired, pipeline, catalog. One can override them by setting configuration_item_mapping.operational_status.

other

dictionary

Any of the remaining configuration parameters.

For the attributes of the base cmdb_ci table, refer to the ServiceNow documentation on https://docs.servicenow.com/bundle/tokyo-servicenow-platform/page/product/configuration-management/reference/cmdb-table-property-descriptions.html.

For the attributes of configuration items specific to sys_class_name, please consult the relevant ServiceNow documentation.

serial_number

string

Serial number of the configuration item.

short_description

string

Short description of the configuration item.

state

string

State of the configuration item.

Choices:

  • "present" ← (default)

  • "absent"

sys_class_name

string

ServiceNow configuration item class.

The value of this parameter should point to a ServiceNow CMDB configuration item table, for instance cmdb_ci_server.

For a list of valid CMDB tables, refer to ServiceNow documentation on https://docs.servicenow.com/bundle/tokyo-servicenow-platform/page/product/configuration-management/reference/cmdb-tables-details.html.

If this parameter is unset when a new configuration item needs to be created, the default value cmdb_ci will be used.

sys_id

string

Unique identifier of the record to operate on.

- name: Create a configuration item
  servicenow.itsm.configuration_item:
    name: HPE ProLiant BL465C G7
    short_description: HPE ProLiant Server G7
    serial_number: ECE-164-E10834-NO
    asset_tag: P1000613
    sys_class_name: cmdb_ci_server
    assigned_to: some.user
    environment: production
    category: Hardware
    attachments:
      - path: path/to/attachment.txt
    other:
      model_number: BL465C G7
  register: server

- name: Update a configuration item
  servicenow.itsm.configuration_item:
    sys_id: "{{ server.record.sys_id }}"
    install_status: in_maintenance
    operational_status: repair_in_progress
    other:
      fault_count: 1
      classification: Development

- name: Delete a configuration item
  servicenow.itsm.configuration_item:
    sys_id: "{{ server.record.sys_id }}"
    state: absent

The following are the fields unique to this module:

Key

Description

record

dictionary

The configuration item record.

Note that the fields of the returned record depend on the configuration item's sys_class_name.

Returned: success

Sample: {"asset": "05a9ec0d3790200044e0bfc8bcbe5dc2", "asset_tag": "P1000440", "assigned": "2019-02-28 08:00:00", "assigned_to": "8a826bf03710200044e0bfc8bcbe5d96", "assignment_group": "", "attachments": [{"average_image_color": "", "chunk_size_bytes": "700000", "compressed": "true", "content_type": "text/plain", "download_link": "https://www.example.com/api/now/attachment/919d34d50706301022f9ffa08c1ed047/file", "file_name": "sample_file1.txt", "hash": "6f2b0dec698566114435a23f15dcac848a40e1fd3e0eda4afe24a663dda23f2e", "image_height": "", "image_width": "", "size_bytes": "210", "size_compressed": "206", "state": "pending", "sys_created_by": "admin", "sys_created_on": "2021-08-17 11:18:58", "sys_id": "919d34d50706301022f9ffa08c1ed047", "sys_mod_count": "0", "sys_tags": "", "sys_updated_by": "admin", "sys_updated_on": "2021-08-17 11:18:58", "table_name": "cmdb_ci", "table_sys_id": "459d34d50706301022f9ffa08c1ed06a"}], "attestation_score": "", "attested": "false", "attested_by": "", "attested_date": "", "attributes": "", "can_print": "false", "category": "Hardware", "change_control": "", "checked_in": "", "checked_out": "", "comments": "", "company": "81fca4cbac1d55eb355b4b6db0e3c80f", "correlation_id": "", "cost": "1699.99", "cost_cc": "USD", "cost_center": "d9d01546c0a80a6403e18b82250c80a1", "delivery_date": "2018-07-05 07:00:00", "department": "a581ab703710200044e0bfc8bcbe5de8", "discovery_source": "", "dns_domain": "", "due": "", "due_in": "", "duplicate_of": "", "environment": "", "fault_count": "0", "first_discovered": "", "fqdn": "", "gl_account": "", "install_date": "2018-10-02 07:00:00", "install_status": "installed", "invoice_number": "", "ip_address": "", "justification": "", "last_discovered": "", "lease_id": "", "life_cycle_stage": "", "life_cycle_stage_status": "", "location": "8228cda2ac1d55eb7029baf443945c37", "mac_address": "", "maintenance_schedule": "", "managed_by": "", "managed_by_group": "", "manufacturer": "aa0a6df8c611227601cd2ed45989e0ac", "model_id": "0c43b858c611227501522de20c61ac75", "model_number": "", "monitor": "false", "name": "ThinkStation S20", "operational_status": "operational", "order_date": "2018-06-07 07:00:00", "owned_by": "", "po_number": "PO100005", "purchase_date": "2018-06-22", "schedule": "", "serial_number": "WCL-206-Q10853-BF", "short_description": "", "skip_sync": "false", "start_date": "", "subcategory": "Computer", "support_group": "", "supported_by": "", "sys_class_name": "cmdb_ci_computer", "sys_class_path": "/!!/!2/!(", "sys_created_by": "admin", "sys_created_on": "2012-02-18 08:14:42", "sys_domain": "global", "sys_domain_path": "/", "sys_id": "01a9ec0d3790200044e0bfc8bcbe5dc3", "sys_mod_count": "6", "sys_tags": "", "sys_updated_by": "system", "sys_updated_on": "2021-01-16 05:50:31", "unverified": "false", "vendor": "aa0a6df8c611227601cd2ed45989e0ac", "warranty_expiration": "2021-10-01"}

Authors

  • Manca Bizjak (@mancabizjak)
  • Miha Dolinar (@mdolin)
  • Tadej Borovsak (@tadeboro)
  • Matej Pevec (@mysteriouswolf)
  • Polona Mihalič (@PolonaM)

Collection links