vps/roles/borg-init/tasks/main.yml

50 lines
1.6 KiB
YAML
Raw Normal View History

- 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
- name: Get Hedgedoc MySQL root password file stat
stat:
path: "{{ hedgedoc_mysql_root_password_file }}"
register: hedgedoc_mysql_root_password_file_result
- name: "Template hedgedoc-mysql-root-password.txt to {{ hedgedoc_mysql_root_password_file }}"
template:
src: hedgedoc-mysql-root-password.txt
dest: "{{ hedgedoc_mysql_root_password_file }}"
owner: root
group: root
mode: '600'
when: not hedgedoc_mysql_root_password_file_result.stat.exists or hedgedoc_update_mysql_root_password | 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