47 lines
1.2 KiB
YAML
47 lines
1.2 KiB
YAML
- name: Install borg
|
|
apt:
|
|
pkg:
|
|
- borgbackup
|
|
- borgmatic
|
|
- name: Copy borg backup config
|
|
template:
|
|
src: "{{ role_path }}/templates/backup.yml.j2"
|
|
dest: /root/backup.yml
|
|
- name: Copy systemd service
|
|
template:
|
|
src: "{{ role_path }}/templates/backup.service.j2"
|
|
dest: "/etc/systemd/system/backup.service"
|
|
register: service
|
|
- name: Copy systemd timer
|
|
copy:
|
|
src: "{{ role_path }}/files/backup.timer"
|
|
dest: "/etc/systemd/system/backup.timer"
|
|
register: timer
|
|
- name: Enable timer
|
|
systemd:
|
|
name: backup.timer
|
|
enabled: true
|
|
state: started
|
|
daemon_reload: "{{ 'yes' if service.changed or timer.changed else 'no' }}"
|
|
- name: Create extra disk moint point
|
|
file:
|
|
path: "{{ kingston1tb_mount_point }}"
|
|
state: directory
|
|
- name: Mount extra disk
|
|
ansible.posix.mount:
|
|
path: "{{kingston1tb_mount_point }}"
|
|
src: "UUID={{ kingston1tb_uuid }}"
|
|
fstype: ext4
|
|
passno: 1
|
|
state: present
|
|
- name: Install borg
|
|
apt:
|
|
name: borgbackup
|
|
- name: Add Borg public key
|
|
authorized_key:
|
|
key: "{{ borg_public_key }}"
|
|
user: "{{ ansible_user_id }}"
|
|
- name: Create Borg repository
|
|
command:
|
|
cmd: "borg init -e none {{ backup_location }}"
|
|
creates: "{{ backup_location }}"
|