Extend nas playbook to inform mattermost.

This commit is contained in:
2022-07-12 05:34:59 +02:00
parent 1cff897fc7
commit e9a3d47677

View File

@@ -7,6 +7,7 @@
tasks:
- name: Backup odroid
block:
- include_vars: vars/common/variable.yaml
- name: Wakeup the nas
community.general.wakeonlan:
@@ -51,3 +52,22 @@
path: /media/nas
state: unmounted
become: yes
- name: Inform Mattermost about success
uri:
url: "{{ mattermost_url }}"
method: POST
body_format: json
body:
username: "{{ mattermost_user }}"
text: "{{ ansible_date_time.date }} {{ ansible_date_time.time }} (info): Playbook ran successful ({{ ansible_play_name }})"
rescue:
- name: Inform Mattermost about error
uri:
url: "{{ mattermost_url }}"
method: POST
body_format: json
body:
username: "{{ mattermost_user }}"
text: "{{ ansible_date_time.date }} {{ ansible_date_time.time }} (info): Playbook ran with error ({{ ansible_play_name }})"