1
1
Fork 0
mirror of https://gitlab.archlinux.org/archlinux/infrastructure.git synced 2024-05-19 00:16:04 +02:00
infrastructure/roles/borg_server/tasks/main.yml

42 lines
1.0 KiB
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:
name: borg
home: "{{ backup_dir }}"
- 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 }}"
2020-03-08 17:25:03 +01:00
- name: fetch ssh keys from each borg client machine
2016-05-22 04:43:14 +02:00
command: cat /root/.ssh/id_rsa.pub
register: ssh_keys
delegate_to: "{{ item }}"
2016-05-22 04:43:14 +02:00
with_items: "{{ backup_clients }}"
changed_when: ssh_keys.stdout | length > 0
2016-05-22 04:43:14 +02:00
- name: allow certain clients to connect
authorized_key:
user: borg
key: "{{ item.stdout }}"
manage_dir: true
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 }}"