2020-08-19 18:40:17 +01:00
|
|
|
- name: Install dependencies for Arch
|
2020-07-26 18:03:09 +01:00
|
|
|
package:
|
2020-08-19 21:34:23 +01:00
|
|
|
name: "{{ item }}"
|
2020-08-19 18:40:17 +01:00
|
|
|
loop:
|
|
|
|
- perl
|
|
|
|
- perl-capture-tiny
|
|
|
|
- perl-config-inifiles
|
|
|
|
- pv
|
|
|
|
- lzop
|
|
|
|
when: ansible_os_family == 'Archlinux'
|
2020-07-26 18:03:09 +01:00
|
|
|
become: true
|
2020-08-19 21:34:23 +01:00
|
|
|
|
|
|
|
- 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'
|
|
|
|
become: true
|
2020-07-26 18:03:09 +01:00
|
|
|
|
2020-08-19 18:40:17 +01:00
|
|
|
- name: Download
|
|
|
|
git:
|
|
|
|
repo: https://github.com/jimsalterjrs/sanoid.git
|
|
|
|
dest: /opt/sanoid
|
2022-09-26 19:32:55 +01:00
|
|
|
version: v2.1.0
|
2020-08-19 18:40:17 +01:00
|
|
|
become: true
|
|
|
|
|
|
|
|
- name: Create config directory
|
|
|
|
file:
|
|
|
|
path: /etc/sanoid
|
|
|
|
state: directory
|
2020-09-26 17:53:47 +01:00
|
|
|
mode: "0755"
|
2020-08-19 18:40:17 +01:00
|
|
|
become: true
|
|
|
|
|
|
|
|
- name: Install default config
|
|
|
|
file:
|
|
|
|
src: /opt/sanoid/sanoid.defaults.conf
|
|
|
|
dest: /etc/sanoid/sanoid.defaults.conf
|
|
|
|
state: link
|
|
|
|
become: true
|
|
|
|
|
|
|
|
- name: Install executables
|
|
|
|
file:
|
|
|
|
src: /opt/sanoid/{{ item }}
|
2021-01-09 21:28:16 +00:00
|
|
|
dest: /usr/sbin/{{ item }}
|
2020-08-19 18:40:17 +01:00
|
|
|
state: link
|
|
|
|
loop:
|
|
|
|
- sanoid
|
|
|
|
- syncoid
|
|
|
|
- findoid
|
|
|
|
- sleepymutex
|
|
|
|
become: true
|
|
|
|
|
|
|
|
- name: Install config
|
2020-07-26 18:03:09 +01:00
|
|
|
template:
|
|
|
|
src: files/sanoid.conf
|
|
|
|
dest: /etc/sanoid/sanoid.conf
|
2020-09-26 17:53:47 +01:00
|
|
|
mode: "0755"
|
2020-07-26 18:03:09 +01:00
|
|
|
become: true
|
|
|
|
|
2021-01-09 20:57:47 +00:00
|
|
|
- name: Install systemd services
|
|
|
|
file:
|
|
|
|
src: /opt/sanoid/packages/debian/{{ item }}
|
|
|
|
dest: /lib/systemd/system/{{ item }}
|
|
|
|
state: link
|
|
|
|
loop: "{{ sanoid_services }}"
|
|
|
|
become: true
|
|
|
|
|
|
|
|
- name: Enable systemd services
|
2021-01-09 21:28:16 +00:00
|
|
|
systemd:
|
2021-01-09 20:57:47 +00:00
|
|
|
name: "{{ item }}"
|
|
|
|
enabled: true
|
2021-01-09 21:28:16 +00:00
|
|
|
masked: false
|
2021-01-09 20:57:47 +00:00
|
|
|
loop: "{{ sanoid_services }}"
|
2020-08-17 22:29:02 +01:00
|
|
|
become: true
|
2021-01-09 21:28:16 +00:00
|
|
|
|
|
|
|
- name: Start sanoid timer
|
|
|
|
systemd:
|
|
|
|
name: sanoid.timer
|
|
|
|
state: started
|
|
|
|
become: true
|