Update sending messages to use bot accounts and clean up variables.
This commit is contained in:
19
nas.yaml
19
nas.yaml
@@ -7,7 +7,7 @@
|
||||
tasks:
|
||||
- name: Backup odroid
|
||||
block:
|
||||
- include_vars: vars/common/variable.yaml
|
||||
- include_vars: vars/common/mattermost.yaml
|
||||
|
||||
- name: Wakeup the nas
|
||||
community.general.wakeonlan:
|
||||
@@ -59,18 +59,17 @@
|
||||
|
||||
- name: Inform Mattermost about success
|
||||
uri:
|
||||
url: https://cs-mm.ddnss.de/api/v4/posts
|
||||
url: "{{ mattermost_url }}"
|
||||
method: POST
|
||||
body_format: json
|
||||
body:
|
||||
channel_id: gub5buudpffxjf6fc1abkas8jo
|
||||
message: "{{ ansible_date_time.date }} {{ ansible_date_time.time }} (info): Playbook ran successful ({{ ansible_play_name }})"
|
||||
channel_id: "{{ channel_id }}"
|
||||
message: "{{ ansible_date_time.date }} {{ ansible_date_time.time }}: Playbook ran successful ({{ ansible_play_name }})"
|
||||
headers:
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer 6ej3xr7cuinyfrzkbn64i85zco
|
||||
Authorization: Bearer "{{ semaphore_token }}"
|
||||
status_code: [200, 201]
|
||||
|
||||
|
||||
rescue:
|
||||
- name: Umount nas volume
|
||||
ansible.posix.mount:
|
||||
@@ -84,5 +83,9 @@
|
||||
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 }})"
|
||||
channel_id: "{{ channel_id }}"
|
||||
message: "{{ ansible_date_time.date }} {{ ansible_date_time.time }}: Playbook ran with error ({{ ansible_play_name }})"
|
||||
headers:
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer "{{ error_token }}"
|
||||
status_code: [200, 201]
|
||||
|
||||
Reference in New Issue
Block a user