diff --git a/basic-system/defaults/main.yml b/basic-system/defaults/main.yml index 0b0bcf21855d346610fcdbb07a3323b2edd557d1..f706b44a9a244a6b443177accd9f1a5eeb9e359d 100644 --- a/basic-system/defaults/main.yml +++ b/basic-system/defaults/main.yml @@ -15,3 +15,4 @@ tmp_mount_options: - nosuid - nodev - noexec +fstrim: false diff --git a/basic-system/files/fstrim b/basic-system/files/fstrim new file mode 100755 index 0000000000000000000000000000000000000000..b1816b2b6aeb7df5f9efd711cd7e887c65aa06bc --- /dev/null +++ b/basic-system/files/fstrim @@ -0,0 +1,5 @@ +#!/bin/sh +set -e +if command -v fstrim >/dev/null; then + fstrim -a +fi diff --git a/basic-system/tasks/main.yml b/basic-system/tasks/main.yml index 9f0ece02a89756e14a1ca32931b8cc60113b6e94..6b38272e797574a1eb95e3af7efa89c84a579a90 100644 --- a/basic-system/tasks/main.yml +++ b/basic-system/tasks/main.yml @@ -54,6 +54,17 @@ tags: - etckeeper +- name: Configure fstrim cronjob + copy: + src: fstrim + dest: /etc/cron.daily/fstrim + owner: root + group: root + mode: '0755' + when: fstrim + tags: + - fstrim + - include: logging.yml - meta: flush_handlers - include: network.yml