-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpb1_set_stats.yml
39 lines (35 loc) · 1.38 KB
/
pb1_set_stats.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
---
- name: "[set-stats] Playbook 1 - Create downtime and get downtime_id"
#hosts: all
hosts: localhost
connection: local
gather_facts: False
tasks:
- name: "[set-stats] Playbook 1 - Create JSON to set downtime"
command: ./createJSON.sh
- name: "[set-stats] Playbook 1 - Create downtime and get downtime_id"
uri:
#url: http://op-icinga2-server.manderson-it.team.arctiq.ca:5665/v1/actions/schedule-downtime
url: https://localhost:5665/v1/actions/schedule-downtime
url_username: "{{ lookup('env','API_USERNAME') }}"
url_password: "{{ lookup('env','API_PASSWORD') }}"
validate_certs: False
method: "POST"
body_format: json
body: "{{ lookup('file','file.json') }}"
return_content: True
headers:
Accept: "application/json"
register: r_uri
delegate_to: "{{ item }}"
delegate_facts: True
loop: "{{ groups['icinga2_server'] }}"
- name: "[set-stats] Playbook 1 - DEBUG"
debug:
var: r_uri.results[0].json.results[0].name
- name: "[set-stats] Playbook 1 - Create downtime and get downtime_id"
set_stats:
data:
downtime_id: "{{ r_uri.results[0].json.results[0].name }}"
aggregate: False # default yes and was duplicating/multiplying the string (according to the number of hosts in inventory)
per_host: False