Modified playbook to give fail message when disk space is nearly full
This commit is contained in:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user