From 1d983369913992c2e76e41fa4eb3ce6373675c21 Mon Sep 17 00:00:00 2001 From: Michael Grote Date: Tue, 23 Jul 2024 18:55:37 +0200 Subject: [PATCH] sanoid/syncoid: fix private-key formatting (#143) Reviewed-on: https://git.mgrote.net/mg/homeserver/pulls/143 Co-authored-by: Michael Grote Co-committed-by: Michael Grote --- roles/mgrote_zfs_sanoid/tasks/destination.yml | 6 ++++-- roles/mgrote_zfs_sanoid/templates/private_key.j2 | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 roles/mgrote_zfs_sanoid/templates/private_key.j2 diff --git a/roles/mgrote_zfs_sanoid/tasks/destination.yml b/roles/mgrote_zfs_sanoid/tasks/destination.yml index 1e0fcd19..a69188a7 100644 --- a/roles/mgrote_zfs_sanoid/tasks/destination.yml +++ b/roles/mgrote_zfs_sanoid/tasks/destination.yml @@ -1,8 +1,8 @@ --- - name: template ssh private key become: true - ansible.builtin.copy: - content: "{{ sanoid_syncoid_ssh_privkey }}" + ansible.builtin.template: + src: private_key.j2 dest: "/etc/sanoid/.ssh/id_sanoid" owner: "{{ sanoid_user }}" group: "{{ sanoid_user_group }}" @@ -11,6 +11,8 @@ when: - sanoid_syncoid_destination_host + + - name: add user to sudoers become: true ansible.builtin.blockinfile: diff --git a/roles/mgrote_zfs_sanoid/templates/private_key.j2 b/roles/mgrote_zfs_sanoid/templates/private_key.j2 new file mode 100644 index 00000000..de719dbf --- /dev/null +++ b/roles/mgrote_zfs_sanoid/templates/private_key.j2 @@ -0,0 +1 @@ +{{ sanoid_syncoid_ssh_privkey }}