aboutsummaryrefslogtreecommitdiff
path: root/roles/monitoring/tasks/zfs.yaml
diff options
context:
space:
mode:
authorKumar Damani <me@kumardamani.net>2022-09-07 20:40:17 +0000
committerKumar Damani <me@kumardamani.net>2022-09-07 20:40:17 +0000
commitbbe10895d9df8dd7899bbd65575d5bf12e57f8c8 (patch)
tree244d2f1ad38320863fb60f695c88c97799be1171 /roles/monitoring/tasks/zfs.yaml
parent4d34de2f5e757bfeae5738547aabb61d3d28a2f8 (diff)
parentc85806e3289b5e207d51d382f8dc75edad04404d (diff)
Merge branch 'alpine' into 'master'
switched to alpine initial commit See merge request kdam0/vps!2
Diffstat (limited to 'roles/monitoring/tasks/zfs.yaml')
-rw-r--r--roles/monitoring/tasks/zfs.yaml49
1 files changed, 49 insertions, 0 deletions
diff --git a/roles/monitoring/tasks/zfs.yaml b/roles/monitoring/tasks/zfs.yaml
new file mode 100644
index 0000000..2f18e32
--- /dev/null
+++ b/roles/monitoring/tasks/zfs.yaml
@@ -0,0 +1,49 @@
+# https://github.com/pdf/zfs_exporter
+
+---
+
+# ZFS Exporter for ZFS monitoring
+
+- name: 'Download zfs exporter tarball'
+ get_url:
+ url: 'https://github.com/pdf/zfs_exporter/releases/download/v2.2.5/zfs_exporter-2.2.5.linux-arm64.tar.gz'
+ dest: '{{ monitoring_root_dir }}/zfs_exporter.tar.gz'
+ mode: '644'
+
+- name: 'Ensure the zfs exporter dir exists'
+ file:
+ path: '{{ monitoring_root_dir }}/zfs_exporter-2.2.5.linux-arm64'
+ state: 'directory'
+ mode: '755'
+
+- name: 'Extract ZFS exporter to dir'
+ command: 'tar -xf zfs_exporter-2.2.5.linux-arm64.tar.gz'
+ args:
+ chdir: '{{ monitoring_root_dir }}'
+
+- name: 'Copy the executable to /usr/bin'
+ become: true
+ become_method: 'doas'
+ copy:
+ src: '{{ monitoring_root_dir }}/zfs_exporter-2.2.5.linux-arm64/zfs_exporter'
+ dest: '/usr/bin/zfs_exporter'
+ mode: '0755'
+ owner: 'root'
+ remote_src: true
+
+- name: 'Create service file to start zfs_exporter on boot'
+ become: true
+ become_method: 'doas'
+ copy:
+ src: 'zfs-exporter'
+ dest: '/etc/init.d/zfs-exporter'
+ mode: '0755'
+ owner: 'root'
+
+- name: 'Start and enable the zfs-exporter service'
+ become: true
+ become_method: 'doas'
+ service:
+ name: 'zfs-exporter'
+ state: 'started'
+ enabled: true