Files
ansible/roles/borg-client/tasks/main.yml
2019-09-04 09:06:55 +02:00

27 lines
717 B
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

- name: create SSH key
openssh_keypair:
path: ~/.ssh/id_rsa
- name: get SSH pub key
command: cat ~/.ssh/id_rsa.pub
register: ssh_keys
- name: put backup script
template:
src: borgbackup.sh.j2
dest: /usr/local/bin/borgbackup.sh
owner: root
group: root
mode: '0750'
- name: cron the backup script
cron:
name: "borg backup script"
hour: "{{ borg_backup_hour }}"
minute: "{{ borg_backup_minute }}"
job: /usr/local/bin/borgbackup.sh
- name: warns about borg init
debug:
msg: "Borg has been installed. Dont forget to init with: \nborg init --encryption=repokey-blake2 backup@{{ hostvars[groups['borg_server'][0]]['ansible_fqdn'] }}:home"