fix fragile tasks
This commit is contained in:
1 parent
39231dce9d
commit
c362460b86
2 files changed
+5
-8
No files matched your search
@@ -3,6 +3,7 @@
|
||||
ansible.builtin.apt:
|
||||
name: restic
|
||||
state: present
|
||||
update_cache: true
|
||||
|
||||
- name: Initialize restic repository
|
||||
environment:
|
||||
@@ -11,11 +12,11 @@
|
||||
AWS_ACCESS_KEY_ID: "{{ vault_aws_access_key }}"
|
||||
AWS_SECRET_ACCESS_KEY: "{{ vault_aws_secret_key }}"
|
||||
block:
|
||||
- name: Check if already initialized
|
||||
ansible.builtin.command: restic snapshots
|
||||
- name: Check if repository is initialized
|
||||
command: restic cat config
|
||||
register: restic_check
|
||||
failed_when: false
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
|
||||
- name: Initialize repository
|
||||
ansible.builtin.command: restic init
|
||||
|
||||
@@ -3,11 +3,7 @@
|
||||
|
||||
set -e
|
||||
|
||||
# Source environment variables if running manually/outside Systemd
|
||||
if [ -f /etc/restic-backup.env ]; then
|
||||
# shellcheck source=/dev/null
|
||||
. /etc/restic-backup.env
|
||||
fi
|
||||
## Environment is injected by the systemd unit via EnvironmentFile=/etc/restic-backup.env. Run manually with: systemctl start restic-backup.service
|
||||
|
||||
echo "Starting Restic Backup at $(date)"
|
||||
|
||||
|
||||
Reference in new issue
Block a user