Files

42 lines
1.1 KiB
YAML

---
# ZFS event daemon and pool metrics for the node exporter. zed keeps its default zed.rc and
# logs to the journal, which journal_upload ships.
- name: Install the ZFS event daemon
ansible.builtin.apt:
name: zfs-zed
install_recommends: false
state: present
- name: Enable the ZFS event daemon
ansible.builtin.systemd:
name: zfs-zed
enabled: true
state: started
# Check mode does not install the package.
ignore_errors: "{{ ansible_check_mode }}"
- name: Install the pool metrics script
ansible.builtin.template:
src: zfs-pool-metrics.j2
dest: /usr/local/sbin/zfs-pool-metrics
mode: "0755"
- name: Install the pool metrics units
ansible.builtin.template:
src: "{{ item }}.j2"
dest: /etc/systemd/system/{{ item }}
mode: "0644"
loop:
- zfs-pool-metrics.service
- zfs-pool-metrics.timer
register: zfs_host_units
- name: Enable the pool metrics timer
ansible.builtin.systemd:
name: zfs-pool-metrics.timer
enabled: true
state: started
daemon_reload: "{{ zfs_host_units.changed }}"
# Check mode does not write the units.
ignore_errors: "{{ ansible_check_mode }}"