diff options
author | Elizabeth Hunt <elizabeth.hunt@simponic.xyz> | 2024-04-27 23:41:11 -0400 |
---|---|---|
committer | Elizabeth Hunt <elizabeth.hunt@simponic.xyz> | 2024-04-27 23:41:11 -0400 |
commit | 9ac6be27c5a2e32fe3770590283cfc6b1b7dfe8b (patch) | |
tree | 524479f5d809b1b8fd29f75d7a732be8567bc2a1 /roles/borg | |
parent | f9d62cc8a792b7b1a2c52a7d8102895473b3c72a (diff) | |
download | oldinfra-9ac6be27c5a2e32fe3770590283cfc6b1b7dfe8b.tar.gz oldinfra-9ac6be27c5a2e32fe3770590283cfc6b1b7dfe8b.zip |
borg
Diffstat (limited to 'roles/borg')
-rw-r--r-- | roles/borg/tasks/main.yml | 28 | ||||
-rw-r--r-- | roles/borg/templates/borg_ssh_key.j2 | 1 |
2 files changed, 29 insertions, 0 deletions
diff --git a/roles/borg/tasks/main.yml b/roles/borg/tasks/main.yml new file mode 100644 index 0000000..fd3be99 --- /dev/null +++ b/roles/borg/tasks/main.yml @@ -0,0 +1,28 @@ +- name: copy key + template: + src: ../templates/borg_ssh_key.j2 + dest: /root/borg_ssh_key + owner: root + group: root + mode: 0600 + +- name: push borg + import_role: + name: borgbase.ansible_role_borgbackup + vars: + borg_encryption_passphrase: "{{ borg_password }}" + borg_repository: "{{ borg_repo }}" + borg_user: "{{ borg_my_user }}" + borg_group: "{{ borg_my_group }}" + borgmatic_timer: cron + borg_ssh_command: "ssh -o StrictHostKeyChecking=no -i {{ borg_ssh_key }}" + borg_source_directories: + "{{ base_files + (extra_files[inventory_hostname] | default([])) }}" + borg_retention_policy: + keep_hourly: 3 + keep_daily: 7 + keep_weekly: 4 + keep_monthly: 6 + borgmatic_hooks: + after_backup: + - "curl -d '{{ inventory_hostname }}' {{ backup_topic }}" diff --git a/roles/borg/templates/borg_ssh_key.j2 b/roles/borg/templates/borg_ssh_key.j2 new file mode 100644 index 0000000..70d4cc9 --- /dev/null +++ b/roles/borg/templates/borg_ssh_key.j2 @@ -0,0 +1 @@ +{{ borg_secret_key | b64decode }} |