Install zfs and sanoid

This commit is contained in:
Jake Howard 2020-07-26 18:03:09 +01:00
parent 5cb1a470ab
commit ebbd2a4015
Signed by: jake
GPG key ID: 57AFB45680EDD477
4 changed files with 50 additions and 0 deletions

View file

@ -49,3 +49,4 @@
- contessa
- statping
- upload
- zfs

View file

@ -0,0 +1,21 @@
######################################
# This is a sample sanoid.conf file. #
# It should go in /etc/sanoid. #
######################################
[tank]
use_template = production
recursive = yes
#############################
# templates below this line #
#############################
[template_production]
frequently = 0
hourly = 36
daily = 30
monthly = 3
yearly = 0
autosnap = yes
autoprune = yes

View file

@ -0,0 +1,12 @@
- name: Calculate ZFS ARC size
set_fact:
zfs_arc_size: "{{ (ansible_memtotal_mb * 1024 * 1024) * 0.15 }}"
- name: Enable zfs module
modprobe:
name: zfs
state: present
params: 'zfs_arc_max={{ zfs_arc_size }}'
- name: Sanoid
include: sanoid.yml

View file

@ -0,0 +1,16 @@
- name: Install Sanoid
package:
name: sanoid
become: true
- name: Sanoid config
template:
src: files/sanoid.conf
dest: /etc/sanoid/sanoid.conf
become: true
- name: Install sanoid cron job
cron:
name: sanoid
special_time: hourly
job: TZ=UTC sanoid