diff options
| author | Ahmed AbdelHalim <[email protected]> | 2026-02-13 00:34:14 +0100 |
|---|---|---|
| committer | Ahmed AbdelHalim <[email protected]> | 2026-02-13 00:34:14 +0100 |
| commit | 9575e57578d17b5f0a1479efef9426f4223c8ea1 (patch) | |
| tree | ef9b90acb12cf114c3855a771571ad2566a2a4c0 | |
| parent | c4f032b3a304c147af309f7744760a53eb900266 (diff) | |
Fix the ssh/known_hosts permissions
The file was created by root during chroot setup, and therefore wasn't
writable, causing ssh to complain about the permission and asking every
time about the ssh fingerprint
| -rw-r--r-- | roles/ssh/tasks/main.yml | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/roles/ssh/tasks/main.yml b/roles/ssh/tasks/main.yml index 2624bed9..9fc0f51d 100644 --- a/roles/ssh/tasks/main.yml +++ b/roles/ssh/tasks/main.yml @@ -102,4 +102,8 @@ path: "/home/{{ username }}/.ssh/known_hosts" state: present loop: "{{ ssh_known_hosts }}" - when: ssh_known_hosts is defined and ssh_known_hosts | length > 0 + when: + - ssh_known_hosts is defined and ssh_known_hosts | length > 0 + # To ensure this is only run with user and not as a root + # to avoid creating the file with the wrong permissions + - not ansible_facts['is_chroot'] |
