summaryrefslogtreecommitdiff
path: root/roles/zfs/base/tasks/enable-systemd-mount-generator.yml
blob: eaa3cebea8c4823cdd9134a174ec9931e32c634a (plain) (blame)
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
---
- 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 all pools
  loop: "{{ zfs_pools | 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

### HACK HACK HACK (see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=966565)
- name: patch zfs mount generator (Debian Bug 966565)
  when: ansible_distribution == 'Debian'
  lineinfile:
    path: /usr/lib/systemd/system-generators/zfs-mount-generator
    regexp: '^pools=\$\(zpool list -H -o name\)$'
    line: "pools=$(zpool list -H -o name || true)"