-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdefaults.jinja
156 lines (130 loc) · 3.8 KB
/
defaults.jinja
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
{% load_yaml as defaults %}
# enable cyclic data scrubbing of filesystem
# if enabled will execute once per month for 4 months, then once every 6 months
autoscrub:
enabled: false
pools:
- rpool
# enable cyclic "automatic" manual start of trimming the filesystem
# if enabled will execute a manual trimming once per month
autotrim:
enabled: false
pools:
- rpool
# enable cyclic rotating filesystem snapshots
autosnapshot:
enabled: false
# any fs where "com.sun:auto-snapshot" and "com.sun:auto-snapshot:<interval>"
# is not false, a rotating snapshot will be taken
# rotation intervals: keep x snapshots per interval, 0 to disable
frequent: 4 {# 15min intervals for the last hour #}
hourly: 8 {# 1hour intervals for the last 8 hours #}
daily: 8 {# 1day intervals for the last 8 days #}
weekly: 0 {# 1week intervals for the last 0 weeks #}
monthly: 0 {# 1month intervals for the last 0 months #}
# --min-size only available from github master
args: --quiet --syslog --default-exclude --fast --skip-scrub --min-size 1
# arc_max_percent: use up to x % of memory for arc
# arc_max_bytes: will be computed from arc_max_percent if unset
arc_max_limit: false
arc_max_percent: 25
{% endload %}
{% set settings=salt['grains.filter_by']({'default': defaults},
grain='default', default= 'default', merge= salt['pillar.get']('zfs', {})) %}
{% if settings.arc_max_bytes is not defined %}
{% do settings.update( {'arc_max_bytes':
((grains['mem_total'] * settings.arc_max_percent / 100 ) * 1024 * 1024)|round|int} ) %}
{% endif %}
{%- macro mksnapshot(spaces, frequent=false, hourly=false, daily=false, weekly=false, monthly=false) %}
{{ ''|indent(spaces,True) ~ '"com.sun:auto-snapshot:frequent": "'~ frequent~ '"' }}
{{ ''|indent(spaces,True) ~ '"com.sun:auto-snapshot:hourly": "'~ hourly~ '"' }}
{{ ''|indent(spaces,True) ~ '"com.sun:auto-snapshot:daily": "'~ daily~ '"' }}
{{ ''|indent(spaces,True) ~ '"com.sun:auto-snapshot:weekly": "'~ weekly~ '"' }}
{{ ''|indent(spaces,True) ~ '"com.sun:auto-snapshot:monthly": "'~ monthly~ '"' }}
{%- endmacro %}
{% load_yaml as zfs_pool_base %}
- name: ROOT
properties:
canmount: off
mountpoint: none
- name: ROOT/{{ grains['os']|lower }}
properties:
canmount: noauto
mountpoint: /
{{ mksnapshot(4,) }}
- name: var
properties:
canmount: off
logbias: throughput
local.custom:auto-backup: false
{{ mksnapshot(4, frequent=true) }}
- name: var/lib
properties:
canmount: off
- name: data
properties:
canmount: off
mountpoint: none
setuid: off
exec: off
{{ mksnapshot(4, frequent=true, hourly=true, daily=true) }}
{% endload %}
{% load_yaml as zfs_pool_defaults %}
# keep in sync with machine-bootstrap/bootstrap-library.sh@create_root_zpool
- name: data/home
properties:
mountpoint: /home
setuid: off
exec: on
- name: data/home/root
properties:
mountpoint: /root
- name: var/basedir-tmp
properties:
mountpoint: /tmp
- name: var/tmp
- name: var/spool
- name: var/log
properties:
exec: off
- name: var/cache
properties:
exec: off
# for postgresql
- name: data/postgresql
properties:
recordsize: 16K
logbias: throughput
primarycache: metadata
- name: data/postgresql/localhost
properties:
mountpoint: /var/lib/postgresql
# for mail
- name: data/mail
properties:
mountpoint: /var/lib/mail
# for apt based systems
- name: var/backups
- name: var/lib/apt-lists
properties:
exec: off
mountpoint: /var/lib/apt/lists
# for pbuilder
- name: var/cache/pbuilder
properties:
exec: on
devices: on
# for snaps
- name: var/lib/snapd
# for GNOME
#- name: var/lib/AccountsService
# for Docker
# - name: var/lib/docker
# for NFS
# - name: var/lib/nfs
# for LXC
# - name: var/lib/lxc
# for LibVirt
# - name: var/lib/libvirt
# keep in sync end
{% endload %}