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 | e82f99951124d5ed62d04e016e04205d2b7ff1f1 (patch) | |
| tree | ef9b90acb12cf114c3855a771571ad2566a2a4c0 /roles/ssh/tasks/main.yml | |
| parent | 6d3109e2bfd98b48c11560ae12c5a4a9af787ed6 (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
Diffstat (limited to 'roles/ssh/tasks/main.yml')
| -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'] |
