36 lines
1 KiB
YAML
36 lines
1 KiB
YAML
|
- 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
|
||
|
|
||
|
- 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
|