mirror of
https://gitlab.archlinux.org/archlinux/infrastructure.git
synced 2025-01-18 08:06:16 +01:00
34 lines
1.1 KiB
YAML
34 lines
1.1 KiB
YAML
# This role runs on localhost; use commands like sftp to upload configuration
|
|
|
|
- name: Create the root backup directory at {{ backup_dir }}
|
|
expect:
|
|
command: bash -c "echo 'mkdir {{ backup_dir }}' | sftp {{ rsync_net_username }}@{{ rsync_net_username }}.rsync.net"
|
|
responses:
|
|
(?i)password: "{{ rsync_net_password }}"
|
|
|
|
- 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 }}"
|
|
changed_when: client_ssh_keys.changed
|
|
|
|
- name: Create tempfile
|
|
tempfile: state=file
|
|
register: tempfile
|
|
|
|
- name: Fill tempfile # noqa risky-file-permissions
|
|
template: src=authorized_keys.j2 dest={{ tempfile.path }} mode=0644
|
|
|
|
- name: Upload authorized_keys file
|
|
expect:
|
|
command: |
|
|
bash -c 'sftp {{ rsync_net_username }}@{{ rsync_net_username }}.rsync.net <<EOF
|
|
mkdir .ssh
|
|
chmod 700 .ssh
|
|
put {{ tempfile.path }} .ssh/authorized_keys
|
|
chmod 600 .ssh/authorized_keys
|
|
EOF'
|
|
responses:
|
|
(?i)password: "{{ rsync_net_password }}"
|