35 lines
1.2 KiB
YAML
35 lines
1.2 KiB
YAML
---
|
|
- name: Syslog - Log Size Used
|
|
hosts: bigboot
|
|
become: false
|
|
gather_facts: true
|
|
|
|
tasks:
|
|
- name: Get filesystem info
|
|
ansible.builtin.set_fact:
|
|
boot_mount: "{{ ansible_mounts | selectattr('mount', 'equalto', '/boot') | first | default() }}"
|
|
root_mount: "{{ ansible_mounts | selectattr('mount', 'equalto', '/') | first | default() }}"
|
|
home_mount: "{{ ansible_mounts | selectattr('mount', 'equalto', '/home') | first | default() }}"
|
|
|
|
- name: Debug boot_mount
|
|
ansible.builtin.debug:
|
|
msg: "{{ boot_mount }}"
|
|
|
|
- name: Show size used -- /boot
|
|
ansible.builtin.debug:
|
|
msg: "{{ (boot_mount['block_used'] * boot_mount['block_size']) | human_readable }}"
|
|
when:
|
|
- boot_mount['block_used'] is defined
|
|
|
|
- name: Show size used -- /
|
|
ansible.builtin.debug:
|
|
msg: "{{ (root_mount['block_used'] * root_mount['block_size']) | human_readable }}"
|
|
when:
|
|
- root_mount | length > 0
|
|
|
|
- name: Show size used -- /home
|
|
ansible.builtin.debug:
|
|
msg: "{{ (home_mount['block_used'] * home_mount['block_size']) | human_readable }}"
|
|
when:
|
|
- home_mount | length > 0
|