infrastructure/ansible/roles/zfs/tasks/sanoid.yml
Jake Howard d5a7a61171
All checks were successful
/ terraform (push) Successful in 38s
/ ansible (push) Successful in 1m30s
Remove unnecessary use of become from some roles
This should make execution much faster
2024-09-09 17:09:03 +01:00

75 lines
1.4 KiB
YAML

- name: Install dependencies for Arch
package:
name: "{{ item }}"
loop:
- perl
- perl-capture-tiny
- perl-config-inifiles
- pv
- lzop
when: ansible_os_family == 'Archlinux'
- name: Install dependencies for Debian-based distros
package:
name: "{{ item }}"
loop:
- libcapture-tiny-perl
- libconfig-inifiles-perl
- pv
- lzop
- mbuffer
when: ansible_os_family == 'Debian'
- name: Download
git:
repo: https://github.com/jimsalterjrs/sanoid.git
dest: /opt/sanoid
version: v2.1.0
- name: Create config directory
file:
path: /etc/sanoid
state: directory
mode: "0755"
- name: Install default config
file:
src: /opt/sanoid/sanoid.defaults.conf
dest: /etc/sanoid/sanoid.defaults.conf
state: link
- name: Install executables
file:
src: /opt/sanoid/{{ item }}
dest: /usr/sbin/{{ item }}
state: link
loop:
- sanoid
- syncoid
- findoid
- sleepymutex
- name: Install config
template:
src: files/sanoid.conf
dest: /etc/sanoid/sanoid.conf
mode: "0755"
- name: Install systemd services
file:
src: /opt/sanoid/packages/debian/{{ item }}
dest: /lib/systemd/system/{{ item }}
state: link
loop: "{{ sanoid_services }}"
- name: Enable systemd services
systemd:
name: "{{ item }}"
enabled: true
masked: false
loop: "{{ sanoid_services }}"
- name: Start sanoid timer
systemd:
name: sanoid.timer
state: started