Creating Incidents

Learn how to automate ServiceNow incident creation using Ansible Automation Platform and the servicenow.itsm certified collection.

Introduction

In ITIL, an incident refers to an unplanned outage or reduction in quality of an IT service or application. ServiceNow implements technology mapped to ITIL terminology and is accepted as an industry standard for incident management.

The servicenow.itsm certified collection allows organizations to leverage incident management within Ansible Automation Platform workflows, enabling:

  • Automated incident creation from monitoring systems

  • Standardized incident reporting processes

  • Integration with existing automation workflows

  • Consistent incident data structure and classification

Review the Playbook

A playbook has been created in the VS Code tab called incident-create.yml.

Example 1. Task: Inspect the playbook
  1. Open the VS Code tab in your lab environment

  2. Locate and open the incident-create.yml file

  3. Review the in-line comments to understand how the collection is being leveraged

  4. Pay attention to the module parameters and their purposes

Key elements to notice in the playbook:

  • How authentication is handled

  • Required and optional parameters for incident creation

  • How dynamic data is incorporated into the incident

Create Incident

Now you’ll execute the playbook through Automation Controller to create a ServiceNow incident.

Example 2. Procedure: Launch the job template
  1. Use the following login credentials access the Automation Controller tab

    • Username: admin

    • Password: ansible123!

  2. Navigate to Automation Execution > Templates

  3. Locate the 1 - Create incident (incident-create.yml) job template

  4. Click the rocket icon to launch the job

Monitor the job execution and note:

  • The job status and any output messages

  • The incident number created (you’ll need this for verification)

  • Any error messages or warnings

Inspect Results

Verify that the incident was successfully created in ServiceNow.

  • Username: aap-roadshow

  • Password: Ans1ble123!

Example 3. Procedure: Verify incident creation
  1. Use the ServiceNow credentials from your lab environment to access the ServiceNow tab

  2. In ServiceNow, select incidents

  3. Locate your newly created incident in the list

  4. Click on the incident to view its details

Verification Points

To confirm the incident was created by your automation:

  • Username: Your unique lab username should appear in the incident description

  • Incident Number: Should match the number displayed in the Automation Controller job output

  • Timestamp: Should correspond to when you ran the job

  • Status: Should be in "New" or "Active" state

Expected Results

You should see a new incident with: - A unique incident number (e.g., INC0012345) - Your lab username in the description - Appropriate priority and category settings - Timestamp matching your job execution

Next Steps

Once you’ve successfully created and verified your incident, you’re ready to move on to Module 2, where you’ll learn about problem management and how to attach problems to existing incidents.

Troubleshooting

If you have encountered an issue or have noticed something not quite right, please open an issue on GitHub.