mirror of
https://gitlab.archlinux.org/archlinux/infrastructure.git
synced 2024-05-05 18:46:02 +02:00
4112bdf9fd
yaml: truthy value should be one of [false, true] (truthy) yaml: wrong indentation: expected 4 but found 2 (indentation) yaml: too few spaces before comment (comments) yaml: missing starting space in comment (comments) yaml: too many blank lines (1 > 0) (empty-lines) yaml: too many spaces after colon (colons) yaml: comment not indented like content (comments-indentation) yaml: no new line character at the end of file (new-line-at-end-of-file) load-failure: Failed to load or parse file parser-error: couldn't resolve module/action 'hosts'. This often indicates a misspelling, missing collection, or incorrect module path.
42 lines
1.0 KiB
YAML
42 lines
1.0 KiB
YAML
---
|
|
|
|
- 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
|
|
|
|
- name: create the root backup directory at {{ backup_dir }}
|
|
file:
|
|
path: "{{ backup_dir }}/{{ item }}"
|
|
state: directory
|
|
owner: borg
|
|
group: borg
|
|
mode: 0700
|
|
with_items: "{{ backup_clients }}"
|
|
|
|
- name: fetch ssh keys from each borg client machine
|
|
command: cat /root/.ssh/id_rsa.pub
|
|
register: ssh_keys
|
|
delegate_to: "{{ item }}"
|
|
with_items: "{{ backup_clients }}"
|
|
changed_when: ssh_keys.stdout | length > 0
|
|
|
|
- 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"
|
|
with_items: "{{ ssh_keys.results }}"
|