From f2529fadfc9bc1b71db411f1df12ce905afc9ef7 Mon Sep 17 00:00:00 2001 From: Lino Schmidt Date: Sat, 22 Jul 2023 21:29:04 +0200 Subject: [PATCH] added diskspace --- aptupdates.yml | 10 +--------- diskspace.yml | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 9 deletions(-) create mode 100644 diskspace.yml diff --git a/aptupdates.yml b/aptupdates.yml index 9364b55..185673f 100644 --- a/aptupdates.yml +++ b/aptupdates.yml @@ -3,12 +3,4 @@ - name: Update apt packages apt: upgrade: yes - update_cache: yes - - - name: Send notifications - community.general.pushover: - title: 'APT Updates' - msg: '{{ testvar }} has been lost somewhere' - app_token: '{{ app_token }}' - user_key: '{{ user_key }}' - delegate_to: localhost \ No newline at end of file + update_cache: yes \ No newline at end of file diff --git a/diskspace.yml b/diskspace.yml new file mode 100644 index 0000000..fc99962 --- /dev/null +++ b/diskspace.yml @@ -0,0 +1,15 @@ +- hosts: all + + tasks: + - name: Get disk usage + command: df -h / | awk 'NR==2 {print $5}' + register: disk_usage + + - name: Send notification + community.general.pushover: + title: 'Disk Space Warning' + msg: 'Disk usage is {{ disk_usage.stdout }}!' + app_token: '{{ app_token }}' + user_key: '{{ user_key }}' + delegate_to: localhost + when: disk_usage.stdout > {{ disk_threshold }} \ No newline at end of file