-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathborg.yaml
56 lines (42 loc) · 1.46 KB
/
borg.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
- hosts: apnscp
vars_prompt:
- name: borgbase_username
prompt: "Borgbase Username"
private: no
- name: borgbase_password
prompt: "Borgbase Password"
pre_tasks:
- pip:
name: requests
virtualenv: /ansible_launchpad
- pip:
name: urllib3
virtualenv: /ansible_launchpad
- debug:
msg: -username "{{ borgbase_username }}" -password "{{ borgbase_password }}" -hostname "{{ ansible_hostname }}"
- name: create repo and ssh key
script: /etc/ansible/files/create_borgbase_repo.py -username "{{ borgbase_username }}" -password "{{ borgbase_password }}" -hostname "{{ ansible_hostname }}"
register: output
- debug: var=output.stdout_lines
- name: do facts module to get latest information
setup:
vars:
borgbase_host: "{{ ansible_local['borgbase_repo'].split('@')[1] | replace(':repo', '') }}"
roles:
- role: borgbackup
borg_encryption_passphrase: "{{ borg_passphrase }}"
borg_repository: "{{ ansible_local['borgbase_repo'] }}"
borg_source_directories:
- /home/virtual
borg_retention_policy:
keep_hourly: 3
keep_daily: 7
keep_weekly: 4
keep_monthly: 6
post_tasks:
- name: ensure borg repo is a known host
known_hosts:
name: "{{ borgbase_host }}"
key: "{{ lookup('pipe', 'ssh-keyscan -t ed25519 {{ borgbase_host }}') }}"
- name: initialize borg repo
shell: borgmatic init --encryption=repokey-blake2