Update sending messages to use bot accounts and clean up variables.

This commit is contained in:
Christian Steinle
2022-07-19 10:08:00 +02:00
parent 3ed032077a
commit c7913808c2
10 changed files with 128 additions and 85 deletions

View File

@@ -7,8 +7,7 @@
tasks:
- name: Backup odroid
block:
- include_vars: vars/common/variable.yaml
- include_vars: vars/odroid/secret.yaml
- include_vars: vars/common/mattermost.yaml
- include_vars: vars/odroid/variable.yaml
- name: Check if directories exist
@@ -272,8 +271,12 @@
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 }})"
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 "{{ semaphore_token }}"
status_code: [200, 201]
rescue:
- name: Inform Mattermost about error
@@ -282,5 +285,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]