2024-02-22 19:09:43 +01:00
|
|
|
- name:
|
|
|
|
become: true
|
|
|
|
block:
|
|
|
|
- name: Install packages borgbackup & sqlite3
|
|
|
|
apt:
|
|
|
|
name:
|
|
|
|
- borgbackup
|
|
|
|
# SQLite required for Vaultwarden
|
|
|
|
- sqlite3
|
|
|
|
|
|
|
|
- name: Get borg passphrase file stat
|
|
|
|
stat:
|
|
|
|
path: "{{ borg_passphrase_file }}"
|
|
|
|
register: borg_stat_passphrase_file_result
|
|
|
|
|
|
|
|
- name: "Template borg-passphrase.txt to {{ borg_passphrase_file }}"
|
|
|
|
template:
|
|
|
|
src: borg-passphrase.txt
|
|
|
|
dest: "{{ borg_passphrase_file }}"
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: '600'
|
|
|
|
when: not borg_stat_passphrase_file_result.stat.exists or borg_update_passphrase | default(false) | bool
|
2024-03-05 11:15:10 +01:00
|
|
|
|
2024-02-22 19:09:43 +01:00
|
|
|
- name: Get borg repository stat
|
|
|
|
stat:
|
|
|
|
path: "{{ borg_repodir }}"
|
|
|
|
register: borg_stat_repodir_result
|
|
|
|
|
|
|
|
- name: Create borg repository
|
|
|
|
command:
|
|
|
|
cmd: "borg init --encryption repokey {{ borg_repodir }}"
|
|
|
|
environment:
|
|
|
|
BORG_PASSCOMMAND: "cat {{ borg_passphrase_file }}"
|
|
|
|
when: not borg_stat_repodir_result.stat.exists
|