configuration_item – Manage ServiceNow configuration items

Create, delete or update a ServiceNow configuration item.

For more information, refer to the ServiceNow configuration management documentation at https://docs.servicenow.com/bundle/paris-servicenow-platform/page/product/configuration-management/reference/cmdb-table-property-descriptions.html.

New in version 1.0.0.

Examples

- 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

See Also

See also

  • modules/servicenow.itsm.configuration_item_info_module

Parameters

asset_tag (optional)

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/paris-it-asset-management/page/product/asset-management/concept/c_ManagingAssets.html.

type: str
assigned_to (optional)

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

type: str
attachments (optional)

ServiceNow attachments.

type: list
name (optional)

Name of the file to be uploaded without the file extension.

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

type: str
path (required)

Path to the file to be uploaded.

type: str
type (optional)

MIME type of the file to be attached.

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

type: str
category (optional)

Category of the configuration item, for instance Hardware.

type: str
configuration_item_mapping (optional)

User mappings for Configuration item object.

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

type: dict
environment (optional)

The environment to which this configuration item belongs.

type: dict
install_status (optional)

The functional status of the configuration item.

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

type: dict
operational_status (optional)

The operational status of the configuration item.

type: dict
environment (optional)

The environment to which this configuration item belongs.

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

type: str
install_status (optional)

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.

type: str
instance (optional)

ServiceNow instance information.

type: dict
client_id (optional)

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.

type: str
client_secret (optional)

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.

type: str
grant_type (optional)

Grant type used for OAuth authentication.

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

type: str
default: password
choices: password, refresh_token
host (required)

The ServiceNow host name.

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

type: str
password (optional)

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.

type: str
refresh_token (optional)

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.

type: str
timeout (optional)

Timeout in seconds for the connection with the ServiceNow instance.

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

type: float
username (optional)

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.

type: str
ip_address (optional)

Primary IP address used by the configuration item.

type: str
mac_address (optional)

MAC address of the configuration item.

type: str
name (optional)

The name of the configuration item.

Required if the configuration item does not yet exist.

type: str
operational_status (optional)

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.

type: str
other (optional)

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/paris-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.

type: dict
serial_number (optional)

Serial number of the configuration item.

type: str
short_description (optional)

Short description of the configuration item.

type: str
state (optional)

State of the configuration item.

type: str
default: present
choices: present, absent
sys_class_name (optional)

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/paris-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.

type: str
sys_id (optional)

Unique identifier of the record to operate on.

type: str

Return Values

record

The configuration item record.

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

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'