File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change 40
40
ssh_priv_key: 'path-to-id'
41
41
ssh_authorized_keys:
42
42
- path_to_key.pub
43
+ ssh_known_hosts:
44
+ - "[localhost]:2222 ecdsa-sha2-nistp256 soooomeeekey-here"
43
45
gid: 1161
44
46
uid: 2050
45
47
disabled: no
Original file line number Diff line number Diff line change 26
26
loop_control :
27
27
loop_var : auth_key_path
28
28
with_items : " {{ user.ssh_authorized_keys }}"
29
+
30
+ - when : " 'ssh_known_hosts' in user and user.ssh_known_hosts"
31
+ block :
32
+ - name : Add host to known_hosts
33
+ become_user : " {{ user.login }}"
34
+ become : true
35
+ lineinfile :
36
+ path : " {{ user_home }}/.ssh/known_hosts"
37
+ regexp : " ^{{ known_host }}"
38
+ line : " {{ known_host }}"
39
+ create : true
40
+ mode : 0600
41
+ loop_control :
42
+ loop_var : known_host
43
+ with_items : " {{ user.ssh_known_hosts }}"
You can’t perform that action at this time.
0 commit comments