summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAhmed Abdelhalim <[email protected]>2026-01-24 18:19:36 +0100
committerAhmed Abdelhalim <[email protected]>2026-01-24 18:19:36 +0100
commitd1fa33c211094a1875bd8d17566aeccd84434e82 (patch)
tree936ee5f99f82682d3665efbf7c359a685a5f15fd
parent9b377bbc1fc75f34a8cca9df667684256e1b6fc2 (diff)
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
-rw-r--r--roles/ssh/tasks/main.yml2
1 files changed, 1 insertions, 1 deletions
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