Install zfs and sanoid
This commit is contained in:
parent
5cb1a470ab
commit
ebbd2a4015
4 changed files with 50 additions and 0 deletions
|
@ -49,3 +49,4 @@
|
||||||
- contessa
|
- contessa
|
||||||
- statping
|
- statping
|
||||||
- upload
|
- upload
|
||||||
|
- zfs
|
||||||
|
|
21
ansible/roles/zfs/files/sanoid.conf
Normal file
21
ansible/roles/zfs/files/sanoid.conf
Normal 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
|
12
ansible/roles/zfs/tasks/main.yml
Normal file
12
ansible/roles/zfs/tasks/main.yml
Normal 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
|
16
ansible/roles/zfs/tasks/sanoid.yml
Normal file
16
ansible/roles/zfs/tasks/sanoid.yml
Normal 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
|
Loading…
Reference in a new issue