ServiceNow ITSM Actions powered by Ansible.
This action provides a wrapper around Ansible Collection for ServiceNow ITSM to perform operations on a ServiceNow instance. The Ansible Collection for ServiceNow IT Service Management (ITSM) includes a variety of Ansible content to help automate the management of ServiceNow IT Service Management.
In your workflow, to perform a new operation, include a step like this:
- name: Let it SNOW
uses: shundor/servicenow-actions@main
with:
sn_host: "${{ secrets.SN_HOST }}"
sn_username: "${{ secrets.SN_USERNAME }}"
sn_password: "${{ secrets.SN_PASSWORD }}"
sn_client_id: "${{ secrets.SN_CLIENT_ID }}"
sn_client_secret: "${{ secrets.SN_CLIENT_SECRET }}"
sn_module: "${{ secrets.SN_MODULE }}"
sn_module_params: "${{ secrets.SN_MODULE_PARAMS }}"
The following inputs are required:
sn_host
: The ServiceNow instance hostnamesn_username
: The ServiceNow usernamesn_password
: The ServiceNow passwordsn_client_id
: The ServiceNow client IDsn_client_secret
: The ServiceNow client secretsn_module
: The Ansible module to usesn_module_params
: The parameters to pass to the Ansible module
Optional:
debug
: When set totrue
, the action save the playbook to a workflow artifact
You can create sn_client_id
and sn_client_secret
via the Application Registry under System OAuth in ServiceNow.
The module parameter must one of the following:
Name | Description |
---|---|
servicenow.itsm.api | Manage ServiceNow POST, PATCH and DELETE requests |
servicenow.itsm.api_info | Manage ServiceNow GET requests |
servicenow.itsm.attachment | a module that users can use to download attachment using sys_id |
servicenow.itsm.change_request | Manage ServiceNow change requests |
servicenow.itsm.change_request_info | List ServiceNow change requests |
servicenow.itsm.change_request_task | Manage ServiceNow change request tasks |
servicenow.itsm.change_request_task_info | List ServiceNow change request tasks |
servicenow.itsm.configuration_item | Manage ServiceNow configuration items |
servicenow.itsm.configuration_item_batch | Manage ServiceNow configuration items in batch mode |
servicenow.itsm.configuration_item_info | List ServiceNow configuration item |
servicenow.itsm.incident | Manage ServiceNow incidents |
servicenow.itsm.incident_info | List ServiceNow incidents |
servicenow.itsm.problem | Manage ServiceNow problems |
servicenow.itsm.problem_info | List ServiceNow problems |
servicenow.itsm.problem_task | Manage ServiceNow problem tasks |
servicenow.itsm.problem_task_info | List ServiceNow problem tasks |
To create an incident, you can use the servicenow.itsm.incident
module. The following example creates an incident with a short description of "Test Incident" and a description of "This is a test incident created by the ServiceNow Actions GitHub Action":
- name: Create An Incident
uses: shundor/servicenow-actions@main
with:
sn_host: "${{ secrets.SN_HOST }}"
sn_username: "${{ secrets.SN_USERNAME }}"
sn_password: "${{ secrets.SN_PASSWORD }}"
sn_client_id: "${{ secrets.SN_CLIENT_ID }}"
sn_client_secret: "${{ secrets.SN_CLIENT_SECRET }}"
sn_module: "servicenow.itsm.incident"
sn_module_params: "${{ secrets.SN_MODULE_PARAMS }}"
The value for the SN_MODULE_PARAMS secret should be:
caller: admin
short_description: Test Incident
description: This is a test incident created by the ServiceNow Actions GitHub Action
impact: low
urgency: low
For all the different parameters that can be passed to the servicenow.itsm.incident
module, see the docs on GitHub.
To get info on a specific incident, you can use the servicenow.itsm.incident_info
module. The following example gets details about Incident incident_info:
- name: Retrieve Incident INC0000039
uses: shundor/servicenow-actions@main
id: snow
with:
sn_host: "${{ secrets.SN_HOST }}"
sn_username: "${{ secrets.SN_USERNAME }}"
sn_password: "${{ secrets.SN_PASSWORD }}"
sn_client_id: "${{ secrets.SN_CLIENT_ID }}"
sn_client_secret: "${{ secrets.SN_CLIENT_SECRET }}"
sn_module: "servicenow.itsm.incident_info"
sn_module_params: "${{ secrets.SN_MODULE_PARAMS }}"
- name: Write to file
uses: frdrwrt/[email protected]
with:
filepath: output.json
mode: 0777
content: ${{ steps.snow.outputs.output }}
- name: Display output
shell: bash
run: |
jq '.plays[].tasks[].hosts.localhost.records[]' output.json
The value for the SN_MODULE_PARAMS secret should be:
number: INC0000039
For all the different parameters that can be passed to the servicenow.itsm.incident_info_module
module, see the docs on GitHub. The output
parameter will contain all the information about the incident.
This action provides the following outputs:
output
: The captured output as JSON
- 🙇 Based on action-ansible-playbook by dawidd6
- 🙇 This action relies on Ansible Collection for ServiceNow ITSM