zfs_datasets: Unterstützt jetzt alle Parameter (#284)
Co-authored-by: Michael Grote <michael.grote@posteo.de> Reviewed-on: mg/ansible#284 Co-authored-by: mg <michael.grote@posteo.de> Co-committed-by: mg <michael.grote@posteo.de>
This commit is contained in:
parent
5c67dc8e30
commit
c8a79e890c
2 changed files with 71 additions and 46 deletions
|
@ -1,37 +1,27 @@
|
|||
## mgrote.zfs_manage_datasets
|
||||
|
||||
### Beschreibung
|
||||
Erstellt Datasets/setzt Optionen pro Dataset.
|
||||
Kann Datasets löschen.
|
||||
Die Pools müssen vorher existieren.
|
||||
Beim ersten ausführen wird es wahrscheinlich zu Status: "changed" kommen, weil:
|
||||
```bash
|
||||
ssd_vm_mirror/vm xattr sa inherited from ssd_vm_mirror
|
||||
ssd_vm_mirror/vm xattr sa local
|
||||
```
|
||||
Die Attribute werden nicht mehr vererbt sondern als "local" gesetzt
|
||||
### Description
|
||||
Creates Datasets, can set options.
|
||||
This role does not create the pools.
|
||||
Attributes get set `local` per dataset.
|
||||
|
||||
### getestet auf
|
||||
|
||||
### tested on
|
||||
- [x] ProxMox 6.1
|
||||
- [x] ProxMox 7*
|
||||
|
||||
### Variablen + Defaults
|
||||
#### Standardwerte
|
||||
```
|
||||
- see [default-filter](./tasks/main.yml)
|
||||
- all Variables from `man 8 zfs` are optional but not the name(dataset)
|
||||
|
||||
#### Example
|
||||
```yaml
|
||||
zfs_datasets:
|
||||
- dataset: rpool/vm
|
||||
state: present
|
||||
compression: lz4
|
||||
sync: standard
|
||||
xattr: on
|
||||
dnodesize: auto
|
||||
atime: off
|
||||
snapdir: hidden
|
||||
```
|
||||
#### Empfohlen für VMs
|
||||
```
|
||||
state: present
|
||||
compression: lz4
|
||||
sync: disabled
|
||||
xattr: sa
|
||||
dnodesize: auto
|
||||
atime: off
|
||||
compression: zstd
|
||||
- dataset: tank/vm/dir/fileserver2_test
|
||||
state: present
|
||||
atime: on
|
||||
snapdir: hidden
|
||||
```
|
||||
|
|
|
@ -1,24 +1,59 @@
|
|||
---
|
||||
- name: create datasets
|
||||
become: true
|
||||
community.general.zfs:
|
||||
name: "{{ item.dataset }}"
|
||||
state: "{{ item.state | default('present') }}"
|
||||
loop: "{{ zfs_datasets }}"
|
||||
when: zfs_datasets is defined # führe nur aus wenn die Variable gesetzt ist
|
||||
|
||||
- name: set zfs properties per datasets
|
||||
- name: create datasets or set options
|
||||
become: true
|
||||
community.general.zfs:
|
||||
name: "{{ item.dataset }}"
|
||||
state: "{{ item.state | default('present') }}"
|
||||
extra_zfs_properties:
|
||||
compression: "{{ item.compression | default('lz4') }}"
|
||||
sync: "{{ item.sync | default('standard') }}"
|
||||
xattr: "{{ item.xattr | default('on') }}"
|
||||
dnodesize: "{{ item.dnodesize | default('auto') }}"
|
||||
atime: "{{ item.atime | default('off') }}"
|
||||
snapdir: "{{ item.snapdir | default('hidden') }}"
|
||||
recordsize: "{{ item.recordsize | default('128K') }}"
|
||||
quota: "{{ item.quota | default(omit) }}"
|
||||
reservation: "{{ item.reservation | default(omit) }}"
|
||||
recordsize: "{{ item.recordsize | default(omit) }}"
|
||||
mountpoint: "{{ item.mountpoint | default(omit) }}"
|
||||
sharenfs: "{{ item.sharenfs | default(omit) }}"
|
||||
checksum: "{{ item.checksum | default(omit) }}"
|
||||
compression: "{{ item.compression | default(omit) }}"
|
||||
atime: "{{ item.atime | default(omit) }}"
|
||||
devices: "{{ item.devices | default(omit) }}"
|
||||
exec: "{{ item.exec | default(omit) }}"
|
||||
setuid: "{{ item.setuid | default(omit) }}"
|
||||
readonly: "{{ item.readonly | default(omit) }}"
|
||||
zoned: "{{ item.zoned | default(omit) }}"
|
||||
snapdir: "{{ item.snapdir | default(omit) }}"
|
||||
aclmode: "{{ item.aclmode | default(omit) }}"
|
||||
aclinherit: "{{ item.aclinherit | default(omit) }}"
|
||||
canmount: "{{ item.canmount | default(omit) }}"
|
||||
xattr: "{{ item.xattr | default(omit) }}"
|
||||
copies: "{{ item.copies | default(omit) }}"
|
||||
vscan: "{{ item.vscan | default(omit) }}"
|
||||
nbmand: "{{ item.nbmand | default(omit) }}"
|
||||
sharesmb: "{{ item.sharesmb | default(omit) }}"
|
||||
refquota: "{{ item.refquota | default(omit) }}"
|
||||
refreservation: "{{ item.refreservation | default(omit) }}"
|
||||
primarycache: "{{ item.primarycache | default(omit) }}"
|
||||
secondarycache: "{{ item.secondarycache | default(omit) }}"
|
||||
logbias: "{{ item.logbias | default(omit) }}"
|
||||
dedup: "{{ item.dedup | default(omit) }}"
|
||||
mlslabel: "{{ item.mlslabel | default(omit) }}"
|
||||
sync: "{{ item.sync | default(omit) }}"
|
||||
dnodesize: "{{ item.dnodesize | default(omit) }}"
|
||||
volmode: "{{ item.volmode | default(omit) }}"
|
||||
filesystem_limit: "{{ item.filesystem_limit | default(omit) }}"
|
||||
snapshot_limit: "{{ item.snapshot_limit | default(omit) }}"
|
||||
filesystem_count: "{{ item.filesystem_count | default(omit) }}"
|
||||
snapshot_count: "{{ item.snapshot_count | default(omit) }}"
|
||||
snapdev: "{{ item.snapdev | default(omit) }}"
|
||||
acltype: "{{ item.acltype | default(omit) }}"
|
||||
context: "{{ item.context | default(omit) }}"
|
||||
fscontext: "{{ item.fscontext | default(omit) }}"
|
||||
defcontext: "{{ item.defcontext | default(omit) }}"
|
||||
rootcontext: "{{ item.rootcontext | default(omit) }}"
|
||||
relatime: "{{ item.relatime | default(omit) }}"
|
||||
redundant_metadata: "{{ item.redundant_metadata | default(omit) }}"
|
||||
overlay: "{{ item.overlay | default(omit) }}"
|
||||
encryption: "{{ item.encryption | default(omit) }}"
|
||||
keylocation: "{{ item.keylocation | default(omit) }}"
|
||||
keyformat: "{{ item.keyformat | default(omit) }}"
|
||||
pbkdf2iters: "{{ item.pbkdf2iters | default(omit) }}"
|
||||
special_small_blocks: "{{ item.special_small_blocks | default(omit) }}"
|
||||
loop: "{{ zfs_datasets }}"
|
||||
when: zfs_datasets is defined # führe nur aus wenn die Variable gesetzt ist
|
||||
|
|
Loading…
Reference in a new issue