1
1
Fork 0
mirror of https://gitlab.archlinux.org/archlinux/infrastructure.git synced 2024-06-02 09:36:03 +02:00
infrastructure/roles/borg-server/tasks/main.yml

29 lines
927 B
YAML
Raw Normal View History

2016-05-22 04:43:14 +02:00
---
- name: install borg
pacman: name=borg state=present
- name: create borg user
user: home="{{ backup_dir }}" name=borg
- name: create borg user home
file: path="{{ backup_dir }}" state=directory owner=borg group=borg mode=0700
2016-05-22 04:43:14 +02:00
- name: create the root backup directory at {{ backup_dir }}
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:
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 }}"