1
1
mirror of https://gitlab.archlinux.org/archlinux/infrastructure.git synced 2025-01-18 08:06:16 +01:00
infrastructure/roles/rsync_net/tasks/main.yml

32 lines
956 B
YAML

---
# We have to set up the rsync.net account in a weird fashion because
# they don't support ansible directly (no Python and such).
- name: create the root backup directory at {{ backup_dir }}
raw: mkdir -p {{ backup_dir }}
tags:
- skip_ansible_lint
- name: fetch ssh keys from each borg client machine
command: cat /root/.ssh/id_rsa.pub
register: client_ssh_keys
delegate_to: "{{ item }}"
with_items: "{{ backup_clients }}"
remote_user: root
changed_when: client_ssh_keys.changed
- name: create tempfile
tempfile: state=file
register: tempfile
delegate_to: localhost
- name: fill tempfile
copy: content="{{ lookup('template', 'authorized_keys.j2') }}" dest="{{ tempfile.path }}"
delegate_to: localhost
- name: upload authorized_keys file
command: scp "{{ tempfile.path }}" "{{ rsync_net_username }}@{{ inventory_hostname }}":.ssh/authorized_keys
delegate_to: localhost
register: scp
changed_when: "scp.rc == 0"