diff --git a/hetzner.yaml b/hetzner.yaml index 85fa2c8..2418bb8 100644 --- a/hetzner.yaml +++ b/hetzner.yaml @@ -7,6 +7,7 @@ tasks: - name: Backup hetzner block: + - include_vars: vars/common/variable.yaml - include_vars: vars/hetzner/secret.yaml - include_vars: vars/hetzner/variable.yaml @@ -68,19 +69,21 @@ - name: Inform Mattermost about success uri: - url: https://cs-mm.ddnss.de/hooks/og4ckuqet7fafb8kjuaigzuh7c + url: "{{ mattermost_url }}" validate_certs: no 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: https://cs-mm.ddnss.de/hooks/og4ckuqet7fafb8kjuaigzuh7c + url: "{{ mattermost_url }}" validate_certs: no 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 }})" diff --git a/odroid.yaml b/odroid.yaml index 85e0478..44dd9e4 100644 --- a/odroid.yaml +++ b/odroid.yaml @@ -7,6 +7,7 @@ tasks: - name: Backup odroid block: + - include_vars: vars/common/variable.yaml - include_vars: vars/odroid/secret.yaml - include_vars: vars/odroid/variable.yaml @@ -202,17 +203,19 @@ - name: Inform Mattermost about success uri: - url: https://cs-mm.ddnss.de/hooks/og4ckuqet7fafb8kjuaigzuh7c + 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: https://cs-mm.ddnss.de/hooks/og4ckuqet7fafb8kjuaigzuh7c + 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 }})" diff --git a/semaphore.yaml b/semaphore.yaml index 7db6502..4b9fdc8 100644 --- a/semaphore.yaml +++ b/semaphore.yaml @@ -7,6 +7,7 @@ tasks: - name: Cleanup semaphore block: + - include_vars: vars/common/variable.yaml - include_vars: vars/semaphore/variable.yaml - name: Search for volume's backup directories @@ -122,17 +123,19 @@ - name: Inform Mattermost about success uri: - url: https://cs-mm.ddnss.de/hooks/og4ckuqet7fafb8kjuaigzuh7c + 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: https://cs-mm.ddnss.de/hooks/og4ckuqet7fafb8kjuaigzuh7c + 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 }})" diff --git a/vars/common/variable.yaml b/vars/common/variable.yaml new file mode 100644 index 0000000..cea24d1 --- /dev/null +++ b/vars/common/variable.yaml @@ -0,0 +1,2 @@ +mattermost_url: https://cs-mm.ddnss.de/hooks/og4ckuqet7fafb8kjuaigzuh7c +mattermost_user: semaphore