diff --git a/data/deployments/admin/common.yaml b/data/deployments/admin/common.yaml --- a/data/deployments/admin/common.yaml +++ b/data/deployments/admin/common.yaml @@ -49,3 +49,7 @@ grafana::db::host: db1.internal.admin.swh.network grafana::db::port: "%{lookup('swh::postgresql::port')}" + +syncoid::public_keys::backup01-azure: + type: ssh-ed25519 + key: "AAAAC3NzaC1lZDI1NTE5AAAAIC/IVxmzorYGJH5ThlzjrdHl9KBTsJKEqCAZhhJG6oGO" diff --git a/data/hostname/backup01.euwest.azure.internal.softwareheritage.org.yaml b/data/hostname/backup01.euwest.azure.internal.softwareheritage.org.yaml new file mode 100644 --- /dev/null +++ b/data/hostname/backup01.euwest.azure.internal.softwareheritage.org.yaml @@ -0,0 +1,22 @@ +swh::apt_config::enable_non_free: true + +packages: + - linux-headers-cloud-amd64 + - zfs-dkms + +syncoid::configuration: + sources: + dali: + host: dali.internal.admin.swh.network + datasets: + postgresql: + dataset: data/postgresql + frequency: 1h + sync_snap: no # snapshots are managed by sanoid + postgresql_wal: + target: postgresql/wal + dataset: data/postgresql/wal + frequency: 1h + sync_snap: no # snapshots are managed by sanoid + target_dataset_base: data/sync + ssh_key: backup01-azure diff --git a/site-modules/profile/manifests/sanoid/sync_destination.pp b/site-modules/profile/manifests/sanoid/sync_destination.pp --- a/site-modules/profile/manifests/sanoid/sync_destination.pp +++ b/site-modules/profile/manifests/sanoid/sync_destination.pp @@ -40,17 +40,23 @@ # Create a timer and service for each dataset to sync $config['datasets'].each | $name, $props | { $dataset = $props['dataset'] - $destination = "${config['target_dataset_base']}/${key}/${name}" + $target = pick($props['target'], $name) + $destination = "${config['target_dataset_base']}/${key}/${target}" $service_basename = "syncoid-${key}-${name}" $source = "${source_host}:${dataset}" $delay = pick($props['delay'], lookup('syncoid::default_delay')) + $sync_snap = pick($props['sync_snap'], true) + if $sync_snap == false { + $sync_options = ' --no-sync-snap' + } # templates use: # - $ssh_key_filename # - $source # - $destination # - $delay # - $service_basename + # - $sync_option ::systemd::timer { "${service_basename}.timer": timer_content => template('profile/sanoid/syncoid.timer.erb'), service_content => template('profile/sanoid/syncoid.service.erb'), diff --git a/site-modules/profile/templates/sanoid/syncoid.service.erb b/site-modules/profile/templates/sanoid/syncoid.service.erb --- a/site-modules/profile/templates/sanoid/syncoid.service.erb +++ b/site-modules/profile/templates/sanoid/syncoid.service.erb @@ -10,7 +10,7 @@ Type=oneshot User=root Group=root -ExecStart=syncoid --sshkey <%= @ssh_key_filename %> root@<%= @source %> <%= @destination %> +ExecStart=syncoid<%= @sync_options %> --sshkey <%= @ssh_key_filename %> root@<%= @source %> <%= @destination %> Restart=on-failure RestartSec=1s