Ansible-ZFS/roles/zfs/tasks/main.yml

83 lines
1.9 KiB
YAML

---
# file: roles/zfs/tasks/main.yml
- name: Install EPEL RPM
package:
name: "https://dl.fedoraproject.org/pub/epel/epel-release-latest-{{ ansible_distribution_major_version }}.noarch.rpm"
state: present
disable_gpg_check: True
- name: Install prereq packages
package:
name: kernel-devel
state: latest
- name: Add OpenZFS repository
package:
name: "https://zfsonlinux.org/epel/zfs-release-2-3.el{{ ansible_distribution_major_version }}.noarch.rpm"
state: latest
disable_gpg_check: True
- name: Disable kmod zfs
community.general.dnf_config_manager:
name: zfs-kmod
state: disabled
register: zfs_kmod_results
- name: Uninstall kmod ZFS
package:
name: zfs
state: absent
register: zfs_install
when: zfs_kmod_results.changed
- name: Enable ZFS testing package
community.general.dnf_config_manager:
name: zfs-testing
state: enabled
when: zfs_testing
- name: Disable ZFS testing package
community.general.dnf_config_manager:
name: zfs-testing
state: disabled
when: not zfs_testing
- name: Install ZFS
package:
name: zfs
state: latest
register: zfs_install
- name: Gather the package facts
package_facts:
manager: auto
when: zfs_install.changed
- name: Install zfs into dkms image
shell: "dkms install zfs/{{ ansible_facts.packages['zfs'][0].version }}"
args:
executable: /bin/bash
when: zfs_install.changed
notify: Reboot Host
- name: Add the ZFS module to modprobe for future boot
template:
src: zfs.conf.j2
dest: /etc/modules-load.d/zfs.conf
- name: Install cockpit package
package:
name:
- cockpit
- cockpit-zfs
state: latest
when: zfs_cockpit
- name: Start and enable cockpit service
service:
name: cockpit.socket
state: started
enabled: yes
when: zfs_cockpit