community.general.pagerduty_user module – Manage a user account on PagerDuty

Note

This module is part of the community.general collection (version 7.5.2).

You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install community.general. You need further requirements to be able to use this module, see Requirements for details.

To use it in a playbook, specify: community.general.pagerduty_user.

New in community.general 1.3.0

Synopsis

  • This module manages the creation/removal of a user account on PagerDuty.

Aliases: monitoring.pagerduty_user

Requirements

The below requirements are needed on the host that executes this module.

  • pdpyras python module = 4.1.1

  • PagerDuty API Access

Parameters

Parameter

Comments

access_token

string / required

An API access token to authenticate with the PagerDuty REST API.

pd_email

string / required

The user’s email address.

pd_email is the unique identifier used and cannot be updated using this module.

pd_role

string

The user’s role.

Choices:

  • "global_admin"

  • "manager"

  • "responder" ← (default)

  • "observer"

  • "stakeholder"

  • "limited_stakeholder"

  • "restricted_access"

pd_teams

list / elements=string

The teams to which the user belongs.

Required if state=present.

pd_user

string / required

Name of the user in PagerDuty.

state

string

State of the user.

On present, it creates a user if the user doesn’t exist.

On absent, it removes a user if the account exists.

Choices:

  • "present" ← (default)

  • "absent"

Attributes

Attribute

Support

Description

check_mode

Support: full

Can run in check_mode and return changed status prediction without modifying target.

diff_mode

Support: none

Will return details on what has changed (or possibly needs changing in check_mode), when in diff mode.

Examples

- name: Create a user account on PagerDuty
  community.general.pagerduty_user:
    access_token: 'Your_Access_token'
    pd_user: user_full_name
    pd_email: user_email
    pd_role: user_pd_role
    pd_teams: user_pd_teams
    state: "present"

- name: Remove a user account from PagerDuty
  community.general.pagerduty_user:
    access_token: 'Your_Access_token'
    pd_user: user_full_name
    pd_email: user_email
    state: "absent"

Authors

  • Zainab Alsaffar (@zanssa)