52 lines
1.4 KiB
YAML
52 lines
1.4 KiB
YAML
---
|
|
- name: Install packages
|
|
apt:
|
|
name: sanoid
|
|
state: present
|
|
|
|
- name: Create sanoid directory
|
|
file:
|
|
path: /etc/sanoid
|
|
state: directory
|
|
|
|
- name: Copy sanoid config
|
|
template:
|
|
src: sanoid.conf
|
|
dest: /etc/sanoid/sanoid.conf
|
|
|
|
- name: Copy syncoid private ssh key
|
|
template:
|
|
src: syncoid_id_rsa.jinja2
|
|
dest: /root/.ssh/syncoid_id_rsa
|
|
mode: 0600
|
|
|
|
- name: Copy ssh config file
|
|
template:
|
|
src: config.jinja2
|
|
dest: /root/.ssh/config
|
|
|
|
- name: Build syncoid cron job command
|
|
set_fact:
|
|
syncoid_commands: "{{ syncoid_commands|default([]) + [ '/usr/sbin/syncoid --no-privilege-elevation --recursive --no-sync-snap --create-bookmark syncoid@bigboi.zacke.xyz:' ~ item.remote_path ~ ' ' ~ item.local_path ] }}"
|
|
loop: "{{ zfs.to_pull }}"
|
|
|
|
- name: Ensure syncoid sync bash file
|
|
copy:
|
|
dest: "/usr/sbin/syncoid-bigboi"
|
|
content: "{{ syncoid_commands|join(' && ') }}"
|
|
mode: 0700
|
|
|
|
- name: Ensure syncoid cron job
|
|
ansible.builtin.cron:
|
|
name: "Syncoid pull snapshots"
|
|
minute: "0"
|
|
hour: "0"
|
|
job: "/usr/sbin/syncoid-bigboi"
|
|
|
|
# - name: Ensure syncoid cron job
|
|
# ansible.builtin.cron:
|
|
# name: Syncoid pull snapshots {{ item.remote_path }}
|
|
# minute: "0"
|
|
# hour: "0"
|
|
# job: "/usr/sbin/syncoid --quiet --no-privilege-elevation --recursive --no-sync-snap --create-bookmark syncoid@bigboi.zacke.xyz:{{ item.remote_path }} {{ item.local_path }}"
|
|
# loop: "{{ zfs.to_pull }}" |