Updated folder structure

This commit is contained in:
2026-01-31 21:06:50 +01:00
parent d05a5d8c98
commit 99b976d795
2 changed files with 4 additions and 3 deletions

22
playbooks/aptupdates.yml Normal file
View File

@@ -0,0 +1,22 @@
---
- hosts: all
become: true
tasks:
- name: Update apt packages
apt:
upgrade: dist
update_cache: yes
- name: Check if reboot is needed
stat:
path: /var/run/reboot-required
register: reboot_required
- name: Send notification
community.general.pushover:
title: 'Reboot Required!'
msg: 'Reboot is required on {{inventory_hostname}}'
app_token: '{{ app_token }}'
user_key: '{{ user_key }}'
delegate_to: localhost
when: reboot_required.stat.exists

19
playbooks/diskspace.yml Normal file
View File

@@ -0,0 +1,19 @@
---
- hosts: all
tasks:
- name: Get disk usage
shell: df -h / | awk 'NR==2 {print $5}'
register: disk_usage
- name: Print disk usage
ansible.builtin.debug:
msg: "{{ disk_usage.stdout }}"
- name: Send notification
community.general.pushover:
title: 'Disk Space Warning!'
msg: 'Disk usage from {{inventory_hostname}} is at {{ disk_usage.stdout }}'
app_token: '{{ app_token }}'
user_key: '{{ user_key }}'
delegate_to: localhost
when: disk_usage.stdout[:-1]|int > disk_threshold|int