Create SSH config for borg providers

This commit is contained in:
phil 2023-05-08 11:21:21 +02:00
parent fbdce3166f
commit f4152f9a5e
5 changed files with 23 additions and 14 deletions

View file

@ -1,12 +1,10 @@
---
- name: "Storagebox | Read key from file"
ansible.builtin.slurp:
src: "{{ borg_ssh_key_file_path }}.pub"
ansible.builtin.command:
cmd: "cat {{ borg_ssh_key_file_path }}.pub"
register: ssh_key
check_mode: true
- name: "Storagebox | Copy key to Hetzner"
ansible.posix.authorized_key:
user: "{{ hetzner_storagebox_user }}"
key: "{{ (ssh_key.content | b64decode) }}"
delegate_to: "{{ hetzner_storagebox }}"
ansible.builtin.command:
cmd: "echo {{ ssh_key.stdout_lines }} | ssh {{ hetzner_storagebox.user }}@{{ hetzner_storagebox.server }} -p {{ hetzner_storagebox.port }} install-ssh-key"
delegate_to: localhost