-
Notifications
You must be signed in to change notification settings - Fork 8
/
batch_copy_snow.yaml
42 lines (36 loc) · 1.27 KB
/
batch_copy_snow.yaml
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
- name: Known Error Demo (batch copy fail)
hosts: all
vars:
username:
password:
instance:
tasks:
- name: Batch job - copy files remotely
command: cp /mnt/testdir/dummy.iso /tmp/testdir/dummy.iso
register: errorCode
ignore_errors: True
changed_when: errorCode.rc == -9
- name: look at errorCode
debug:
var: errorCode
- name: SERVICENOW incident created if Known Error detected
snow_record:
username: admin
password: MyPassw0rd21
instance: dev14202
state: present
table: incident
data:
short_description: "Known_Error On app host was found: Batch Job: File Copy Failed"
severity: 1
priority: 2
approval: approved
caller_id: "System Administrator"
comments: "The batch job copy failed on {{inventory_hostname}}. This ticket was generated by Ansible Tower API call. \n--------\n The error code is {{errorCode.rc}}\n--------\n "
register: snow_var
delegate_to: localhost
when: errorCode.changed
- name: DEBUG SNOW_VAR
debug:
var: snow_var.record.number
# - local_action: copy content={{ snow_var.record.number }} dest=/tmp/test1/1.2.txt