1

There is a module that allow me to check disk space of a folder like the command df -h /path/to/folder?
i want to avoid to use shell or command module, i can't believe there is no module for it

Mirco
  • 212
  • 3
  • 12

1 Answers1

-1

I don't think there's any module for this. You would need to use something like the example below with the command or shell module.

- name: Check sufficient free space in directory
  command: "df {{ target_dir }}"
  register: space
  become: true

- set_fact:
    free_space_bytes: "{{ (space.stdout_lines[1] | split)[3] }}"