diff --git a/files/fstrim.timer.debian b/files/fstrim.timer.debian new file mode 100644 index 0000000..c8d94d7 --- /dev/null +++ b/files/fstrim.timer.debian @@ -0,0 +1,11 @@ +[Unit] +Description=Discard unused blocks once a week +Documentation=man:fstrim + +[Timer] +OnCalendar=weekly +AccuracySec=1h +Persistent=true + +[Install] +WantedBy=multi-user.target diff --git a/tasks/main.yml b/tasks/main.yml index 0fc3ab9..ab06d52 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,7 +1,15 @@ --- +- name: Install custom fstrim.service + copy: src=fstrim.service dest=/etc/systemd/system/ + notify: systemd-daemon-reload + +- name: Install fstrim.timer on Debian + copy: src=fstrim.timer.debian dest=/etc/systemd/system/fstrim.timer + when: ansible_distribution == 'Debian' + notify: systemd-daemon-reload + - file: path=/etc/systemd/system/fstrim.timer.d state=directory - copy: src=10-daily.conf dest=/etc/systemd/system/fstrim.timer.d/10-daily.conf notify: systemd-daemon-reload + - service: name=fstrim.timer enabled=yes state=started -- copy: src=fstrim.service dest=/etc/systemd/system/ - notify: systemd-daemon-reload