-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsnow_devinstance2_report_error.yml
37 lines (35 loc) · 1.4 KB
/
snow_devinstance2_report_error.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
---
- name: Developer Instance - Test Servicenow integration
hosts: all
connection: local
gather_facts: false # set true for ansible_date_time to exist
#ignore_errors: true
vars:
snow_instance: dev60536
snow_cr: CHG0040001
app_name: EDRMS
# table: u_ansible_change_ticket_web_service # change_request
tasks:
- debug:
msg:
- "ServiceNow instance used: '{{ snow_instance }}'"
- "ServiceNow Change Request used: '{{ snow_cr }}'"
run_once: true
delegate_to: localhost
- name: Report error(s) in work_notes in a Change Request
snow_record:
username: "{{ lookup('env','SNOW_USERNAME') }}"
password: "{{ lookup('env','SNOW_PASSWORD') }}"
instance: "{{ snow_instance }}"
number: "{{ snow_cr }}" #"{{ new_cr.record.number }}"
state: present
table: change_request
data:
work_notes: "Error(s) encountered while patching {{ app_name }}. \nServer Count is {{ groups.all|length }}. \nServer count: {{ groups.all | list | join(', ') }}. \nFor details see Workflow {{ tower_workflow_job_name | default('UNDEFINED') }} and Tower job ID {{ tower_workflow_job_id | default('UNDEFINED') }}."
register: change_cr
run_once: true
delegate_to: localhost
#
# - name: debug - Edited change_cr Change Request
# debug:
# var: change_cr