From de269fb0309d54546c968f6256b5d3f6a12bfbcc Mon Sep 17 00:00:00 2001 From: Ahmed AbdelHalim Date: Sat, 24 Jan 2026 18:19:36 +0100 Subject: Fix known_hosts The original implementation created the /home/root/.ssh/known_hosts This fix is to ensure that the known hosts are configured for the username that are being provisioned instead of root --- roles/ssh/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'roles') diff --git a/roles/ssh/tasks/main.yml b/roles/ssh/tasks/main.yml index 30aa6b9f..2624bed9 100644 --- a/roles/ssh/tasks/main.yml +++ b/roles/ssh/tasks/main.yml @@ -99,7 +99,7 @@ ansible.builtin.known_hosts: name: "{{ item.split(' ') | first }}" key: "{{ item }}" - path: "{{ ansible_facts['env']['HOME'] }}/.ssh/known_hosts" + path: "/home/{{ username }}/.ssh/known_hosts" state: present loop: "{{ ssh_known_hosts }}" when: ssh_known_hosts is defined and ssh_known_hosts | length > 0 -- cgit v1.2.3