--- - name: Check disk space hosts: "all" 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: Diskspace is over 80% ansible.builtin.debug: msg: "Disk is over 80%" when: disk_usage.stdout[:-1]|int>80 - name: Posting ansible.builtin.command: cmd: 'curl -d "Disk space on {{ inventory_hostname }} is above 80%!" ntfy.ki5bhv.com/server' when: disk_usage.stdout[:-1]|int>80