--- - name: Internet connection test block block: - name: Test reachability to ya.ru become: true # Usually it's not necessary, but sometimes there are some wierd issues with ping, especially on Alpine ansible.builtin.shell: ping -c 5 ya.ru > /dev/null changed_when: false # This task does not change the system rescue: # This won't work for now. CA certificate reissuing is required! - name: Create a test file become: false ansible.builtin.uri: url: "{{ ha_addr }}/api/webhook/{{ ha_webhook_token }}" ca_path: ../files/ca.pem delegate_to: 127.0.0.1 # TODO: REMOVE THIS AFTER REISSUING CA CERTIFICATE! failed_when: false - name: Disk free space test block block: - name: Test free disk space in root become: false ansible.builtin.shell: set -o pipefail && df -h / | tail -1 | awk '{gsub(/%/, "", $5); print $5}' register: common_healthcheck_result failed_when: common_healthcheck_result.stdout | int > 85 changed_when: false # This task does not change the system rescue: - name: Notify with ntfy become: false ansible.builtin.uri: url: "{{ ntfy_topic }}" method: POST body_format: json status_code: [200, 202] return_content: true headers: Authorization: "Bearer {{ ntfy_topic_token }}" body: - "{{ ansible_facts['hostname'] }}: Disk space is low" delegate_to: 127.0.0.1 failed_when: false changed_when: false # This task does not change the system