File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change 38
38
Port {{ pve_ssh_port }}
39
39
{% endfor %}
40
40
41
+ - name : Ensure SSH config directory exists
42
+ ansible.builtin.file :
43
+ path : /etc/ssh/sshd_config.d
44
+ state : directory
45
+ mode : " 0755"
46
+
41
47
- name : Allow root logins from PVE cluster hosts
42
48
ansible.builtin.blockinfile :
43
- dest : /etc/ssh/sshd_config
49
+ dest : /etc/ssh/sshd_config.d/00-pve.conf
50
+ create : yes
51
+ mode : " 0640"
44
52
marker : " # {mark}: Allow root logins from PVE hosts (managed by ansible)."
45
53
content : |
46
54
{% for host in groups[pve_group] %}
47
55
Match Address {{ hostvars[host].pve_cluster_ssh_addrs | join(",") }}
48
- PermitRootLogin prohibit-password
56
+ PermitRootLogin prohibit-password
49
57
{% endfor %}
50
58
validate : " /usr/sbin/sshd -t -f %s"
51
59
notify :
52
60
- reload ssh server configuration
53
61
62
+ - name : Remove SSH configuration from main sshd_config if present in favor of config in sshd_config.d
63
+ ansible.builtin.blockinfile :
64
+ path : /etc/ssh/sshd_config
65
+ marker : " # {mark}: Allow root logins from PVE hosts (managed by ansible)."
66
+ state : absent
67
+ notify :
68
+ - reload ssh server configuration
69
+
54
70
- name : Enable and start SSH server
55
71
ansible.builtin.systemd :
56
72
name : ssh.service
You can’t perform that action at this time.
0 commit comments