Skip to content

Instantly share code, notes, and snippets.

@VerosK
Created October 13, 2021 09:08
Show Gist options
  • Save VerosK/28faad32d177a49ea946411c3bb81ed4 to your computer and use it in GitHub Desktop.
Save VerosK/28faad32d177a49ea946411c3bb81ed4 to your computer and use it in GitHub Desktop.
Get disk usage with Ansible
- name: Show FS info
hosts: all
gather_facts: yes
tasks:
- setup:
- name: Create summary report
template:
src: 'summary.txt.j2'
dest: reports/summary.txt
backup: yes
become: no
delegate_to: localhost
run_once: true
{% for host in hostvars %}
{% for mount in hostvars[host].ansible_mounts %}
{{ host }},{{ hostvars[host].ansible_fqdn }},{{ mount.mount }},{{ mount.size_available }},{{ mount.size_total }}
{% endfor %}
{% endfor %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment