From aa0bea9b700c9b70dba6c9920afb1b322b4beab8 Mon Sep 17 00:00:00 2001 From: Frank Villaro-Dixon Date: Tue, 22 Oct 2024 15:34:08 +0200 Subject: [PATCH] ssh keys: append instead of overwrite Signed-off-by: Frank Villaro-Dixon --- tasks/auth.yml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/tasks/auth.yml b/tasks/auth.yml index 0297f41..5370c2a 100644 --- a/tasks/auth.yml +++ b/tasks/auth.yml @@ -6,10 +6,9 @@ owner: root group: root -- name: Ensure authorized_keys keys - copy: - dest: /root/.ssh/authorized_keys - content: "{{ vars.ssh_keys | join('\n') }}" - owner: root - group: root - mode: '0600' \ No newline at end of file +- name: Add SSH authorized keys + ansible.posix.authorized_key: + user: root + key: "{{ item }}" + state: present + with_items: "{{ vars.ssh_keys }}"