summaryrefslogtreecommitdiff
path: root/roles/storage/zfs/syncoid/tasks
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2021-05-19 16:52:36 +0200
committerChristian Pointner <equinox@spreadspace.org>2021-05-19 16:52:36 +0200
commit26214e3f7c5343fa30d2ff1ae71a6cf7197b6f3e (patch)
tree3782b45b690df45257e4170df86b57a4b4f3575c /roles/storage/zfs/syncoid/tasks
parentrename apt-repo github-containers to kubic-project (diff)
initial version of syncoid autosuspender
Diffstat (limited to 'roles/storage/zfs/syncoid/tasks')
-rw-r--r--roles/storage/zfs/syncoid/tasks/main.yml34
1 files changed, 29 insertions, 5 deletions
diff --git a/roles/storage/zfs/syncoid/tasks/main.yml b/roles/storage/zfs/syncoid/tasks/main.yml
index a01900b1..7c489baa 100644
--- a/roles/storage/zfs/syncoid/tasks/main.yml
+++ b/roles/storage/zfs/syncoid/tasks/main.yml
@@ -43,8 +43,8 @@
loop_control:
label: "{{ item.key }}"
template:
- src: systemd.service.j2
- dest: "/etc/systemd/system/syncoid-{{ item.key }}.service"
+ src: run.service.j2
+ dest: "/etc/systemd/system/syncoid-run-{{ item.key }}.service"
- name: create systemd timer units for periodic backups
loop: "{{ zfs_syncoid_sources | dict2items }}"
@@ -52,8 +52,8 @@
label: "{{ item.key }}"
when: "'periodic' in item.value"
template:
- src: systemd.timer.j2
- dest: "/etc/systemd/system/syncoid-{{ item.key }}.timer"
+ src: run.timer.j2
+ dest: "/etc/systemd/system/syncoid-run-{{ item.key }}.timer"
- name: make sure systemd timer units for periodic backups are enabled and started
loop: "{{ zfs_syncoid_sources | dict2items }}"
@@ -62,6 +62,30 @@
when: "'periodic' in item.value"
systemd:
daemon_reload: yes
- name: "syncoid-{{ item.key }}.timer"
+ name: "syncoid-run-{{ item.key }}.timer"
state: started
enabled: yes
+
+- name: enable autosuspend
+ when: zfs_syncoid_autosuspend
+ block:
+ - name: install autosuspend script
+ template:
+ src: autosuspend.py.j2
+ dest: /usr/local/bin/syncoid-autosuspend.py
+ mode: 0755
+
+ - name: install autosuspend systemd units
+ loop:
+ - service
+ - timer
+ template:
+ src: "autosuspend.{{ item }}.j2"
+ dest: "/etc/systemd/system/syncoid-autosuspend.{{ item }}"
+
+ - name: make sure autosuspend timer unit is enabled and started
+ systemd:
+ daemon_reload: yes
+ name: syncoid-autosuspend.timer
+ enabled: yes
+ state: started