Skip to content

Commit 1c2675c

Browse files
Merge pull request openstack-k8s-operators#831 from bshephar/sshd-motd
Use PAM for sshd Motd
2 parents bee8d8c + e032cf2 commit 1c2675c

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

roles/edpm_sshd/tasks/configure.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,16 @@
7474
{% if edpm_sshd_banner_enabled %}
7575
{% set _ = edpm_sshd_server_options.__setitem__('Banner', '/etc/issue') %}
7676
{% endif %}
77-
{% if edpm_sshd_motd_enabled %}
78-
{% set _ = edpm_sshd_server_options.__setitem__('PrintMotd', 'yes') %}
79-
{% endif %}
8077
{{ edpm_sshd_server_options }}
8178
79+
- name: Set sshd motd when enabled
80+
ansible.builtin.lineinfile:
81+
path: /etc/pam.d/sshd
82+
regexp: "^session.*optional.*pam_motd.so"
83+
line: "session optional pam_motd.so motd=/etc/motd"
84+
state: present
85+
when: edpm_sshd_motd_enabled
86+
8287
- name: Adjust ssh server configuration
8388
become: true
8489
ansible.builtin.template:

0 commit comments

Comments
 (0)