Skip to content

Commit 70d5d0c

Browse files
committed
Support sshd password authentication on Rocky 8
Rocky 8 doesn't have an sshd_config.d directory, so we need to adjust the main configuration file.
1 parent 440d6f5 commit 70d5d0c

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

ansible/roles/sshd/tasks/configure.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
- name: Grab facts to determine distribution
2+
setup:
3+
14
- name: Template sshd configuration
25
# NB: If parameters are defined multiple times the first value wins;
36
# The default /etc/ssh/sshd_config has
@@ -13,3 +16,17 @@
1316
validate: sshd -t -f %s
1417
notify:
1518
- Restart sshd
19+
when: ansible_facts.distribution_major_version == '9'
20+
21+
- name: Disallow SSH password authentication
22+
lineinfile:
23+
dest: /etc/ssh/sshd_config
24+
regexp: "^PasswordAuthentication"
25+
line: "PasswordAuthentication {{ 'yes' if sshd_password_authentication | bool else 'no' }}"
26+
state: present
27+
validate: sshd -t -f %s
28+
notify:
29+
- Restart sshd
30+
become: true
31+
when: ansible_facts.distribution_major_version == '8'
32+

0 commit comments

Comments
 (0)