diff --git a/playbooks/disk-space.yml b/playbooks/disk-space.yml index 4ce7892..1686801 100644 --- a/playbooks/disk-space.yml +++ b/playbooks/disk-space.yml @@ -3,6 +3,11 @@ hosts: all tasks: - name: Check free disk space - shell: df -kh / | tail -n1 | awk '{print $5}' + shell: df / --output\=avail | tail -1 register: free - - debug: var=free.stdout_lines + - name: free-space + debug: + msg: Available space = "{{ free.stdout|int / 1000000 }}" + - fail: + msg: / is nearly full + when: free.stdout|int is lt 3000000