Skip to content

Commit f2c4c15

Browse files
committed
Reload sshd in configure.yaml
/etc/issue content is not dynamically read by the sshd process for new connections. Also, registered facts are not available across plybooks/services. Therefore reload sshd in `configure-os` service. jira: https://issues.redhat.com/browse/OSPRH-20269 Signed-off-by: rabi <[email protected]>
1 parent 5a1d380 commit f2c4c15

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

roles/edpm_sshd/tasks/configure.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
mode: "0644"
5858
when:
5959
- edpm_sshd_banner_enabled | bool
60+
register: sshd_banner_result
6061

6162
- name: Configure the motd banner
6263
become: true
@@ -83,11 +84,14 @@
8384
src: sshd_config_block.j2
8485
mode: "0600"
8586
validate: '/usr/sbin/sshd -T -f %s'
86-
register: _sshd_config_result
87+
register: sshd_config_result
8788

88-
- name: Set sshd config changed fact
89-
ansible.builtin.set_fact:
90-
_sshd_config_result_changed: _sshd_config_result.changed
89+
- name: Reload sshd due to config change
90+
ansible.builtin.systemd:
91+
name: sshd
92+
state: reloaded
93+
when:
94+
- sshd_config_result.changed or sshd_banner_result.changed|default(false)
9195

9296
- name: Configure firewall for the service
9397
become: true

roles/edpm_sshd/tasks/run.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,3 @@
2626
ansible.builtin.systemd:
2727
name: sshd
2828
state: started
29-
30-
- name: Restart sshd due to config change
31-
ansible.builtin.systemd:
32-
name: sshd
33-
state: reloaded
34-
when:
35-
- _sshd_config_result_changed | default(false)

0 commit comments

Comments
 (0)