Modified playbook to give fail message when disk space is nearly full

This commit is contained in:
2024-01-26 15:38:37 +05:30
parent dbffacabee
commit b7b0c0a5cd

View File

@@ -3,6 +3,11 @@
hosts: all hosts: all
tasks: tasks:
- name: Check free disk space - name: Check free disk space
shell: df -kh / | tail -n1 | awk '{print $5}' shell: df / --output\=avail | tail -1
register: free 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