Add fstrim timer to ansible play

This commit is contained in:
Wojciech Kozlowski 2018-12-18 01:41:47 +00:00
parent 96f6e3a427
commit 955aa64d87
3 changed files with 39 additions and 0 deletions

View File

@ -0,0 +1,6 @@
[Unit]
Description=Discard unused blocks
[Service]
Type=oneshot
ExecStart=/sbin/fstrim -av

View File

@ -0,0 +1,11 @@
[Unit]
Description=Discard unused blocks once a week
Documentation=man:fstrim
[Timer]
OnCalendar=weekly
AccuracySec=1h
Persistent=true
[Install]
WantedBy=timers.target

View File

@ -38,6 +38,28 @@
when: apt_update is changed
# -------------------------------------------------------------------------
# Loki uses SSDs so use fstrim on a timer.
# -------------------------------------------------------------------------
- name: Copy fstrim service file
copy:
src: ./etc/systemd/system/fstrim.service
dest: /etc/systemd/system/fstrim.service
mode: 0644
- name: Copy fstrim timer file
copy:
src: ./etc/systemd/system/fstrim.timer
dest: /etc/systemd/system/fstrim.timer
mode: 0644
- name: Enable and start fstrim.timer
service:
name: fstrim.timer
state: started
enabled: yes
# -------------------------------------------------------------------------
# Apparmor.
# -------------------------------------------------------------------------