ff
This commit is contained in:
parent
5078e04043
commit
555a638bfd
5 changed files with 5 additions and 42 deletions
|
@ -8,16 +8,18 @@
|
|||
group: "{{ sanoid_user_group }}"
|
||||
mode: "0400"
|
||||
|
||||
- name: Template sanoid_mail.service
|
||||
- name: Ensure systemd services are templated
|
||||
become: true
|
||||
ansible.builtin.template:
|
||||
src: "sanoid_mail.service.j2"
|
||||
dest: /etc/systemd/system/sanoid_mail.service
|
||||
src: "{{ item }}.j2"
|
||||
dest: /etc/systemd/system/{{ item }}
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0644"
|
||||
notify:
|
||||
- systemctl daemon-reload
|
||||
loop:
|
||||
- sanoid_mail.service
|
||||
|
||||
- name: add overrides (sanoid_mail + TZ)
|
||||
become: true
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
{{ file_header | default () }}
|
||||
|
||||
[Unit]
|
||||
Description=Send zfs snapshots with sanoid/syncoid.
|
||||
OnFailure=syncoid_mail.service
|
||||
OnSuccess=syncoid_mail.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=/usr/bin/syncoid.sh
|
|
@ -1,12 +0,0 @@
|
|||
#!/bin/bash
|
||||
{{ file_header | default () }}
|
||||
|
||||
# check if dest-dataset is mounted (sed: entferne 1. Zeile; awk: zeige nur yes/no; grep: RC1 when != yes)
|
||||
{% for item in sanoid_syncoid_datasets_sync %}
|
||||
# check if target dataset is mounted
|
||||
/usr/sbin/zfs get mounted -H {{ item.destination_mount_check }} 2>&1 > /dev/null || echo "Pool not mounted!"
|
||||
# check if source host is reachable
|
||||
ping -c1 -W1 {{ item.source_host }} > /dev/null || {{ item.source_host }} not reachable!
|
||||
# syncoid
|
||||
export HOME=/root ; /usr/bin/syncoid --compress=zstd-fast --sshoption=StrictHostKeyChecking=no --delete-target-snapshots --use-hold --preserve-recordsize --sshkey "/etc/sanoid/.ssh/id_sanoid" --source-bwlimit {{ sanoid_syncoid_bwlimit }} {{ sanoid_user }}@{{ item.source_host }}:{{ item.source_dataset }} {{ item.destination_dataset }}
|
||||
{% endfor %}
|
|
@ -1,9 +0,0 @@
|
|||
{{ file_header | default () }}
|
||||
[Unit]
|
||||
Description=Timer for syncoid.
|
||||
|
||||
[Timer]
|
||||
OnCalendar={{ sanoid_syncoid_timer }}
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target multi-user.target zfs.target
|
|
@ -1,8 +0,0 @@
|
|||
{{ file_header | default () }}
|
||||
|
||||
[Unit]
|
||||
Description=Send a Mail for sanoid service after error or success sanoid.service.
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/bin/bash -c '/usr/bin/journalctl -u syncoid.service -n 30 | mail -aFROM:syncoid@mgrote.net -s "syncoid - %H" {{ my_mail }}'
|
Loading…
Reference in a new issue