Ansible role to install and configure Sanoid & Syncoid
JinjaMIT
Ansible role exterrestris.sanoid
An Ansible role to install and configure automated ZFS snapshots and replication using Sanoid/Syncoid
Requirements
Sanoid package available in distribution
systemd
In order for Syncoid to replicate to a remote host, you must ensure that SSH access via public key authentication is correctly set up for the relevant users
All settings supported by Sanoid in templates are supported - see sanoid.conf and sanoid.defaults.conf for details
Similarly, most Syncoid flags are configurable via syncoid_syncs.
sanoid_datasets[]
Variable
Default
Comments
name
Required
ZFS dataset to snapshot
templates
Required
Sanoid template(s) to use for policy
recursive
"no"
Include child datasets with this dataset
process_children_only
"no"
Do not include this dataset
overrides
[]
List of template settings to override
syncoid_syncs[]
Variable
Default
Comments
src
Required
Source ZFS dataset
src_host
""
Source host
src_user
"root"
Source user. Ignored if src_host empty
dest
Required
Destination ZFS dataset
dest_host
""
Destination host
dest_user
"root"
Destination user. Ignored if dest_host empty
recursive
"no"
Copy child datasets
force_delete
"no"
Remove destination datasets recursively
Sanoid systemd Settings
Variable
Default
Comments
sanoid_systemd_ExecStartPre
undefined
Add ExecStartPre commands to the systemd service file
sanoid_systemd_ExecStartPost
undefined
Add ExecStartPost commands to the systemd service file
Syncoid systemd Settings
Variable
Default
Comments
syncoid_service_name
"syncoid"
systemd service name for Syncoid
syncoid_timer_frequency
"daily"
systemd service frequency for Syncoid
syncoid_use_ssh_key
yes
Use an SSH key to login to remote hosts
syncoid_generate_ssh_key
yes
Generate an SSH key for Syncoid to use
syncoid_generated_ssh_key
id_syncoid
Name of generated SSH key
syncoid_ssh_key
/root/.ssh/{syncoid_generated_ssh_key|id_rsa}
Path to SSH key for Syncoid to use
syncoid_ssh_key_install_remote
yes
Install specified SSH key on remote hosts. Requires remote hosts to be defined in inventory
syncoid_systemd_ExecStartPre
undefined
Add ExecStartPre commands to the systemd service file
syncoid_systemd_ExecStartPost
undefined
Add ExecStartPost commands to the systemd service file