-
Notifications
You must be signed in to change notification settings - Fork 5
/
snow_cr_create.yml
53 lines (46 loc) · 1.61 KB
/
snow_cr_create.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# REQUIREMENTS
# pip install pan-python
# pip install pandevice
# pip install xmltodict
# ansible-galaxy install paloaltonetworks.paloaltonetworks
# https://www.bountysource.com/issues/59738537-certificate-verify-failed
# set verify to disable in the virtual environment
---
- hosts: localhost
connection: local
gather_facts: no
vars:
erase: false
vars_files:
- ./vars/default_vars.yml
- ./credentials/servicenow_credentials.yml
- ./credentials/gmail_creds.yml
# roles:
# - role: paloaltonetworks.paloaltonetworks
tasks:
- name: Create a change request in ServiceNow
servicenow.itsm.change_request:
state: new
type: standard
short_description: "Apply Palo Alto Networks Access Policies"
requested_by: admin
instance:
host: "https://{{ SN_INSTANCE }}.service-now.com"
username: "{{ SN_USERNAME }}"
password: "{{ SN_PASSWORD }}"
delegate_to: localhost
register: request
# - debug:
# var: request.record.number
- name: Sending an email requesting approval
mail:
host: smtp.gmail.com
port: 587
username: "{{ gmail_username }}"
password: "{{ gmail_password }}"
to:
- "Michael Ford <{{ approver_email }}>"
- "{{ secondary_approver }}"
subject: "New ServiceNow Change Request {{ request.record.number }}"
body: "You have a new Change Request. Please click on this URL to view: https://{{ SN_INSTANCE }}.service-now.com/nav_to.do?uri=change_request.do?sysparm_query=number={{ request.record.number }}"
delegate_to: localhost