remove syncoid, switch to rsync #221
8 changed files with 40 additions and 77 deletions
|
@ -1,48 +1,11 @@
|
|||
---
|
||||
### when should sanoid be run (every 5 minutes)
|
||||
sanoid_timer: '*-*-* *:00/5'
|
||||
### when should syncoid be run
|
||||
sanoid_syncoid_timer: '*-*-* *:00:00'
|
||||
### when should rsync_mirror be run (every 5 minutes)
|
||||
rsync_mirror_timer: '*-*-* *:00/5'
|
||||
rsync_mirror_user: rsync_mirror
|
||||
rsync_mirror_user_group: rsync_mirror
|
||||
|
||||
# ### "Default" Datasets
|
||||
# sanoid_datasets: # dictionary
|
||||
# - path: 'hdd_data/data' # path to dataset; without leading /
|
||||
# template: 'fiveminutes' # name
|
||||
# recursive: 'no' # recursive snapshotting
|
||||
# snapshots: true # (de)activate; can be used to disable snapshotting of subdatasets if recursive is set
|
||||
# - path: 'hdd_data/test'
|
||||
# snapshots: false # deaktiviert sanoid für das dataset
|
||||
#
|
||||
# ### Templates
|
||||
# sanoid_templates:
|
||||
# - name: 'fiveminutes'
|
||||
# keep_hourly: '24' # Aufheben (Stunde)
|
||||
# keep_daily: '31' # Aufheben (Tage)
|
||||
# keep_monthly: '6' # Aufheben (Monate)
|
||||
# keep_yearly: '0' # Aufheben (Jahre)
|
||||
# frequently: '36' # Aufheben (Minuten)
|
||||
# frequent_period: '5' # Intervall (alle 5 Minuten)
|
||||
# autosnap: 'yes' # Automatisches erstellen von Snapshots
|
||||
# autoprune: 'yes'
|
||||
|
||||
### user and group for sanoid
|
||||
sanoid_user: sanoid
|
||||
sanoid_user_group: sanoid
|
||||
|
||||
### enable/disable features
|
||||
## enable snapshotting
|
||||
# sanoid_snaps_enable: true
|
||||
## enable sending snaps
|
||||
# sanoid_syncoid_source_host: true
|
||||
## enable receiving snaps
|
||||
# sanoid_syncoid_destination_host: true
|
||||
|
||||
# syncoid
|
||||
#sanoid_syncoid_ssh_privkey: "{{ lookup('viczem.keepass.keepass', 'sanoid_syncoid_private_key', 'notes') }}"
|
||||
#sanoid_syncoid_ssh_pubkey: "{{ lookup('viczem.keepass.keepass', 'sanoid_syncoid_public_key', 'notes') }}"
|
||||
|
||||
### mgrote_sanoid
|
||||
#sanoid_syncoid_datasets_sync:
|
||||
### mgrote_rsync_mirror
|
||||
#rsync_mirror_syncoid_datasets_sync:
|
||||
# - source_host: pve5.mgrote.net
|
||||
# source_dataset: hdd_data/tmp
|
||||
# destination_mount_check: hdd_data/tmp # zielpool
|
||||
|
|
|
@ -3,15 +3,15 @@
|
|||
become: true
|
||||
ansible.builtin.template:
|
||||
src: private_key.j2
|
||||
dest: "/etc/sanoid/.ssh/id_sanoid"
|
||||
owner: "{{ sanoid_user }}"
|
||||
group: "{{ sanoid_user_group }}"
|
||||
dest: "/etc/rsync_mirror/.ssh/id_rsync_mirror"
|
||||
owner: "{{ rsync_mirror_user }}"
|
||||
group: "{{ rsync_mirror_user_group }}"
|
||||
mode: "0400"
|
||||
no_log: true
|
||||
when:
|
||||
- sanoid_syncoid_destination_host
|
||||
- rsync_mirror_syncoid_destination_host
|
||||
|
||||
- name: template ssh public key
|
||||
ansible.posix.authorized_key:
|
||||
user: "{{ sanoid_user }}"
|
||||
key: "{{ sanoid_syncoid_ssh_pubkey }}"
|
||||
user: "{{ rsync_mirror_user }}"
|
||||
key: "{{ rsync_mirror_syncoid_ssh_pubkey }}"
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
ansible.builtin.file:
|
||||
path: "{{ item }}"
|
||||
state: directory
|
||||
owner: "{{ sanoid_user }}"
|
||||
group: "{{ sanoid_user_group }}"
|
||||
owner: "{{ rsync_mirror_user }}"
|
||||
group: "{{ rsync_mirror_user_group }}"
|
||||
mode: "0600"
|
||||
with_items:
|
||||
- "/etc/rsync_mirror/"
|
||||
|
@ -27,7 +27,7 @@
|
|||
group: root
|
||||
mode: "0755"
|
||||
when:
|
||||
- sanoid_syncoid_destination_host
|
||||
- rsync_mirror_syncoid_destination_host
|
||||
|
||||
- name: Ensure services are present
|
||||
become: true
|
||||
|
@ -40,15 +40,15 @@
|
|||
notify:
|
||||
- systemctl daemon-reload
|
||||
loop:
|
||||
- youtubedl.service
|
||||
- youtubedl.timer
|
||||
- youtubedl_mail.service
|
||||
- rsync_mirror.service
|
||||
- rsync_mirror.timer
|
||||
- rsync_mirror_mail.service
|
||||
when: ytdl_active
|
||||
|
||||
- name: Ensure timer unit is enabled
|
||||
become: true
|
||||
ansible.builtin.systemd:
|
||||
name: youtubedl.timer
|
||||
name: rsync_mirror.timer
|
||||
enabled: true
|
||||
masked: false
|
||||
state: started
|
||||
|
@ -63,7 +63,7 @@
|
|||
masked: false
|
||||
enabled: true
|
||||
loop:
|
||||
- youtubedl.service
|
||||
- youtubedl.timer
|
||||
- youtubedl_mail.service
|
||||
- rsync_mirror.service
|
||||
- rsync_mirror.timer
|
||||
- rsync_mirror_mail.service
|
||||
when: ytdl_active
|
||||
|
|
|
@ -2,29 +2,29 @@
|
|||
- name: ensure group exists
|
||||
become: true
|
||||
ansible.builtin.group:
|
||||
name: "{{ sanoid_user_group }}"
|
||||
name: "{{ rsync_mirror_user_group }}"
|
||||
state: present
|
||||
when:
|
||||
- sanoid_user_group is defined
|
||||
- sanoid_user is defined
|
||||
- rsync_mirror_user_group is defined
|
||||
- rsync_mirror_user is defined
|
||||
|
||||
- name: ensure user exists
|
||||
become: true
|
||||
ansible.builtin.user:
|
||||
name: "{{ sanoid_user }}"
|
||||
group: "{{ sanoid_user_group }}"
|
||||
name: "{{ rsync_mirror_user }}"
|
||||
group: "{{ rsync_mirror_user_group }}"
|
||||
create_home: true
|
||||
when:
|
||||
- sanoid_user_group is defined
|
||||
- sanoid_user is defined
|
||||
- rsync_mirror_user_group is defined
|
||||
- rsync_mirror_user is defined
|
||||
|
||||
- name: Ensure user is added to sudoers
|
||||
become: true
|
||||
community.general.sudoers:
|
||||
name: "users-sudo-{{ sanoid_user }}"
|
||||
name: "users-sudo-{{ rsync_mirror_user }}"
|
||||
state: present
|
||||
user: "{{ sanoid_user }}"
|
||||
user: "{{ rsync_mirror_user }}"
|
||||
commands: ALL
|
||||
nopassword: true
|
||||
when:
|
||||
- sanoid_syncoid_destination_host
|
||||
- rsync_mirror_syncoid_destination_host
|
||||
|
|
|
@ -1 +1 @@
|
|||
{{ sanoid_syncoid_ssh_privkey }}
|
||||
{{ rsync_mirror_syncoid_ssh_privkey }}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
{{ file_header | default () }}
|
||||
|
||||
[Unit]
|
||||
Description=Send zfs snapshots with sanoid/syncoid.
|
||||
OnFailure=syncoid_mail.service
|
||||
OnSuccess=syncoid_mail.service
|
||||
Description=Send zfs snapshots with rsync_mirror/rsync_mirror.
|
||||
OnFailure=rsync_mirror_mail.service
|
||||
OnSuccess=rsync_mirror_mail.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=/usr/bin/syncoid.sh
|
||||
ExecStart=/usr/bin/rsync_mirror.sh
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
{{ file_header | default () }}
|
||||
[Unit]
|
||||
Description=Timer for syncoid.
|
||||
Description=Timer for rsync_mirror.
|
||||
|
||||
[Timer]
|
||||
OnCalendar={{ sanoid_syncoid_timer }}
|
||||
OnCalendar={{ rsync_mirror_rsync_mirror_timer }}
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target multi-user.target zfs.target
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{{ file_header | default () }}
|
||||
|
||||
[Unit]
|
||||
Description=Send a Mail for sanoid service after error or success sanoid.service.
|
||||
Description=Send a Mail for rsync_mirror service after error or success rsync_mirror.service.
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
|
|
Loading…
Reference in a new issue