Skip to content

Commit

Permalink
Switch to ZFS kmod
Browse files Browse the repository at this point in the history
  • Loading branch information
hollow committed Sep 2, 2024
1 parent e16a407 commit 796e2ea
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 48 deletions.
2 changes: 1 addition & 1 deletion tasks/create-pool.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
changed_when: false

- name: Detect zfs pool
ansible.builtin.command: "zpool list {{ item.key }}"
ansible.builtin.command: "zpool list {{ item.key }}"
register: ansible_zfs_pool
failed_when: false
changed_when: false
Expand Down
49 changes: 49 additions & 0 deletions tasks/install.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
- name: Install ZFS repo
ansible.builtin.dnf:
name: "https://zfsonlinux.org/epel/zfs-release-2-3.el{{ ansible_distribution_major_version }}.noarch.rpm"
disable_gpg_check: true
state: present

- name: Remove ZFS DKMS
ansible.builtin.dnf:
name: zfs-dkms
state: absent

- name: Switch ZFS repo to kmod
ansible.builtin.shell: |
dnf config-manager --disable zfs
dnf config-manager --enable zfs-kmod
changed_when: false

- name: Install ZFS kernel module
ansible.builtin.dnf:
name: zfs-kmod
state: present

- name: Load ZFS kernel module
community.general.modprobe:
name: zfs
state: present

- name: Create zfs-tuning.sh
ansible.builtin.copy:
src: zfs-tuning.sh
dest: /usr/local/sbin/zfs-tuning.sh
owner: root
group: root
mode: 0755

- name: Install zfs-tuning service
ansible.builtin.copy:
src: zfs-tuning.service
dest: /usr/lib/systemd/system/zfs-tuning.service
owner: root
group: root
mode: 0644

- name: Start zfs-tuning service
ansible.builtin.service:
name: zfs-tuning
state: started
enabled: true
50 changes: 3 additions & 47 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,53 +1,9 @@
---
- name: Install ZFS repo
ansible.builtin.dnf:
name: "https://zfsonlinux.org/epel/zfs-release-2-2.el{{ ansible_distribution_major_version }}.noarch.rpm"
disable_gpg_check: true
state: present
- name: Install ZFS
ansible.builtin.include_tasks: install.yml
when: zpools is defined and zpools != None

- name: Install ZFS kernel module
ansible.builtin.dnf:
name:
- kernel-headers
- kernel-modules
- kernel-devel
- zfs
state: present
when: zpools is defined and zpools != None

- name: Load ZFS kernel module
community.general.modprobe:
name: zfs
state: present
when: zpools is defined and zpools != None

- name: Create zfs-tuning.sh
ansible.builtin.copy:
src: zfs-tuning.sh
dest: /usr/local/sbin/zfs-tuning.sh
owner: root
group: root
mode: 0755
when: zpools is defined and zpools != None

- name: Install zfs-tuning service
ansible.builtin.copy:
src: zfs-tuning.service
dest: /usr/lib/systemd/system/zfs-tuning.service
owner: root
group: root
mode: 0644
when: zpools is defined and zpools != None

- name: Start zfs-tuning service
ansible.builtin.service:
name: zfs-tuning
state: started
enabled: true
when: zpools is defined and zpools != None

- name: Create ZFS pool
- name: Create ZFS pools
ansible.builtin.include_tasks: create-pool.yml
with_dict: "{{ zpools | default({}, true) }}"
when: zpools is defined and zpools != None

0 comments on commit 796e2ea

Please sign in to comment.