diff options
| author | Ahmed AbdelHalim <[email protected]> | 2026-01-24 18:19:36 +0100 |
|---|---|---|
| committer | Ahmed AbdelHalim <[email protected]> | 2026-01-24 18:19:36 +0100 |
| commit | de269fb0309d54546c968f6256b5d3f6a12bfbcc (patch) | |
| tree | 936ee5f99f82682d3665efbf7c359a685a5f15fd /roles/ssh | |
| parent | 7eac6fe38100e40a1b56e2b99c68b1cdd269736b (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
Diffstat (limited to 'roles/ssh')
| -rw-r--r-- | roles/ssh/tasks/main.yml | 2 |
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 |
