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

98 lines
2.7 KiB
YAML
Raw Normal View History

2020-08-18 11:57:53 +02:00
- name: zfs-tools installieren
become: yes
ansible.builtin.package:
2020-08-18 11:57:53 +02:00
name:
- zfsutils
- zfs-initramfs
- zfs-zed
state: present
- name: Limit ZFS Memory Usage
become: yes
ansible.builtin.lineinfile:
2020-08-18 11:57:53 +02:00
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:
2020-08-18 11:57:53 +02:00
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:
2020-08-18 11:57:53 +02:00
path: /root/zfs
state: directory
- name: kopiere "zfs-health.sh"
become: yes
ansible.builtin.template:
2020-08-18 11:57:53 +02:00
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:
2020-08-18 11:57:53 +02:00
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:
2020-08-18 11:57:53 +02:00
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 }}"
2020-08-18 11:57:53 +02:00
- name: lege cronjob fuer "zfs-trim" an
become: yes
ansible.builtin.cron:
2020-08-18 11:57:53 +02:00
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 }}"
2020-08-18 11:57:53 +02:00
- name: kopiere zed.rc
become: yes
ansible.builtin.template:
2020-08-18 11:57:53 +02:00
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:
2020-08-18 11:57:53 +02:00
mode: 0555
src: zfs-free.sh
2020-08-18 11:57:53 +02:00
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