Skip to content

Commit 0568fad

Browse files
authored
Merge pull request #18 from remerge/CORE-865
Switch to ZFS kmod
2 parents e16a407 + 4ee93a3 commit 0568fad

File tree

3 files changed

+53
-48
lines changed

3 files changed

+53
-48
lines changed

tasks/create-pool.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
changed_when: false
77

88
- name: Detect zfs pool
9-
ansible.builtin.command: "zpool list {{ item.key }}"
9+
ansible.builtin.command: "zpool list {{ item.key }}"
1010
register: ansible_zfs_pool
1111
failed_when: false
1212
changed_when: false

tasks/install.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
- name: Remove ZFS DKMS
3+
ansible.builtin.dnf:
4+
name: zfs-dkms
5+
state: absent
6+
7+
- name: Install ZFS repo
8+
ansible.builtin.dnf:
9+
name: "https://zfsonlinux.org/epel/zfs-release-2-3.el{{ ansible_distribution_major_version }}.noarch.rpm"
10+
disable_gpg_check: true
11+
state: present
12+
13+
- name: Switch ZFS repo to kmod
14+
ansible.builtin.shell: |
15+
dnf config-manager --disable zfs
16+
dnf config-manager --enable zfs-kmod
17+
changed_when: false
18+
19+
- name: Install ZFS kernel module
20+
ansible.builtin.dnf:
21+
name: zfs-kmod
22+
state: present
23+
24+
- name: Load ZFS kernel module
25+
community.general.modprobe:
26+
name: zfs
27+
state: present
28+
29+
- name: Create zfs-tuning.sh
30+
ansible.builtin.copy:
31+
src: zfs-tuning.sh
32+
dest: /usr/local/sbin/zfs-tuning.sh
33+
owner: root
34+
group: root
35+
mode: 0755
36+
37+
- name: Install zfs-tuning service
38+
ansible.builtin.copy:
39+
src: zfs-tuning.service
40+
dest: /usr/lib/systemd/system/zfs-tuning.service
41+
owner: root
42+
group: root
43+
mode: 0644
44+
45+
- name: Start zfs-tuning service
46+
ansible.builtin.service:
47+
name: zfs-tuning
48+
state: started
49+
enabled: true

tasks/main.yml

Lines changed: 3 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,9 @@
11
---
2-
- name: Install ZFS repo
3-
ansible.builtin.dnf:
4-
name: "https://zfsonlinux.org/epel/zfs-release-2-2.el{{ ansible_distribution_major_version }}.noarch.rpm"
5-
disable_gpg_check: true
6-
state: present
2+
- name: Install ZFS
3+
ansible.builtin.include_tasks: install.yml
74
when: zpools is defined and zpools != None
85

9-
- name: Install ZFS kernel module
10-
ansible.builtin.dnf:
11-
name:
12-
- kernel-headers
13-
- kernel-modules
14-
- kernel-devel
15-
- zfs
16-
state: present
17-
when: zpools is defined and zpools != None
18-
19-
- name: Load ZFS kernel module
20-
community.general.modprobe:
21-
name: zfs
22-
state: present
23-
when: zpools is defined and zpools != None
24-
25-
- name: Create zfs-tuning.sh
26-
ansible.builtin.copy:
27-
src: zfs-tuning.sh
28-
dest: /usr/local/sbin/zfs-tuning.sh
29-
owner: root
30-
group: root
31-
mode: 0755
32-
when: zpools is defined and zpools != None
33-
34-
- name: Install zfs-tuning service
35-
ansible.builtin.copy:
36-
src: zfs-tuning.service
37-
dest: /usr/lib/systemd/system/zfs-tuning.service
38-
owner: root
39-
group: root
40-
mode: 0644
41-
when: zpools is defined and zpools != None
42-
43-
- name: Start zfs-tuning service
44-
ansible.builtin.service:
45-
name: zfs-tuning
46-
state: started
47-
enabled: true
48-
when: zpools is defined and zpools != None
49-
50-
- name: Create ZFS pool
6+
- name: Create ZFS pools
517
ansible.builtin.include_tasks: create-pool.yml
528
with_dict: "{{ zpools | default({}, true) }}"
539
when: zpools is defined and zpools != None

0 commit comments

Comments
 (0)