summaryrefslogtreecommitdiffstats
path: root/roles/ssh
diff options
context:
space:
mode:
authorAhmed AbdelHalim <[email protected]>2026-02-13 00:34:14 +0100
committerAhmed AbdelHalim <[email protected]>2026-02-13 00:34:14 +0100
commit9575e57578d17b5f0a1479efef9426f4223c8ea1 (patch)
treeef9b90acb12cf114c3855a771571ad2566a2a4c0 /roles/ssh
parentc4f032b3a304c147af309f7744760a53eb900266 (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')
-rw-r--r--roles/ssh/tasks/main.yml6
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']