homeserver/roles/mgrote.zfs_tools/tasks/main.yml

86 lines
2.2 KiB
YAML

- name: zfs-tools installieren
become: yes
apt:
name:
- zfsutils
- zfs-initramfs
- zfs-zed
state: present
- name: Limit ZFS Memory Usage
become: yes
lineinfile:
path: /etc/modprobe.d/zfs.conf
line: options zfs zfs_arc_max={{ zfs_arc_max }}
create: yes
- name: remove system scrub job #https://forum.proxmox.com/threads/script-sequential-zfs-scrub-for-cron.25124/
become: true
lineinfile:
path: /etc/cron.d/zfsutils-linux
state: absent
line: '24 0 8-14 * * root [ $(date +\%w) -eq 0 ] && [ -x /usr/lib/zfs-linux/scrub ] && /usr/lib/zfs-linux/scrub'
- name: erstelle Ordner "root-zfs"
become: yes
file:
path: /root/zfs
state: directory
- name: kopiere "zfs-health.sh"
become: yes
template:
src: zfs-health.sh
dest: /usr/local/bin/zfs-health.sh
mode: "+x"
- name: lege cronjob fuer "zfs-health.sh" an
become: yes
cron:
name: zfs-health
state: present
job: "/usr/local/bin/zfs-health.sh"
minute: "{{ cron_minutes_zfs_health }}"
hour: "{{ cron_hours_zfs_health }}"
- name: lege cronjob fuer "zfs-scrub" an
become: yes
cron:
name: zfs-scrub - "{{ item.name }}"
state: present
job: "{{ pfad_zu_zpool }} scrub {{ item.name }}"
weekday: "{{ item.cron_weekday_zfs_scrub }}"
minute: "{{ item.cron_minutes_zfs_scrub }}"
hour: "{{ item.cron_hour_zfs_scrub }}"
with_items: "{{ zfs_pool }}"
- name: lege cronjob fuer "zfs-trim" an
become: yes
cron:
name: zfs-trim - "{{ item.name }}"
state: present
job: "{{ pfad_zu_zpool }} trim {{ item.name }}"
minute: "{{ item.cron_minute_zfs_trim }}"
hour: "{{ item.cron_hour_zfs_trim }}"
month: "{{ item.cron_month_zfs_trim }}"
day: "{{ item.cron_day_zfs_trim }}"
# disabled: yes
when: item.type == 'ssd'
with_items: "{{ zfs_pool }}"
- name: kopiere zed.rc
become: yes
template:
owner: root
mode: 0600
src: zed.rc
dest: /etc/zfs/zed.d/zed.rc
notify: testmail
- name: copy zfs-free.sh
become: yes
template:
mode: 0555
src: zfs-free.sh
dest: /usr/local/bin/zfs-free.sh