deploy-base/roles/zfs/tasks/main.yml

39 lines
1.3 KiB
YAML

---
- name: include zfs-release tasks (CentOS/RHEL/Fedora)
include_tasks: zfs-release.yml
when: ('zfs-release' not in ansible_facts.packages) and (ansible_distribution in ["CentOS" , "Red Hat Enterprise Linux", "Fedora" ])
- name: include zfs installation tasks (Ubuntu)
include_tasks: ubuntu.yml
when: ansible_distribution in ["Ubuntu"]
- name: include zfs installation tasks (CentOS/RHEL/Fedora)
include_tasks: el.yml
when: (ansible_distribution in ["CentOS" , "Red Hat Enterprise Linux", "Fedora" ] and not is_atomic)
- name: load zfs module
modprobe:
name: zfs
state: present
- name: add zfs to modules-load.d
copy:
dest: "/etc/modules-load.d/zfs.conf"
content: |
zfs
register: zfsload
# does not adjust to 20% of each host, depends on consistency between hosts - inconsistency leads to disproportionate allocations
- name: set zfs_arc_max to 20% installed memory ({{ zfs_arc_size_bytes }} bytes)
lineinfile:
path: "/etc/modprobe.d/zfs.conf"
regexp: '^options zfs zfs_arc_max='
line: 'options zfs zfs_arc_max="{{ zfs_arc_size_bytes }}"'
create: yes
# really bad idempotence in here...
#- name: create zpool
# command: "zpool create -f -O compression=lz4 data {{ zfs_disk }} -o ashift=13 -O secondarycache=all"
# args:
# creates: /etc/zvol/data/*