|
|
|
|
@ -3,6 +3,41 @@
|
|
|
|
|
### tags:
|
|
|
|
|
### check_elastic_cluster
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- hosts: prometheus
|
|
|
|
|
vars:
|
|
|
|
|
start: '{{ ansible_date_time.epoch }}'
|
|
|
|
|
|
|
|
|
|
tasks:
|
|
|
|
|
- set_fact:
|
|
|
|
|
startsAt: "{{ '%Y-%m-%d %H:%M:%S' | strftime(start) }}"
|
|
|
|
|
endsAt: "{{ '%Y-%m-%d %H:%M:%S' | strftime( ( start | int ) + 3600 |int ) }}"
|
|
|
|
|
|
|
|
|
|
- name: "set fact"
|
|
|
|
|
set_fact:
|
|
|
|
|
silence:
|
|
|
|
|
matchers:
|
|
|
|
|
- name: env
|
|
|
|
|
value: dev
|
|
|
|
|
isRegex: false
|
|
|
|
|
isEqual: true
|
|
|
|
|
startsAt: '{{ startsAt }}'
|
|
|
|
|
endsAt: '{{ endsAt }}'
|
|
|
|
|
createdBy: patchday-automatism
|
|
|
|
|
comment: patchday
|
|
|
|
|
id:
|
|
|
|
|
|
|
|
|
|
- name: "Schedule silences for stage..."
|
|
|
|
|
uri:
|
|
|
|
|
url: "https://{{ stage }}-prometheus-01-alertmanager.smardigo.digital/api/v2/silences"
|
|
|
|
|
method: POST
|
|
|
|
|
status_code: [200]
|
|
|
|
|
headers:
|
|
|
|
|
Content-Type: application/json
|
|
|
|
|
body_format: json
|
|
|
|
|
body: '{{ silence | to_json }}'
|
|
|
|
|
ignore_errors: yes
|
|
|
|
|
|
|
|
|
|
- hosts: elastic
|
|
|
|
|
serial: 1
|
|
|
|
|
become: yes
|
|
|
|
|
|