Add fstrim timer to ansible play
This commit is contained in:
parent
96f6e3a427
commit
955aa64d87
6
ansible/etc/systemd/system/fstrim.service
Normal file
6
ansible/etc/systemd/system/fstrim.service
Normal file
@ -0,0 +1,6 @@
|
||||
[Unit]
|
||||
Description=Discard unused blocks
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/sbin/fstrim -av
|
11
ansible/etc/systemd/system/fstrim.timer
Normal file
11
ansible/etc/systemd/system/fstrim.timer
Normal 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
|
@ -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.
|
||||
# -------------------------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user