Introduce notification for other playbooks.

This commit is contained in:
2021-11-23 15:38:00 +01:00
parent 9a2e5afe01
commit 3efcd0797c
2 changed files with 264 additions and 226 deletions

View File

@@ -5,6 +5,8 @@
gather_facts: true gather_facts: true
tasks: tasks:
- name: Backup hetzner
block:
- include_vars: vars/hetzner/secret.yaml - include_vars: vars/hetzner/secret.yaml
- include_vars: vars/hetzner/variable.yaml - include_vars: vars/hetzner/variable.yaml
@@ -63,3 +65,20 @@
file: file:
path: "{{ backup_dir }}" path: "{{ backup_dir }}"
state: absent state: absent
- name: Inform Mattermost about success
uri:
url: https://cs-mm.ddnss.de/hooks/og4ckuqet7fafb8kjuaigzuh7c
method: POST
body_format: json
body:
text: "{{ ansible_date_time.date }} {{ ansible_date_time.time }} (info): Playbook ran successful ({{ ansible_play_name }})"
rescue:
- name: Inform Mattermost about error
uri:
url: https://cs-mm.ddnss.de/hooks/og4ckuqet7fafb8kjuaigzuh7c
method: POST
body_format: json
body:
text: "{{ ansible_date_time.date }} {{ ansible_date_time.time }} (info): Playbook ran with error ({{ ansible_play_name }})"

View File

@@ -5,6 +5,8 @@
gather_facts: true gather_facts: true
tasks: tasks:
- name: Backup odroid
block:
- include_vars: vars/odroid/secret.yaml - include_vars: vars/odroid/secret.yaml
- include_vars: vars/odroid/variable.yaml - include_vars: vars/odroid/variable.yaml
@@ -197,3 +199,20 @@
become: yes become: yes
become_method: sudo become_method: sudo
become_user: root become_user: root
- name: Inform Mattermost about success
uri:
url: https://cs-mm.ddnss.de/hooks/og4ckuqet7fafb8kjuaigzuh7c
method: POST
body_format: json
body:
text: "{{ ansible_date_time.date }} {{ ansible_date_time.time }} (info): Playbook ran successful ({{ ansible_play_name }})"
rescue:
- name: Inform Mattermost about error
uri:
url: https://cs-mm.ddnss.de/hooks/og4ckuqet7fafb8kjuaigzuh7c
method: POST
body_format: json
body:
text: "{{ ansible_date_time.date }} {{ ansible_date_time.time }} (info): Playbook ran with error ({{ ansible_play_name }})"