File tree Expand file tree Collapse file tree 2 files changed +21
-14
lines changed Expand file tree Collapse file tree 2 files changed +21
-14
lines changed Original file line number Diff line number Diff line change 7878 when :
7979 - ansible_facts.virtualization_type not in ["container", "docker", "podman"]
8080
81- - name : Restart ssh service
81+ - name : Restart ssh socket
8282 become : true
8383 ansible.builtin.service :
84- name : ssh
84+ name : " {{ ' ssh.socket' if ansible_facts.os_family == 'Debian' else 'sshd.socket' }} "
8585 state : restarted
86- register : ssh_service
87- failed_when :
88- - ssh_service is not success
89- - not 'Could not find the requested service' in ssh_service.msg
86+ enabled : true
9087 when :
9188 - ansible_facts.virtualization_type not in ["container", "docker", "podman"]
89+ - ansible_facts.distribution == "Ubuntu"
9290
93- - name : Restart sshd service
91+ - name : Restart ssh service
9492 become : true
9593 ansible.builtin.service :
96- name : sshd
94+ name : " {{ 'ssh.service' if ansible_facts.os_family == 'Debian' else ' sshd.service' }} "
9795 state : restarted
98- register : sshd_service
99- failed_when :
100- - sshd_service is not success
101- - not 'Could not find the requested service' in sshd_service.msg
96+ enabled : true
97+ when :
98+ - ansible_facts.virtualization_type not in ["container", "docker", "podman"]
99+
100+ - name : Disable ssh service
101+ become : true
102+ ansible.builtin.service :
103+ name : " {{ 'ssh.service' if ansible_facts.os_family == 'Debian' else 'sshd.service' }}"
104+ state : stopped
105+ enabled : false
102106 when :
103107 - ansible_facts.virtualization_type not in ["container", "docker", "podman"]
108+ - ansible_facts.distribution == "Ubuntu"
104109
105110- name : Restart Postfix
106111 become : true
Original file line number Diff line number Diff line change 250250 (not sshd_config_d.stat.exists) or
251251 (grep_include.rc != 0)
252252 notify :
253- - Restart sshd service
253+ - Disable ssh service
254+ - Restart ssh socket
254255 - Restart ssh service
255256
256257- name : Configure sshd using sshd_config.d
268269 - sshd_config_d.stat.exists
269270 - grep_include.rc == 0
270271 notify :
271- - Restart sshd service
272+ - Disable ssh service
273+ - Restart ssh socket
272274 - Restart ssh service
273275
274276- name : Remove possible Subsystem duplicate
You can’t perform that action at this time.
0 commit comments