From 9d4c7be8019ef4ea122884cff96801fb69f1d942 Mon Sep 17 00:00:00 2001 From: Sam Al-Sapti Date: Mon, 6 Mar 2023 13:33:18 +0100 Subject: [PATCH] Add known_hosts to Restic's SSH folder --- roles/docker/defaults/main.yml | 7 ++++--- roles/docker/tasks/services/restic_backup.yml | 8 ++++++++ roles/docker/templates/restic.ssh.known_hosts.j2 | 1 + 3 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 roles/docker/templates/restic.ssh.known_hosts.j2 diff --git a/roles/docker/defaults/main.yml b/roles/docker/defaults/main.yml index bb055cb..ac062cb 100644 --- a/roles/docker/defaults/main.yml +++ b/roles/docker/defaults/main.yml @@ -49,10 +49,11 @@ services: restic: file: restic_backup.yml - user: "dc-user" - domain: "rynkeby.skovgaard.tel" + user: dc-user + domain: rynkeby.skovgaard.tel + host_key: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBLGol2G+a87ssy0nu/STKBZSiGyhZhZKx/ujfe9IeFo volume_folder: "{{ volume_root_folder }}/restic" - repository: "restic" + repository: restic version: "1.6.0" disabled_in_vagrant: true diff --git a/roles/docker/tasks/services/restic_backup.yml b/roles/docker/tasks/services/restic_backup.yml index 3ce61f6..b193a2f 100644 --- a/roles/docker/tasks/services/restic_backup.yml +++ b/roles/docker/tasks/services/restic_backup.yml @@ -39,6 +39,14 @@ group: root mode: '0600' +- name: Create SSH known_hosts file + template: + src: restic.ssh.known_hosts.j2 + dest: "{{ services.restic.volume_folder }}/ssh/known_hosts" + owner: root + group: root + mode: '0600' + - name: Setup restic backup docker_compose: project_name: restic_backup diff --git a/roles/docker/templates/restic.ssh.known_hosts.j2 b/roles/docker/templates/restic.ssh.known_hosts.j2 new file mode 100644 index 0000000..19ac263 --- /dev/null +++ b/roles/docker/templates/restic.ssh.known_hosts.j2 @@ -0,0 +1 @@ +{{ services.restic.domain }} {{ services.restic.host_key }}