maint-diskspace 626 B

1234567891011121314151617181920
  1. ---
  2. - name: check disk space
  3. hosts: "{{ hosts }}"
  4. tasks:
  5. - name: get disk usage
  6. command: df -h
  7. register: disk_usage
  8. - name: check disk space available
  9. shell: df -h / | awk 'NR==2 {print $5}'
  10. register: disk_usage
  11. # - name: send discord message when disk space is over 80%
  12. # uri:
  13. # url: "your-webhook"
  14. # method: POST
  15. # body_format: json
  16. # body: '{"content": "Disk space on {{ inventory_hostname }} is above 80%!"}'
  17. # headers:
  18. # Content-Type: application/json
  19. # status_code: 204
  20. # when: disk_usage.stdout[:-1]|int > 80