Directory structures and names changed to be follow the order of creation->provisioning->maintainance
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
---
|
||||
- name: Internet connection test block
|
||||
block:
|
||||
- name: Test reachability to ya.ru
|
||||
become: yes # Usually it's not necessary, but sometimes there are some wierd issues with ping, especially on Alpine
|
||||
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!git
|
||||
- name: Create a test file
|
||||
become: no
|
||||
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: no
|
||||
shell: df -h / | tail -1 | awk '{gsub(/%/, "", $5); print $5}'
|
||||
register: result
|
||||
failed_when: result.stdout | int > 85
|
||||
changed_when: false # This task does not change the system
|
||||
|
||||
rescue:
|
||||
- name: Notify with ntfy
|
||||
become: no
|
||||
ansible.builtin.command: |
|
||||
curl -H "Authorization: Bearer {{ ntfy_topic_token }}" \
|
||||
-d "{{ ansible_facts['hostname'] }}: Disk space is low" \
|
||||
{{ ntfy_topic }}
|
||||
delegate_to: 127.0.0.1
|
||||
failed_when: false
|
||||
changed_when: false # This task does not change the system
|
||||
Reference in New Issue
Block a user