This commit is contained in:
bzoicas
2023-07-10 10:41:17 +03:00
commit dbb46eb92a
360 changed files with 13521 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
- name: notify healthchecks.io that the job ran
uri:
url: https://hc-ping.com/{{ healthcheck_uuid }}
changed_when: False
when: healthcheck_uuid is defined
- name: send completion notification via telegram
tags: always
telegram:
token: "{{ telegram_token }}"
chat_id: "{{ telegram_chat_id }}"
msg_format: markdown
msg: "✔️ Ansible provision finished on *{{ ansible_hostname }}*"
changed_when: False

View File

@@ -0,0 +1,30 @@
- block:
- name: send failure notification via telegram
tags: always
telegram:
token: "{{ telegram_token }}"
chat_id: "{{ telegram_chat_id }}"
msg_format: markdown
msg: "⚠️ Ansible provision failed on *{{ ansible_hostname }}*\n\n
*Task*: {{ ansible_failed_task.name }}\n
*Action*: {{ ansible_failed_task.action }}\n
*Error Message*: \n ```{{ ansible_failed_result | to_nice_json }}```"
changed_when: False
rescue:
- name: send failure notification via telegram
tags: always
telegram:
token: "{{ telegram_token }}"
chat_id: "{{ telegram_chat_id }}"
msg_format: markdown
msg: "⚠️ Ansible provision failed on *{{ ansible_hostname }}*\n\n
The specific error couldn't be shown, check the log."
changed_when: False
- name: ansible job failed, clear cache later on to trigger another provision run
become: yes
at:
command: "if ! pgrep -f ansible-pull >/dev/null; then rm -rf /home/simone/.ansible; fi"
count: 60
units: minutes