-
Notifications
You must be signed in to change notification settings - Fork 1
/
itsm_change_create.yml
74 lines (66 loc) · 2.44 KB
/
itsm_change_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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
---
- name: Create ServiceNow incident ticket
hosts: cisco
gather_facts: false
tasks:
- name: Create Change Request Ticket in ITSM System
delegate_to: localhost
when: change_fact == true
block:
- name: Create Change Request
servicenow.itsm.change_request:
instance:
host: "{{ SN_HOST }}"
username: "{{ SN_USERNAME }}"
password: "{{ SN_PASSWORD }}"
state: new
type: normal
requested_by: "splunk_ansible_workflow"
description: |
'{{ inventory_hostname }} is out of compliance.
Use the following URL for details: {{ job_url }}'
short_description: "{{ inventory_hostname }}"
priority: low
impact: low
risk: low
urgency: medium
category: network
assignment_group: 'Network CAB Managers'
other:
start_date: "{{ lookup('pipe','date +%Y%m%d%H%M%S')}}"
expected_start: "{{ lookup('pipe','date +%Y%m%d%H%M%S')}}"
implementation_plan: >
Implement the following playbook, which will run the tasks detailed in the second link
{{ job_url }}
https://gitlab.com/redhatautomation/network_demos/-/blob/main/base_configuration/network_STIG_set.yml?ref_type=heads
answer: true
register: change_out
- name: Set fact for change number
ansible.builtin.set_fact:
change_number: "{{ change_out.record.number }}"
- name: Debug change number
ansible.builtin.debug:
msg: "{{ change_number }}"
- name: Set change Number
ansible.builtin.set_stats:
data:
change_number: "{{ change_number }}"
# - name: Create incident
# servicenow.itsm.change_request:
# instance:
# host: "{{ SN_HOST }}"
# username: "{{ SN_USERNAME }}"
# password: "{{ SN_PASSWORD }}"
# state: new
# type: emergency
# requested_by: ansible_workflow
# short_description: Block IP Workflow
# description: "Splunk AAP workflow blocking IP: {{ block_ip }}"
# priority: high
# impact: low
# risk: low
# category: network
# other:
# planned_start: "{{ lookup('pipe','date +%Y%m%d%H%M%S')}}"
# answer: true
# register: change_out