Add tasks for Hetzner Storagebox

This commit is contained in:
phil 2023-05-08 10:36:42 +02:00
parent b8433bb4e0
commit fbdce3166f
2 changed files with 16 additions and 0 deletions

View file

@ -12,6 +12,10 @@
when: borgbase is defined and borgbase when: borgbase is defined and borgbase
tags: borgbase tags: borgbase
- name: Setup Hetzner storagebox backup
ansible.builtin.import_tasks: storagebox.yml
tags: storagebox
- name: Setup borg - name: Setup borg
ansible.builtin.import_tasks: borg.yml ansible.builtin.import_tasks: borg.yml
tags: borg tags: borg

12
tasks/storagebox.yml Normal file
View file

@ -0,0 +1,12 @@
---
- name: "Storagebox | Read key from file"
ansible.builtin.slurp:
src: "{{ 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 }}"