Ansible/yml/linux-update-diskspace.yml
2023-07-03 20:39:45 +02:00

22 lines
569 B
YAML

- hosts: "{{ host }}"
tasks:
- name: Get disk usage
commande: df -h
register: disk_usage
- name: Check disk space available
shell: df -h / | awk 'NR==2 {print $5}'
register: disk_usage
# Send Discord message when disk space is over 80%
-name: Send Discord message
uri:
url: ""
method: POST
body_format: json
body: '{"content": "Disk space on {{ inventory_hostname }} is above 80% !"}'
headers:
Content-Type: application/json
status_code: 204
when: disk_usage.stout[:-1]|int > 80