This commit is contained in:
Elizabeth Hunt 2024-05-03 16:30:47 -07:00
parent 1afabe7e31
commit c824245ac9
Signed by untrusted user who does not match committer: simponic
GPG Key ID: 2909B9A7FF6213EE
6 changed files with 57 additions and 0 deletions

28
borg/tasks/main.yml Normal file
View File

@ -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 }}"

View File

@ -0,0 +1 @@
{{ borg_secret_key | b64decode }}

View File

@ -29,3 +29,6 @@
- name: Website for hatecomputers.club - name: Website for hatecomputers.club
ansible.builtin.import_playbook: playbooks/deploy-hatecomputers-club.yml ansible.builtin.import_playbook: playbooks/deploy-hatecomputers-club.yml
- name: Deploy borg
ansible.builtin.import_playbook: playbooks/deploy-borg.yml

15
group_vars/borg.yml Normal file
View File

@ -0,0 +1,15 @@
borg_my_user: "root"
borg_my_group: "root"
borg_ssh_key: "/root/borg_ssh_key"
backup_topic: "{{ borg_backup_topic }}"
base_files:
- /home
- /root
- /var
- /etc
- /boot
- /opt
extra_files:

View File

@ -0,0 +1,6 @@
---
- name: Borg setup
hosts: borg
roles:
- borg

View File

@ -14,3 +14,7 @@ hatecomputers_club_oauth2_client_id
hatecomputers_club_oauth2_client_secret hatecomputers_club_oauth2_client_secret
hcaptcha_site_key hcaptcha_site_key
hcaptcha_secret hcaptcha_secret
borg_secret_key
borg_password
borg_repo
borg_backup_topic