blob: 344acf4db1cefad1caea9a28947c8f594b3a401e (
plain)
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
|
ZFS
===
Description
-----------
The `zfs` role configures ZFS pools and datasets.
Variables
---------
This role **accepts** the following variables:
Variable | Default | Description
------------------------------|-----------|------------
`zfs_pools` | `[]` | ZFS pools to create (see [format](#zfs_pools) below)
`zfs_datasets` | `[]` | ZFS datasets to create (see [format](#zfs_datasets) below)
`zfs_trim_on_calendar` | `monthly` | Systemd [calendar interval](https://www.freedesktop.org/software/systemd/man/systemd.time.html#Calendar%20Events) for ZFS SSD trim
`zfs_scrub_on_calendar` | `monthly` | Systemd [calendar interval](https://www.freedesktop.org/software/systemd/man/systemd.time.html#Calendar%20Events) for ZFS scrub
`zfs_zed_email` | `root` | Email address for ZFS Event Daemon (ZED) alerts
`zfs_zed_verbose` | yes | Show details in ZED emails
`zfs_zed_notify_interval_sec` | 3600 | Notification interval for ZED alerts (seconds)
`zfs_auto_snapshot_version` | `master` | Git version of [zfs-auto-snapshot](https://github.com/zfsonlinux/zfs-auto-snapshot) to install
### zfs\_pools
The `zfs_pools` variable specifies the ZFS pools to create on the host. It
should contain a list of dictionaries of the following format:
Key | Default | Description
-------------|----------------------|------------
`name` | | Name of the zpool
`properties` | `{}` | Dictionary of [zpool properties](https://openzfs.github.io/openzfs-docs/man/7/zpoolprops.7.html)
`mountpoint` | based on zpool name | Mountpoint of zpool
`vdevs` | | List of vdevs for pool (see [format](#vdevs) below)
### vdevs
The `vdevs` property of the `zfs_pools` variable lists the vdevs that comprise
a given zpool. It should contain a list of dictionaries of the following format:
Key | Default | Description
----------|---------|------------
`type` | | Either `raidz1`, `raidz2`, `raidz3`, `spare`, `log`, or `cache`
`devices` | | List of device names for the vdev
### zfs\_datasets
The `zfs_datasets` variable specifies the ZFS filesystems to create on the
host. It should contain a list of dictionaries of the following format:
Key | Default | Description
-------------|----------|------------
`name` | | Dataset name
`properties` | `{}` | Dictionary of [zfs properties](https://openzfs.github.io/openzfs-docs/man/7/zfsprops.7.html)
Usage
-----
Example playbook:
````yaml
- name: create ZFS pools
hosts: nas1
roles:
- role: zfs
vars:
zfs_scrub_on_calendar: monthly
zfs_trim_on_calendar: monthly
zfs_zed_email: sysadmins@example.com
zfs_pools:
- name: tank
mountpoint: /tank
properties:
ashift: 12
autotrim: 'on'
vdevs:
- type: raidz2
devices:
- /dev/disk/by-id/scsi-SSEAGATE_SSSSSSSSSSSS_00000001
- /dev/disk/by-id/scsi-SSEAGATE_SSSSSSSSSSSS_00000002
- /dev/disk/by-id/scsi-SSEAGATE_SSSSSSSSSSSS_00000003
- /dev/disk/by-id/scsi-SSEAGATE_SSSSSSSSSSSS_00000004
- /dev/disk/by-id/scsi-SSEAGATE_SSSSSSSSSSSS_00000005
- /dev/disk/by-id/scsi-SSEAGATE_SSSSSSSSSSSS_00000006
- /dev/disk/by-id/scsi-SSEAGATE_SSSSSSSSSSSS_00000007
- /dev/disk/by-id/scsi-SSEAGATE_SSSSSSSSSSSS_00000008
- type: raidz2
devices:
- /dev/disk/by-id/scsi-SSEAGATE_SSSSSSSSSSSS_00000009
- /dev/disk/by-id/scsi-SSEAGATE_SSSSSSSSSSSS_00000010
- /dev/disk/by-id/scsi-SSEAGATE_SSSSSSSSSSSS_00000011
- /dev/disk/by-id/scsi-SSEAGATE_SSSSSSSSSSSS_00000012
- /dev/disk/by-id/scsi-SSEAGATE_SSSSSSSSSSSS_00000013
- /dev/disk/by-id/scsi-SSEAGATE_SSSSSSSSSSSS_00000014
- /dev/disk/by-id/scsi-SSEAGATE_SSSSSSSSSSSS_00000015
- /dev/disk/by-id/scsi-SSEAGATE_SSSSSSSSSSSS_00000016
- type: log
devices:
- /dev/disk/by-id/nvme-INTEL_IIIIIIIIIIIII_000000000000000001
zfs_datasets:
- name: tank
properties:
compression: lz4
acltype: posix
xattr: sa
relatime: 'on'
com.sun:auto-snapshot:frequent: 'false'
````
|