Skip to content

ansible-collections/servicenow.itsm

Ansible Collection for ServiceNow ITSM

The Ansible Collection for ServiceNow IT Service Management (ITSM) provides Ansible content that enables users to automate the management of ServiceNow ITSM processes such as incidents, change requests, service catalogs, configuration items, and more.

This collection is ideal for IT administrators, DevOps engineers, and automation specialists who work with ServiceNow and want to integrate its capabilities into their infrastructure automation workflows.

Requirements

  • Ansible-Core: >= 2.15.0
  • Python: With ansible-core, as listed for control nodes here
  • No additional Python libraries or external Ansible collections are required.
  • A ServiceNow instance and user credentials are required for module authentication.

Installation

Install the collection from Ansible Galaxy using:

ansible-galaxy collection install servicenow.itsm

Or include it in a requirements.yml file:

collections:
  - name: servicenow.itsm

To upgrade the collection to the latest version:

ansible-galaxy collection install servicenow.itsm --upgrade

To install a specific version:

ansible-galaxy collection install servicenow.itsm:==1.0.0

See the full guide on using Ansible collections for more.

Use Cases

Here are a few common automation scenarios enabled by this collection:

  1. Incident Management: Automatically create, update, and query incidents during CI/CD pipelines or event-driven automation.
  2. Change Management: Trigger change requests and manage their lifecycle in coordination with deployment processes.
  3. Configuration Item (CI) Updates: Automate the creation and update of CIs in CMDB during system provisioning.
  4. Service Catalog Integration: Provision and manage items from the service catalog through Ansible playbooks.
  5. Attachment Handling: Upload or retrieve documents from records to streamline workflows.

Inventory Plugins

Name Description
servicenow.itsm.now Inventory source for ServiceNow table records.

Modules

Name Description
api Manage ServiceNow POST, PATCH and DELETE requests
api_info Manage ServiceNow GET requests
attachment_info Download attachment using sys_id
attachment_upload Upload attachment to a table
change_request Manage ServiceNow change requests
change_request_info List ServiceNow change requests
change_request_task Manage change request tasks
change_request_task_info List change request tasks
configuration_item Manage configuration items
configuration_item_batch Manage configuration items in batch
configuration_item_info List configuration items
configuration_item_relations Manage CI relationships
configuration_item_relations_info List CI relationships
incident Manage incidents
incident_info List incidents
problem Manage problems
problem_info List problems
problem_task Manage problem tasks
problem_task_info List problem tasks
service_catalog Manage service catalogs
service_catalog_info List service catalogs

Example Usage

Using FQCN:

- name: Retrieve incidents by number
  servicenow.itsm.incident_info:
    instance:
      host: https://dev12345.service-now.com
      username: user
      password: pass
    number: INC0000039
  register: result

With collections keyword:

collections:
  - servicenow.itsm

tasks:
  - incident_info:
      instance:
        host: https://dev12345.service-now.com
        username: user
        password: pass
      number: INC0000039
    register: result

Using environment:

---
- name: Test SNOW with blocks
  hosts: localhost
  become: false
  gather_facts: false
  vars:
    sn_host: https://hostname.example.com
    sn_username: username
    sn_password: password
  tasks:
    - name: Perform several ServiceNow tasks with the same credentials
      block:
        - name: Create test incident with attachment
          servicenow.itsm.incident:
            caller: admin
            state: new
            short_description: Test incident
            impact: low
            urgency: low
          register: test_incident
      environment:
        SN_HOST: "{{ sn_host }}"
        SN_USERNAME: "{{ sn_username }}"
        SN_PASSWORD: "{{ sn_password }}"

Testing

This collection is tested with:

  • Ansible-Core >= 2.15.0
  • Python, as specified for control nodes here
  • Supported ServiceNow versions according to the table below

Known exceptions or compatibility issues will be tracked via the GitHub Issues page.

ServiceNow Release Collection Release EOL
Yokohama 2.9.0+ TBA
Xanadu 2.7.0+ TBA
Washington DC 2.5.0+ TBA
Vancouver 2.5.0 - 2.8.0 Q2 2025
Utah 2.1.0 - 2.8.0 Q2 2025
Tokyo 2.1.0 - 2.6.1 Q2 2024

Contributing

We welcome contributions! Open an issue or a pull request on the GitHub repository:

Guidelines:

Join us on:

More: Ansible Community Guide and Communication

Support

Support is provided via:

Release Notes and Roadmap

Publishing New Version

# Sync with upstream
git checkout main && git pull && git fetch upstream && git merge upstream/main

# Prepare release
ansible-playbook scripts/prepare_release.yml --extra-vars "version=$VERSION"

# Push and open PR
git push --set-upstream origin prepare_$VERSION_release

# After PR is merged
git checkout main && git pull && git fetch upstream && git merge upstream/main
git tag -s $VERSION
git push upstream $VERSION

Related Information

License Information

This collection is licensed under the GNU General Public License v3.0 or later.
See: https://www.gnu.org/licenses/gpl-3.0.txt

About

Ansible Collection for ServiceNow ITSM

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages