Reference - Set

The set dictionary is optional, & must be in the root of the Playbook if supplied.

Summary

  • Set is a dictionary used to define static variables for your task

  • The dictionary can contain as many variables as you need

Examples

Email Recipient List

Setting an email recipient list:

Setting the Values
1
2
3
4
set:
  audit_email_addresses:
    - audit@company.com
    - security@company.com

Using the recipient list in a plugin action:

Using the Values
1
2
3
4
5
6
7
steps:
  - name: Send Audit Email
    actions:
      - ppa.events.send_email:
          plain_text: This is an audit message from a PPA task 
        load:
          recipients: audit_email_addresses

ServiceNow Incident States

Setting incident configuration:

Setting the Values
1
2
3
4
5
6
7
set:
  incident_states:
    resolved: 6
    new: 1
  incident_close_codes:
    solved_permanently: 1
    solved_remotely: 2

Using the configuration in a plugin action:

Using the Values
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
steps:
  - name: Resolve Incident
    actions:
      - service_now.incidents.update:
          comments: Resolved from a PPA task
        load:
          sys_id: incident.sys_id
          close_code: incident_close_codes.solved_remotely
          state: incident_states.resolved
          access_details: access_details