Browse Source

fix snapraid role for debian

Blaine Story 1 tháng trước cách đây
mục cha
commit
8b9f2b7e66

+ 11 - 3
roles/snapraid/tasks/installation.yml

@@ -1,5 +1,5 @@
 ---
-- name: Enable snapraid copr repo
+- name: Enable snapraid copr repo (CentOS)
   shell:
     cmd: dnf copr enable pauken/SnapRAID centos-stream-{{ ansible_distribution_major_version }}-x86_64 -y
     creates: /etc/yum.repos.d/_copr:copr.fedorainfracloud.org:pauken:SnapRAID.repo
@@ -7,12 +7,20 @@
     - ansible_distribution == "CentOS"
     - ansible_distribution_release == "Stream"
 
+- name: Install xfsprogs (Debian)
+  package:
+    name: xfsprogs
+    state: present
+  when:
+    -  (snapraid_data_disks   | selectattr('fs', '==', 'xfs') | list | length)|int > 0 or
+       (snapraid_parity_disks | selectattr('fs', '==', 'xfs') | list | length)|int > 0
+
 - name: Install snapraid
-  yum:
+  package:
     name:
       - snapraid
       - smartmontools
-    state: installed
+    state: present
 
 - name: Create /var/snapraid folder
   file:

+ 6 - 4
roles/snapraid/templates/smarttest.sh.j2

@@ -1,8 +1,10 @@
 #!/bin/bash
 # {{ ansible_managed }}
 
-{% for dev in ansible_devices.keys() | sort %}
-{% if dev != "sda" and dev != "sr0" and "dm" not in dev %}
-/usr/sbin/smartctl --test=long /dev/{{ dev }}
-{% endif %}
+
+{% for disk in snapraid_parity_disks %}
+smartctl --test=long {{ disk.disk }}
+{% endfor %}
+{% for disk in snapraid_data_disks %}
+smartctl --test=long {{ disk.disk }}
 {% endfor %}