Commit 7bea2e8d authored by Guillaume Hervier's avatar Guillaume Hervier Committed by Rafael Monnerat

playbook: Add fstrim timer role

parent 9a1a2cb3
---
dependencies:
- role: package
package_name: util-linux
package_state: present
---
- name: Check if fstrim command exists
stat:
path: /sbin/fstrim
register: fstrim
- name: Install systemd files
template:
src: '{{ item }}'
dest: '/etc/systemd/system/'
owner: root
group: root
mode: 0644
with_items:
- fstrim.service
- fstrim.timer
when: fstrim.stat.exists
- name: Enable fstrim timer
service:
name: fstrim.timer
enabled: true
when: fstrim.stat.exists
[Unit]
Description=Discard unused blocks
[Service]
Type=oneshot
ExecStart=/sbin/fstrim -a
[Unit]
Description=Discard unused blocks once a week
Documentation=man:fstrim
[Timer]
OnCalendar=weekly
AccuracySec=1h
Persistent=true
[Install]
WantedBy=multi-user.target
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment