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
- Create, delete or update a ServiceNow configuration item.
- Configuration items can be managed using sys_id or name.
- Operations create and delete are idempotent on parameter
name
. - When
state
is set topresent
, a record identified byname
is only created once. Further invocations will update the record. - For more information, refer to the ServiceNow configuration management documentation at https://docs.servicenow.com/bundle/tokyo-servicenow-platform/page/product/configuration-management/reference/cmdb-table-property-descriptions.html.
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 |
|
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 |
|
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 |
|
operational_status dictionary |
The operational status of the configuration item. |
|
environment string |
The environment to which this configuration item belongs. Default choices are |
|
install_status string |
The functional status of the configuration item. Default choices are |
|
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 |
|
api_path string added in servicenow.itsm 2.4.0 |
Change the API endpoint of SNOW instance from default 'api/now'. Default: |
|
client_id string |
ID of the client application used for OAuth authentication. If not set, the value of the 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 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 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:
|
|
host string / required |
The ServiceNow host name. If not set, the value of the |
|
password string |
Password used for authentication. If not set, the value of the 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 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 |
|
username string |
Username used for authentication. If not set, the value of the 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:
|
|
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 |
|
other dictionary |
Any of the remaining configuration parameters. For the attributes of the base 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:
|
|
sys_class_name string |
ServiceNow configuration item class. The value of this parameter should point to a ServiceNow CMDB configuration item table, for instance 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 |
|
sys_id string |
Unique identifier of the record to operate on. |
servicenow.itsm.configuration_item_info
List ServiceNow configuration item.
- 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:
- Manca Bizjak (@mancabizjak)
- Miha Dolinar (@mdolin)
- Tadej Borovsak (@tadeboro)
- Matej Pevec (@mysteriouswolf)
- Polona Mihalič (@PolonaM)