This commit is contained in:
Mike McFetridge
2026-07-20 09:23:17 -04:00
parent c1315882da
commit 72272e4006
3179 changed files with 562960 additions and 14 deletions
@@ -0,0 +1,25 @@
---
- name: Check disk space
hosts: "{{ my_hosts | d([]) }}"
tasks:
- name: Check disk space available
ansible.builtin.shell:
cmd: |
set -euo pipefail
df -Ph / | awk 'NR==2 {print $5}'
executable: /bin/bash
changed_when: false
check_mode: false
register: disk_usage
# - name: Send discord message when disk space is over 80%
# uri:
# url: "your-webhook"
# method: POST
# body_format: json
# body: '{"content": "Disk space on {{ inventory_hostname }} is above 80%!"}'
# headers:
# Content-Type: application/json
# status_code: 204
# when: disk_usage.stdout[:-1]|int > 80
@@ -0,0 +1,14 @@
---
- name: Clean docker
hosts: "{{ my_hosts | d([]) }}"
tasks:
- name: Prune non-dangling images
community.docker.docker_prune:
containers: false
images: true
images_filters:
dangling: false
networks: false
volumes: false
builder_cache: false
@@ -0,0 +1,16 @@
---
- name: Check if system reboot is required
hosts: "{{ my_hosts | d([]) }}"
become: true
tasks:
- name: Check if system reboot is required
become: true
ansible.builtin.stat:
path: /var/run/reboot-required
register: reboot_required
- name: Report if reboot is required
ansible.builtin.debug:
msg: "Reboot is required"
when: reboot_required.stat.exists
@@ -0,0 +1,9 @@
---
- name: Reboot machine
hosts: "{{ my_hosts | d([]) }}"
become: true
tasks:
- name: Reboot machine
ansible.builtin.reboot:
reboot_timeout: 3600