37 lines
976 B
YAML
37 lines
976 B
YAML
---
|
|
- name: Setup backup storage password
|
|
copy:
|
|
content: "{{ backup_storage_key }}"
|
|
dest: "{{ backup_home }}/.borg.key"
|
|
owner: "{{ backup_owner }}"
|
|
group: "{{ backup_group }}"
|
|
mode: "0600"
|
|
|
|
- name: Setup ssh keys
|
|
copy:
|
|
content: "{{ item.content }}"
|
|
dest: "{{ backup_home }}/.ssh/{{ item.file }}"
|
|
owner: "{{ backup_owner }}"
|
|
group: "{{ backup_group }}"
|
|
mode: "0600"
|
|
loop:
|
|
- content: "{{ backup_owner_ssh_private_key }}"
|
|
file: "id_rsa"
|
|
- content: "{{ backup_owner_ssh_public_key }}"
|
|
file: "id_rsa.pub"
|
|
loop_control:
|
|
label: "{{ item.file }}"
|
|
|
|
- name: setup backup script
|
|
template:
|
|
src: "./usr/local/bin/{{ backup_host }}-backup.sh.j2"
|
|
dest: "/usr/local/bin/backup.sh"
|
|
owner: "{{ backup_owner }}"
|
|
group: "{{ backup_group }}"
|
|
mode: "0750"
|
|
|
|
- name: trigger cron job
|
|
cron:
|
|
user: "{{ backup_owner }}"
|
|
job: "/usr/local/bin/backup.sh"
|
|
special_time: "{{ backup_special_time }}" |