REFACTOR: files fixed according to ansible-lint

This commit is contained in:
2026-07-12 15:36:55 +00:00
parent 9a9bfa7e23
commit d1568586e9
8 changed files with 69 additions and 58 deletions
+23 -17
View File
@@ -2,14 +2,14 @@
- 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
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!git
# This won't work for now. CA certificate reissuing is required!
- name: Create a test file
become: no
become: false
ansible.builtin.uri:
url: "{{ ha_addr }}/api/webhook/{{ ha_webhook_token }}"
ca_path: ../files/ca.pem
@@ -20,19 +20,25 @@
- 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
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 > 1
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
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