Ansible Integration Guide

Ansible is a powerful automation engine that makes systems and applications simple to deploy. No custom scripting or custom code. No agents. All using an automation language that’s easy for anyone to understand and learn. Just get in, get it done, and make some time for other strategic projects.

The PagerDuty Ansible module allows you to create and list ongoing maintenance windows for services on your PagerDuty account, trigger, acknowledge or resolve PagerDuty incidents, manage user accounts and send change events.

Requirements

If you are using Ansible 1.8 or higher, we highly suggest using an API Key and requester ID instead of using a username and password. Please note, you must be a PagerDuty Admin or the Account Owner to create the API token.

In PagerDuty

  1. From the Integrations menu, select API Access Keys.
  2. On your API Access page, click the +Create New API Key button.
  3. In the dialog that pops up, you’ll be prompted to enter a Description for your key. You will also have the option to create the key as Read-only; leaving this box unchecked will create a full access key.
  4. Once you have filled in your options, click Create Key.
  5. Once you click Create Key, you will see a dialog displaying your key and confirming the options you filled in on the previous step. Make sure to copy this key and keep it in a safe place for later use, as you will not have access to the key after this step. If you lose a key that you created previously and need access to it again, you should remove the key and create a new one. Click Close once you have successfully copied your key.
  6. In the top right corner, click on your avatar and select My Profile.
  7. In the URL bar, the last set of 7 characters after the /, starting with the letter P, is your requester ID.

If you need to find the service ID to create a maintenance window, here’s how you would do so:

  1. Click on the Services tab and then select Service Directory.
  2. Find the service and click its name.
  3. In the URL, the last set of 7 alphanumeric characters starting with the letter P is the service ID.

In your Ansible playbook

Use the API Key generated in PagerDuty as the token parameter, and the service ID (where applicable) as the requester_id parameter, with the example tasks listed for the following actions:

Start Using PagerDuty Today

Try PagerDuty free for 14 days — no credit card required.

SIGN UP