From 4f4f8be81a6fa21b6e648dad445d04da94350500 Mon Sep 17 00:00:00 2001 From: friedrich goerz Date: Thu, 21 Jul 2022 10:17:24 +0200 Subject: [PATCH] DEV-518: added silences step --- patchday.yml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/patchday.yml b/patchday.yml index 20f5e74..03f3568 100644 --- a/patchday.yml +++ b/patchday.yml @@ -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