From 22625ac4e802a2317d0ad723a8d7f292ecf10fbe Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Mon, 11 May 2020 03:47:35 +0200 Subject: add host sk-tomnext --- roles/zfs/base/tasks/Debian.yml | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'roles/zfs/base/tasks') diff --git a/roles/zfs/base/tasks/Debian.yml b/roles/zfs/base/tasks/Debian.yml index b9fdda95..e13c03f5 100644 --- a/roles/zfs/base/tasks/Debian.yml +++ b/roles/zfs/base/tasks/Debian.yml @@ -3,9 +3,28 @@ import_role: name: prepare-dkms -## TODO: make sure contrib repo is enabled +- name: check if contrib apt component is enabled + assert: + msg: "Debian zfs packages are in contrib - please enable it using 'apt_repo_components'" + that: + - apt_repo_components is defined + - "'contrib' in apt_repo_components" -- name: install zfs-dkms +- name: install zfs-dkms (buster) + when: (ansible_distribution_major_version | int) == 10 + block: + - name: add backports repo + include_role: + name: apt-repo/backports + + - name: install zfs-dkms from backports + apt: + name: zfs-dkms + default_release: buster-backports + state: present + +- name: install zfs-dkms (bullseye and beyond) + when: (ansible_distribution_major_version | int) > 10 apt: name: zfs-dkms state: present -- cgit v1.2.3 From 4cbd0da346c2088933fbeca285f3c1bd2272b80b Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Tue, 12 May 2020 00:40:37 +0200 Subject: fix zfs role for buster --- roles/vm/host/tasks/network.yml | 1 + roles/zfs/base/tasks/Debian.yml | 25 +++++++++++++++++++------ roles/zfs/base/tasks/Ubuntu.yml | 5 ++++- roles/zfs/base/tasks/main.yml | 7 +------ 4 files changed, 25 insertions(+), 13 deletions(-) (limited to 'roles/zfs/base/tasks') diff --git a/roles/vm/host/tasks/network.yml b/roles/vm/host/tasks/network.yml index bc207805..0688ec42 100644 --- a/roles/vm/host/tasks/network.yml +++ b/roles/vm/host/tasks/network.yml @@ -69,3 +69,4 @@ label: "br-{{ item.item.key }}" when: item is changed command: "/sbin/ifup br-{{ item.item.key }}" + failed_when: false diff --git a/roles/zfs/base/tasks/Debian.yml b/roles/zfs/base/tasks/Debian.yml index e13c03f5..2a3d608e 100644 --- a/roles/zfs/base/tasks/Debian.yml +++ b/roles/zfs/base/tasks/Debian.yml @@ -10,24 +10,37 @@ - apt_repo_components is defined - "'contrib' in apt_repo_components" -- name: install zfs-dkms (buster) +- name: install zfs-dkms and utilities (buster) when: (ansible_distribution_major_version | int) == 10 block: - name: add backports repo include_role: name: apt-repo/backports - - name: install zfs-dkms from backports + - name: install zfs modules via dkms apt: name: zfs-dkms default_release: buster-backports state: present -- name: install zfs-dkms (bullseye and beyond) + - name: install zfs file system utilities + apt: + name: zfsutils-linux + default_release: buster-backports + state: present + +- name: install zfs-dkms and utilities (bullseye and beyond) when: (ansible_distribution_major_version | int) > 10 - apt: - name: zfs-dkms - state: present + block: + - name: install zfs modules via dkms + apt: + name: zfs-dkms + state: present + + - name: install zfs file system utilities + apt: + name: zfsutils-linux + state: present - name: check if module is available for the currently running kernel command: modprobe --dry-run zfs diff --git a/roles/zfs/base/tasks/Ubuntu.yml b/roles/zfs/base/tasks/Ubuntu.yml index 0ce85358..d45c30e4 100644 --- a/roles/zfs/base/tasks/Ubuntu.yml +++ b/roles/zfs/base/tasks/Ubuntu.yml @@ -1,2 +1,5 @@ --- -# Nothing to do here. +- name: install zfs file system utilities + apt: + name: zfsutils-linux + state: present diff --git a/roles/zfs/base/tasks/main.yml b/roles/zfs/base/tasks/main.yml index e6f2347b..ec1b04bf 100644 --- a/roles/zfs/base/tasks/main.yml +++ b/roles/zfs/base/tasks/main.yml @@ -7,7 +7,7 @@ options zfs zfs_arc_max={{ zfs_arc_size.max }} dest: /etc/modprobe.d/zfs.conf -- name: install zfs modules +- name: install zfs modules and utilities include_tasks: "{{ ansible_distribution }}.yml" - name: load zfs kernel module @@ -15,11 +15,6 @@ name: zfs state: present -- name: install zfs file system utilities - apt: - name: zfsutils-linux - state: present - - name: create zpools loop: "{{ zfs_zpools | dict2items }}" loop_control: -- cgit v1.2.3 From e3f04b3a488adb06b0fec892cf1b85fc15ed5ed7 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Fri, 22 May 2020 01:28:54 +0200 Subject: zfs: enable systemd mount-generator --- roles/zfs/base/tasks/Debian.yml | 38 +++++++++++++------------------------- roles/zfs/base/tasks/Ubuntu.yml | 5 +---- roles/zfs/base/tasks/main.yml | 29 ++++++++++++++++++++++++++++- 3 files changed, 42 insertions(+), 30 deletions(-) (limited to 'roles/zfs/base/tasks') diff --git a/roles/zfs/base/tasks/Debian.yml b/roles/zfs/base/tasks/Debian.yml index 2a3d608e..a1ed0387 100644 --- a/roles/zfs/base/tasks/Debian.yml +++ b/roles/zfs/base/tasks/Debian.yml @@ -10,37 +10,25 @@ - apt_repo_components is defined - "'contrib' in apt_repo_components" -- name: install zfs-dkms and utilities (buster) +- name: enable backports and force ZFS packages from backports for buster when: (ansible_distribution_major_version | int) == 10 block: - name: add backports repo include_role: name: apt-repo/backports - - name: install zfs modules via dkms - apt: - name: zfs-dkms - default_release: buster-backports - state: present - - - name: install zfs file system utilities - apt: - name: zfsutils-linux - default_release: buster-backports - state: present - -- name: install zfs-dkms and utilities (bullseye and beyond) - when: (ansible_distribution_major_version | int) > 10 - block: - - name: install zfs modules via dkms - apt: - name: zfs-dkms - state: present - - - name: install zfs file system utilities - apt: - name: zfsutils-linux - state: present + - name: pin zfs packages to buster-backports + copy: + content: | + Package: libnvpair1linux libuutil1linux libzfs2linux libzpool2linux spl-dkms zfs-dkms zfs-test zfsutils-linux zfsutils-linux-dev zfs-zed + Pin: release n=buster-backports + Pin-Priority: 990 + dest: /etc/apt/preferences.d/zfs-from-buster-backports + +- name: install zfs modules via dkms + apt: + name: zfs-dkms + state: present - name: check if module is available for the currently running kernel command: modprobe --dry-run zfs diff --git a/roles/zfs/base/tasks/Ubuntu.yml b/roles/zfs/base/tasks/Ubuntu.yml index d45c30e4..9745d716 100644 --- a/roles/zfs/base/tasks/Ubuntu.yml +++ b/roles/zfs/base/tasks/Ubuntu.yml @@ -1,5 +1,2 @@ --- -- name: install zfs file system utilities - apt: - name: zfsutils-linux - state: present +## nothing to do here - zfs modules are part of ubuntu core already diff --git a/roles/zfs/base/tasks/main.yml b/roles/zfs/base/tasks/main.yml index ec1b04bf..e86b974b 100644 --- a/roles/zfs/base/tasks/main.yml +++ b/roles/zfs/base/tasks/main.yml @@ -7,7 +7,7 @@ options zfs zfs_arc_max={{ zfs_arc_size.max }} dest: /etc/modprobe.d/zfs.conf -- name: install zfs modules and utilities +- name: install zfs modules include_tasks: "{{ ansible_distribution }}.yml" - name: load zfs kernel module @@ -15,6 +15,33 @@ name: zfs state: present +- name: install zed and zfs file system utilities + apt: + name: + - zfsutils-linux + - zfs-zed + state: present + +- name: enable zfs-list-cacher zlet for systemd zfs-mount-generator + file: + src: /usr/lib/zfs-linux/zed.d/history_event-zfs-list-cacher.sh + dest: /etc/zfs/zed.d/history_event-zfs-list-cacher.sh + state: link + +- name: create base-directory for zfs-list.cache + file: + path: /etc/zfs/zfs-list.cache/ + state: directory + +- name: create zfs-list.cache file for zpools + loop: "{{ zfs_zpools | dict2items }}" + loop_control: + label: "{{ item.key }}" + copy: + content: "" + dest: "/etc/zfs/zfs-list.cache/{{ item.key }}" + force: no + - name: create zpools loop: "{{ zfs_zpools | dict2items }}" loop_control: -- cgit v1.2.3 From dac9084c7038992d275cde0723cf05a9741a44e3 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sat, 23 May 2020 01:45:06 +0200 Subject: make use of zfs-mount-generator configureable --- inventory/host_vars/sk-2019.yml | 14 +++--- inventory/host_vars/sk-2019vm.yml | 52 +++++++++++----------- inventory/host_vars/sk-cloudia/vars.yml | 10 +++-- roles/zfs/base/defaults/main.yml | 9 ++-- .../base/tasks/enable-systemd-mount-generator.yml | 23 ++++++++++ roles/zfs/base/tasks/main.yml | 22 ++------- 6 files changed, 72 insertions(+), 58 deletions(-) create mode 100644 roles/zfs/base/tasks/enable-systemd-mount-generator.yml (limited to 'roles/zfs/base/tasks') diff --git a/inventory/host_vars/sk-2019.yml b/inventory/host_vars/sk-2019.yml index 9de2b04a..f54d852f 100644 --- a/inventory/host_vars/sk-2019.yml +++ b/inventory/host_vars/sk-2019.yml @@ -10,12 +10,13 @@ install: network: {} base_intel_nic_stability_fix: true +ssh_keys_root: "{{ ssh_keys.equinox[env_group] + ssh_keys.dan + ssh_keys.brt }}" +ssh_allowusers_host: "{{ admin_user_host | map(attribute='name') | list }}" + admin_user_host: - "{{ brt_user }}" -ssh_keys_root: "{{ ssh_keys.equinox[env_group] + ssh_keys.dan + ssh_keys.brt }}" -ssh_allowusers_host: "{{ admin_user_host | map(attribute='name') | list }}" cryptdisk_volumes: @@ -27,11 +28,12 @@ cryptdisk_volumes: device: /dev/disk/by-id/nvme-eui.0025388791050fdc-part3 +zfs_use_systemd_mount_generator: no +zfs_arc_size: + min: "{{ 2 * 1024 * 1024 * 1024 }}" + max: "{{ 12 * 1024 * 1024 * 1024 }}" + zfs_zpools: storage: mountpoint: /srv/storage create_vdevs: mirror /dev/mapper/crypto-nvme0 /dev/mapper/crypto-nvme1 - -# zfs_arc_size: -# min: "{{ 2 * 1024 * 1024 * 1024 }}" -# max: "{{ 16 * 1024 * 1024 * 1024 }}" diff --git a/inventory/host_vars/sk-2019vm.yml b/inventory/host_vars/sk-2019vm.yml index 723d0b5c..f9bfb0bb 100644 --- a/inventory/host_vars/sk-2019vm.yml +++ b/inventory/host_vars/sk-2019vm.yml @@ -10,6 +10,33 @@ install: network: {} base_intel_nic_stability_fix: true +ssh_keys_root: "{{ ssh_keys.equinox[env_group] + ssh_keys.dan }}" + +apt_repo_components: +- main +- contrib ## for zfs +- non-free ## for microcode updates + + +cryptdisk_volumes: + crypto-nvme0: + passphrase: "{{ vault_cryptdisk_volumes['crypto-nvme0'].passphrase }}" + device: /dev/disk/by-id/nvme-eui.0025388291b201dc-part3 + crypto-nvme1: + passphrase: "{{ vault_cryptdisk_volumes['crypto-nvme1'].passphrase }}" + device: /dev/disk/by-id/nvme-eui.0025388291b201cb-part3 + + +zfs_use_systemd_mount_generator: no +zfs_arc_size: + min: "{{ 2 * 1024 * 1024 * 1024 }}" + max: "{{ 8 * 1024 * 1024 * 1024 }}" + +zfs_zpools: + storage: + mountpoint: /srv/storage + create_vdevs: mirror /dev/mapper/crypto-nvme0 /dev/mapper/crypto-nvme1 + vm_host: network: @@ -37,28 +64,3 @@ vm_host: ele-gwhetzner: 2 ch-mimas: 6 sk-testvm: 7 - -ssh_keys_root: "{{ ssh_keys.equinox[env_group] + ssh_keys.dan }}" - -apt_repo_components: -- main -- contrib ## for zfs -- non-free ## for microcode updates - -cryptdisk_volumes: - crypto-nvme0: - passphrase: "{{ vault_cryptdisk_volumes['crypto-nvme0'].passphrase }}" - device: /dev/disk/by-id/nvme-eui.0025388291b201dc-part3 - crypto-nvme1: - passphrase: "{{ vault_cryptdisk_volumes['crypto-nvme1'].passphrase }}" - device: /dev/disk/by-id/nvme-eui.0025388291b201cb-part3 - - -zfs_zpools: - storage: - mountpoint: /srv/storage - create_vdevs: mirror /dev/mapper/crypto-nvme0 /dev/mapper/crypto-nvme1 - -zfs_arc_size: - min: "{{ 2 * 1024 * 1024 * 1024 }}" - max: "{{ 8 * 1024 * 1024 * 1024 }}" diff --git a/inventory/host_vars/sk-cloudia/vars.yml b/inventory/host_vars/sk-cloudia/vars.yml index 15dcb860..085a9c95 100644 --- a/inventory/host_vars/sk-cloudia/vars.yml +++ b/inventory/host_vars/sk-cloudia/vars.yml @@ -11,15 +11,17 @@ network: {} base_intel_nic_stability_fix: true -zfs_zpools: - storage: - mountpoint: /srv/storage - create_vdevs: mirror nvme0n1p3 nvme1n1p3 +zfs_use_systemd_mount_generator: no zfs_arc_size: min: "{{ 2 * 1024 * 1024 * 1024 }}" max: "{{ 16 * 1024 * 1024 * 1024 }}" +zfs_zpools: + storage: + mountpoint: /srv/storage + create_vdevs: mirror nvme0n1p3 nvme1n1p3 + docker_zfs: pool: storage diff --git a/roles/zfs/base/defaults/main.yml b/roles/zfs/base/defaults/main.yml index f3dfbce9..c275b981 100644 --- a/roles/zfs/base/defaults/main.yml +++ b/roles/zfs/base/defaults/main.yml @@ -1,4 +1,9 @@ --- +zfs_use_systemd_mount_generator: yes +#zfs_arc_size: +# min: {{ 2 * 1024 * 1024 * 1024 }} +# max: {{ 8 * 1024 * 1024 * 1024 }} + zfs_zpool_properties: ashift: 12 @@ -12,7 +17,3 @@ zfs_zpool_properties: # properties: # ashift: 12 # prop: value - -#zfs_arc_size: -# min: {{ 2 * 1024 * 1024 * 1024 }} -# max: {{ 8 * 1024 * 1024 * 1024 }} diff --git a/roles/zfs/base/tasks/enable-systemd-mount-generator.yml b/roles/zfs/base/tasks/enable-systemd-mount-generator.yml new file mode 100644 index 00000000..abefbeb1 --- /dev/null +++ b/roles/zfs/base/tasks/enable-systemd-mount-generator.yml @@ -0,0 +1,23 @@ +--- +- name: enable zfs-list-cacher zlet + file: + src: /usr/lib/zfs-linux/zed.d/history_event-zfs-list-cacher.sh + dest: /etc/zfs/zed.d/history_event-zfs-list-cacher.sh + state: link + +- name: create base-directory for zfs-list.cache + file: + path: /etc/zfs/zfs-list.cache/ + state: directory + +- name: create zfs-list.cache file for zpools + loop: "{{ zfs_zpools | dict2items }}" + loop_control: + label: "{{ item.key }}" + copy: + content: "" + dest: "/etc/zfs/zfs-list.cache/{{ item.key }}" + force: no + +## TODO: if this is installed after the zpool has already been created zed needs to be triggered +## using someing like: zfs set canmount=on DATASET diff --git a/roles/zfs/base/tasks/main.yml b/roles/zfs/base/tasks/main.yml index e86b974b..ad5d1ce2 100644 --- a/roles/zfs/base/tasks/main.yml +++ b/roles/zfs/base/tasks/main.yml @@ -22,25 +22,9 @@ - zfs-zed state: present -- name: enable zfs-list-cacher zlet for systemd zfs-mount-generator - file: - src: /usr/lib/zfs-linux/zed.d/history_event-zfs-list-cacher.sh - dest: /etc/zfs/zed.d/history_event-zfs-list-cacher.sh - state: link - -- name: create base-directory for zfs-list.cache - file: - path: /etc/zfs/zfs-list.cache/ - state: directory - -- name: create zfs-list.cache file for zpools - loop: "{{ zfs_zpools | dict2items }}" - loop_control: - label: "{{ item.key }}" - copy: - content: "" - dest: "/etc/zfs/zfs-list.cache/{{ item.key }}" - force: no +- name: enable systemd -mount-generator + when: zfs_use_systemd_mount_generator + import_tasks: enable-systemd-mount-generator.yml - name: create zpools loop: "{{ zfs_zpools | dict2items }}" -- cgit v1.2.3