homeserver/roles/mgrote.zfs_tools/tasks/main.yml
mg 1fc7975323 Sanoid Templates als Variablen (#19)
Aufräumen

In GroupVars eingebaut

Templates als Vars

Doku aktualisiert

Typo

neues Dictionary-Format

Vars: zfs_pool --> zfs_pools

Co-authored-by: Michael Grote <38253905+quotengrote@users.noreply.github.com>
Reviewed-on: mg/ansible#19
Co-Authored-By: mg <michael.grote@posteo.de>
Co-Committed-By: mg <michael.grote@posteo.de>
2020-12-31 01:36:22 +01:00

97 lines
2.7 KiB
YAML

- name: zfs-tools installieren
become: yes
ansible.builtin.apt:
name:
- zfsutils
- zfs-initramfs
- zfs-zed
state: present
- name: Limit ZFS Memory Usage
become: yes
ansible.builtin.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
ansible.builtin.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
ansible.builtin.file:
path: /root/zfs
state: directory
- name: kopiere "zfs-health.sh"
become: yes
ansible.builtin.template:
src: zfs-health.sh
dest: /usr/local/bin/zfs-health.sh
mode: "+x"
- name: lege cronjob fuer "zfs-health.sh" an
become: yes
ansible.builtin.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
ansible.builtin.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_pools }}"
- name: lege cronjob fuer "zfs-trim" an
become: yes
ansible.builtin.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_pools }}"
- name: kopiere zed.rc
become: yes
ansible.builtin.template:
owner: root
mode: 0600
src: zed.rc
dest: /etc/zfs/zed.d/zed.rc
notify: testmail
- name: copy zfs-free.sh
become: yes
ansible.builtin.template:
mode: 0555
src: zfs-free.sh
dest: /usr/local/bin/zfs-free.sh
- name: Erlaube "non-root" Usern Read-Only ZFS Commands
become: yes
ansible.builtin.template:
src: sudoers_zfs
dest: /etc/sudoers.d/zfs
owner: root
group: root
force: yes
backup: yes
mode: 0440
validate: /usr/sbin/visudo -cf %s