--- # temporarily added to test zfs role by itself #- name: check if atomic # stat: # path: /run/ostree-booted # register: ostree # #- name: set fact (atomic state) # set_fact: # is_atomic: "{{ ostree.stat.exists }}" # end temp additions - name: install zfs-release package (RHEL/CentOS) yum: name: "http://download.zfsonlinux.org/epel/zfs-release.el7_5.noarch.rpm" state: present when: ansible_distribution in ["CentOS" , "Red Hat Enterprise Linux" ] - name: install zfs-release package (Fedora) dnf: name: "http://download.zfsonlinux.org/fedora/zfs-release.fc29.noarch.rpm" state: present when: ansible_distribution in ["Fedora"] and not is_atomic - name: install zfs and dkms package: name: "{{ item }}" state: present with_items: - kernel-devel - "@Development tools" - dkms - zfs register: zfs_installed when: 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 75% of each host, depends on consistency between hosts - inconsistency leads to disproportionate allocations #- name: set zfs_arc_max to 75% 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 - name: import pools command: "zpool import -a" register: pools changed_when: "pools.stderr != 'no pools available to import'" - zpool_facts: properties='all' # really bad idempotence in here... - name: create zpool command: "zpool create -f -O compression=lz4 data {{ zfs_disk }} -o ashift=13 -O secondarycache=all" when: ansible_zfs_pools is not defined