2016-05-22 04:43:14 +02:00
|
|
|
---
|
|
|
|
|
|
|
|
- name: install borg
|
|
|
|
pacman: name=borg state=present
|
|
|
|
|
2016-05-28 19:06:00 +02:00
|
|
|
- name: create borg user
|
|
|
|
user: home="{{ backup_dir }}" name=borg
|
|
|
|
|
|
|
|
- name: create borg user home
|
2016-09-22 09:24:07 +02:00
|
|
|
file: path="{{ backup_dir }}" state=directory owner=borg group=borg mode=0700
|
2016-05-28 19:06:00 +02:00
|
|
|
|
2016-05-22 04:43:14 +02:00
|
|
|
- name: create the root backup directory at {{ backup_dir }}
|
2016-09-22 09:24:07 +02:00
|
|
|
file: path="{{ backup_dir }}/{{ item }}" state=directory owner=borg group=borg mode=0700
|
2016-05-22 04:43:14 +02:00
|
|
|
with_items: "{{ backup_clients }}"
|
|
|
|
|
|
|
|
- name: fetch ssh keys
|
|
|
|
command: cat /root/.ssh/id_rsa.pub
|
|
|
|
register: ssh_keys
|
|
|
|
delegate_to: "{{ groups[item][0] }}"
|
|
|
|
with_items: "{{ backup_clients }}"
|
|
|
|
|
|
|
|
- name: allow certain clients to connect
|
|
|
|
authorized_key:
|
2016-05-28 19:06:00 +02:00
|
|
|
user=borg
|
2016-05-22 04:43:14 +02:00
|
|
|
key="{{ item.stdout }}"
|
|
|
|
manage_dir=yes
|
2016-05-29 17:37:24 +02:00
|
|
|
key_options="command=\"/usr/bin/borg serve --restrict-to-path {{ backup_dir }}/{{ item['item'] }}\",no-pty,no-agent-forwarding,no-port-forwarding,no-X11-forwarding,no-user-rc"
|
2016-05-22 04:43:14 +02:00
|
|
|
with_items: "{{ ssh_keys.results }}"
|