Created
May 18, 2020 20:23
-
-
Save wtip/681cd244611ff637756f15f3a895fabb to your computer and use it in GitHub Desktop.
Ansible task to change the reserved filesystem blocks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tasks: | |
- name: Change reserved blocks to 1 percent on ext4 filesystems that are not / mounted | |
shell: tune2fs -l {{ item.device }} | egrep "Reserved block count|Block count" | paste -sd\ | awk '{print ($7 / $3 * 100)}' | grep -q 1 || tune2fs -m1 {{ item.device }} | |
with_items: | |
- "{{ ansible_mounts }}" | |
when: item.fstype == 'ext4' and item.mount != '/' | |
register: tune2fs | |
changed_when: tune2fs.stdout != "" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment