Added common ansible role

This commit is contained in:
2020-01-03 15:02:16 +01:00
parent 5f34ead86e
commit d8176ea43c
10 changed files with 113 additions and 0 deletions
@@ -0,0 +1,6 @@
# apticron.conf
#
# Set EMAIL to a space separated list of addresses which will be notified of
# impending updates. By default the root account will be notified.
EMAIL="root@{{ ansible_domain }}"
@@ -0,0 +1,15 @@
#!/bin/sh
# Check disk space
CURRENT=$(df / --output=pcent | tail --lines=1 | cut --delimiter='%' --field=1)
THRESHOLD=90
ADMIN="root@{{ ansible_domain }}"
SUBJECT="[Disk Space Alert] The free space on {{ ansible_fqdn }} is critically low"
MESSAGE=
if [ "$CURRENT" -gt "$THRESHOLD" ]; then
mail -s "$SUBJECT" "$ADMIN" << EOF
Your root partition remaining free space is critically low. Used: $CURRENT%
EOF
fi