generated from stuvusIT/ansible_skeleton
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
152 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
- name: Reload systemd configuration | ||
service: | ||
daemon_reload: True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,52 @@ | ||
--- | ||
- name: Install dependencies | ||
apt: | ||
name: | ||
- proot | ||
- python3-udatetime | ||
- restic | ||
|
||
- name: Install zfs-restic-uploader | ||
copy: | ||
src: zfs-restic-uploader | ||
dest: /opt/zfs-restic-uploader | ||
mode: 0755 | ||
|
||
- name: Create config directory | ||
file: | ||
path: /etc/zfs-restic-uploader | ||
state: directory | ||
|
||
- name: Place restic password | ||
copy: | ||
content: "{{ zru_restic_repo_password }}" | ||
dest: /etc/zfs-restic-uploader/restic-password | ||
mode: 0600 | ||
|
||
- name: Place env file | ||
template: | ||
src: env.j2 | ||
dest: /etc/zfs-restic-uploader/env | ||
mode: 0600 | ||
|
||
- name: Create systemd service | ||
template: | ||
src: service.j2 | ||
dest: /etc/systemd/system/zfs-restic-uploader.service | ||
mode: 0644 | ||
notify: | ||
- Reload systemd configuration | ||
|
||
- name: Create systemd timer | ||
template: | ||
src: timer.j2 | ||
dest: /etc/systemd/system/zfs-restic-uploader.timer | ||
mode: 0644 | ||
notify: | ||
- Reload systemd configuration | ||
|
||
- meta: flush_handlers | ||
|
||
- name: Enable zfs-restic-uploader timer | ||
systemd: | ||
name: zfs-restic-uploader.timer | ||
enabled: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# {{ ansible_managed }} | ||
AWS_ACCESS_KEY_ID={{ zru_access_key_id | quote }} | ||
AWS_SECRET_ACCESS_KEY={{ zru_secret_access_key | quote }} | ||
XDG_CACHE_HOME={{ zru_cache_directory }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# {{ ansible_managed }} | ||
[Unit] | ||
Description=upload ZFS snapshots to restic repository | ||
Requires=zfs.target | ||
After=zfs.target | ||
|
||
[Service] | ||
Type=oneshot | ||
EnvironmentFile=/etc/zfs-restic-uploader/env | ||
ExecStart=/opt/zfs-restic-uploader \ | ||
-r {{ zru_restic_repo_prefix | quote }} \ | ||
-p /etc/zfs-restic-uploader/restic-password \ | ||
-c {{ zru_zfs_dataset_common_prefix | quote }} \ | ||
--exclude-snapnames-regex {{ zru_exclude_snapnames_regex | quote }} \ | ||
dataset {{ zru_zfs_datasets | map("quote") | join(" ") }} \ | ||
--keep-last-n {{ zru_keep_last_n | quote }} \ | ||
--keep-weekly-n {{ zru_keep_weekly_n | quote }} \ | ||
--keep-monthly-n {{ zru_keep_monthly_n | quote }} | ||
Restart=on-failure |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# {{ ansible_managed }} | ||
[Unit] | ||
Description=upload ZFS snapshots to restic repository | ||
|
||
[Timer] | ||
OnCalendar={{ zru_schedule }} | ||
Unit=kopia.service | ||
|
||
[Install] | ||
WantedBy=timers.target |