Modules¶
While different modules perform different tasks, their interfaces all follow the same pattern as much as possible.
The API of each module is composed of two parts. Information iside the instance parameter influences how moddules connect to the ServiceNow instance. All other parameters hold the information related to the resource that we are operating on.
Instance parameters¶
Each module has an instance parameter that holds the following information about the ServiceNow instance process we would like to manage:
Instance address, e.g. https://dev12345.service-now.com/.
Username and password that Ansible modules should use to authenticate with the ServiceNow instance.
The optional client id and secret that indicate modules should use OAuth when authenticating.
- name: Create a new incident
servicenow.itsm.incident:
instance:
host: https://dev12345.service-now.com
username: user
password: pass
client_id: cid
client_secret: csecret
# Other incident parameters here
Managing ServiceNow records¶
There are two things modules from the ServiceNow Ansible Collection can do:
Enforce certain state of the records (creating, updating, and deleting incidents, change requests, etc.).
List and filter available records.
Reference material for each module contains documentation on what parameters certain modules accept and what values they expect those parameters to be.
Module reference¶
- change_request – Manage ServiceNow change requests
- change_request_info – List ServiceNow change requests
- change_request_task – Manage ServiceNow change request tasks
- change_request_task_info – List ServiceNow change request tasks
- configuration_item – Manage ServiceNow configuration items
- configuration_item_batch – Manage ServiceNow configuration items in batch mode
- configuration_item_info – List ServiceNow configuration item
- incident – Manage ServiceNow incidents
- incident_info – List ServiceNow incidents
- problem – Manage ServiceNow problems
- problem_info – List ServiceNow problems
- problem_task – Manage ServiceNow problem tasks
- problem_task_info – List ServiceNow problem tasks