dsfg
This commit is contained in:
parent
2cb7390f5b
commit
b76ff5624e
8 changed files with 40 additions and 77 deletions
|
@ -1,48 +1,11 @@
|
||||||
---
|
---
|
||||||
### when should sanoid be run (every 5 minutes)
|
### when should rsync_mirror be run (every 5 minutes)
|
||||||
sanoid_timer: '*-*-* *:00/5'
|
rsync_mirror_timer: '*-*-* *:00/5'
|
||||||
### when should syncoid be run
|
rsync_mirror_user: rsync_mirror
|
||||||
sanoid_syncoid_timer: '*-*-* *:00:00'
|
rsync_mirror_user_group: rsync_mirror
|
||||||
|
|
||||||
# ### "Default" Datasets
|
### mgrote_rsync_mirror
|
||||||
# sanoid_datasets: # dictionary
|
#rsync_mirror_syncoid_datasets_sync:
|
||||||
# - 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:
|
|
||||||
# - source_host: pve5.mgrote.net
|
# - source_host: pve5.mgrote.net
|
||||||
# source_dataset: hdd_data/tmp
|
# source_dataset: hdd_data/tmp
|
||||||
# destination_mount_check: hdd_data/tmp # zielpool
|
# destination_mount_check: hdd_data/tmp # zielpool
|
||||||
|
|
|
@ -3,15 +3,15 @@
|
||||||
become: true
|
become: true
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: private_key.j2
|
src: private_key.j2
|
||||||
dest: "/etc/sanoid/.ssh/id_sanoid"
|
dest: "/etc/rsync_mirror/.ssh/id_rsync_mirror"
|
||||||
owner: "{{ sanoid_user }}"
|
owner: "{{ rsync_mirror_user }}"
|
||||||
group: "{{ sanoid_user_group }}"
|
group: "{{ rsync_mirror_user_group }}"
|
||||||
mode: "0400"
|
mode: "0400"
|
||||||
no_log: true
|
no_log: true
|
||||||
when:
|
when:
|
||||||
- sanoid_syncoid_destination_host
|
- rsync_mirror_syncoid_destination_host
|
||||||
|
|
||||||
- name: template ssh public key
|
- name: template ssh public key
|
||||||
ansible.posix.authorized_key:
|
ansible.posix.authorized_key:
|
||||||
user: "{{ sanoid_user }}"
|
user: "{{ rsync_mirror_user }}"
|
||||||
key: "{{ sanoid_syncoid_ssh_pubkey }}"
|
key: "{{ rsync_mirror_syncoid_ssh_pubkey }}"
|
||||||
|
|
|
@ -11,8 +11,8 @@
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
path: "{{ item }}"
|
path: "{{ item }}"
|
||||||
state: directory
|
state: directory
|
||||||
owner: "{{ sanoid_user }}"
|
owner: "{{ rsync_mirror_user }}"
|
||||||
group: "{{ sanoid_user_group }}"
|
group: "{{ rsync_mirror_user_group }}"
|
||||||
mode: "0600"
|
mode: "0600"
|
||||||
with_items:
|
with_items:
|
||||||
- "/etc/rsync_mirror/"
|
- "/etc/rsync_mirror/"
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
group: root
|
group: root
|
||||||
mode: "0755"
|
mode: "0755"
|
||||||
when:
|
when:
|
||||||
- sanoid_syncoid_destination_host
|
- rsync_mirror_syncoid_destination_host
|
||||||
|
|
||||||
- name: Ensure services are present
|
- name: Ensure services are present
|
||||||
become: true
|
become: true
|
||||||
|
@ -40,15 +40,15 @@
|
||||||
notify:
|
notify:
|
||||||
- systemctl daemon-reload
|
- systemctl daemon-reload
|
||||||
loop:
|
loop:
|
||||||
- youtubedl.service
|
- rsync_mirror.service
|
||||||
- youtubedl.timer
|
- rsync_mirror.timer
|
||||||
- youtubedl_mail.service
|
- rsync_mirror_mail.service
|
||||||
when: ytdl_active
|
when: ytdl_active
|
||||||
|
|
||||||
- name: Ensure timer unit is enabled
|
- name: Ensure timer unit is enabled
|
||||||
become: true
|
become: true
|
||||||
ansible.builtin.systemd:
|
ansible.builtin.systemd:
|
||||||
name: youtubedl.timer
|
name: rsync_mirror.timer
|
||||||
enabled: true
|
enabled: true
|
||||||
masked: false
|
masked: false
|
||||||
state: started
|
state: started
|
||||||
|
@ -63,7 +63,7 @@
|
||||||
masked: false
|
masked: false
|
||||||
enabled: true
|
enabled: true
|
||||||
loop:
|
loop:
|
||||||
- youtubedl.service
|
- rsync_mirror.service
|
||||||
- youtubedl.timer
|
- rsync_mirror.timer
|
||||||
- youtubedl_mail.service
|
- rsync_mirror_mail.service
|
||||||
when: ytdl_active
|
when: ytdl_active
|
||||||
|
|
|
@ -2,29 +2,29 @@
|
||||||
- name: ensure group exists
|
- name: ensure group exists
|
||||||
become: true
|
become: true
|
||||||
ansible.builtin.group:
|
ansible.builtin.group:
|
||||||
name: "{{ sanoid_user_group }}"
|
name: "{{ rsync_mirror_user_group }}"
|
||||||
state: present
|
state: present
|
||||||
when:
|
when:
|
||||||
- sanoid_user_group is defined
|
- rsync_mirror_user_group is defined
|
||||||
- sanoid_user is defined
|
- rsync_mirror_user is defined
|
||||||
|
|
||||||
- name: ensure user exists
|
- name: ensure user exists
|
||||||
become: true
|
become: true
|
||||||
ansible.builtin.user:
|
ansible.builtin.user:
|
||||||
name: "{{ sanoid_user }}"
|
name: "{{ rsync_mirror_user }}"
|
||||||
group: "{{ sanoid_user_group }}"
|
group: "{{ rsync_mirror_user_group }}"
|
||||||
create_home: true
|
create_home: true
|
||||||
when:
|
when:
|
||||||
- sanoid_user_group is defined
|
- rsync_mirror_user_group is defined
|
||||||
- sanoid_user is defined
|
- rsync_mirror_user is defined
|
||||||
|
|
||||||
- name: Ensure user is added to sudoers
|
- name: Ensure user is added to sudoers
|
||||||
become: true
|
become: true
|
||||||
community.general.sudoers:
|
community.general.sudoers:
|
||||||
name: "users-sudo-{{ sanoid_user }}"
|
name: "users-sudo-{{ rsync_mirror_user }}"
|
||||||
state: present
|
state: present
|
||||||
user: "{{ sanoid_user }}"
|
user: "{{ rsync_mirror_user }}"
|
||||||
commands: ALL
|
commands: ALL
|
||||||
nopassword: true
|
nopassword: true
|
||||||
when:
|
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 () }}
|
{{ file_header | default () }}
|
||||||
|
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Send zfs snapshots with sanoid/syncoid.
|
Description=Send zfs snapshots with rsync_mirror/rsync_mirror.
|
||||||
OnFailure=syncoid_mail.service
|
OnFailure=rsync_mirror_mail.service
|
||||||
OnSuccess=syncoid_mail.service
|
OnSuccess=rsync_mirror_mail.service
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
ExecStart=/usr/bin/syncoid.sh
|
ExecStart=/usr/bin/rsync_mirror.sh
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
{{ file_header | default () }}
|
{{ file_header | default () }}
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Timer for syncoid.
|
Description=Timer for rsync_mirror.
|
||||||
|
|
||||||
[Timer]
|
[Timer]
|
||||||
OnCalendar={{ sanoid_syncoid_timer }}
|
OnCalendar={{ rsync_mirror_rsync_mirror_timer }}
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=timers.target multi-user.target zfs.target
|
WantedBy=timers.target multi-user.target zfs.target
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{{ file_header | default () }}
|
{{ file_header | default () }}
|
||||||
|
|
||||||
[Unit]
|
[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]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
|
|
Loading…
Reference in a new issue