-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsnow_uri_testing.yml
57 lines (53 loc) · 1.57 KB
/
snow_uri_testing.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
---
- name: Test Servicenow REST API integration
hosts: localhost
connection: local
gather_facts: true
vars_files:
- vars/snow_vars.yml
tasks:
# works
# - name: Create a new change request
# uri:
# url: "{{ snow_url+snow_api_create_chgreq }}"
# user: "{{ snow_user }}"
# password: "{{ snow_pw }}"
# method: POST
# validate_certs: yes
# force_basic_auth: yes
# follow_redirects: all
# status_code: 200
# register: uri_chgreq
# tags: uri
- name: SNOW - REST API - Get a change request
uri:
url: "{{ snow_url+snow_api_get_chgreq+snow_chgreq }}"
user: "{{ snow_user }}"
password: "{{ snow_pw }}"
method: GET
validate_certs: yes
force_basic_auth: yes
follow_redirects: all
status_code: 200
return_content: yes
register: uri_chgreq
tags: uri
- name: debug - SNOW - REST API - get a change request
debug:
var: uri_chgreq
tags: uri
# Add Rescue tasks and Handlers here, for example
# rescue:
# - name: update ticket status with failure
# uri:
# url: {{ playbook var for defined servicenow API URL }}
# method: POST
# user: "{{ playbook var for servicenow userid }}"
# password: "{{ playbook var for servicenow pw }}"
# body: '{ "number":"{{ chgnumber }}","success":"0","close_code":"unsuccessful","close_notes":"failed" }'
# body_format: json
# force_basic_auth: yes
# follow_redirects: all
# status_code: 200
# - debug:
# msg: "rescue task complete"