Skip to content

Commit 9a8f123

Browse files
authored
Support sshd password authentication on Rocky 8 (#565)
* 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. * Trailing whitespace * Use Include @sjpb had a preference for using the same drop in pattern as Rocky 9 so that people can customize the template file * Include files as soon as possible * Use Block in file Try and match format of Rocky 9
1 parent 302011e commit 9a8f123

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

ansible/roles/sshd/tasks/configure.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,30 @@
1+
- name: Grab facts to determine distribution
2+
setup:
3+
4+
- name: Ensure drop in directory exists
5+
file:
6+
path: /etc/ssh/sshd_config.d/*.conf
7+
state: directory
8+
owner: root
9+
group: root
10+
mode: 700
11+
become: true
12+
13+
- name: Ensure drop in directory is included
14+
blockinfile:
15+
dest: /etc/ssh/sshd_config
16+
content: |
17+
# To modify the system-wide sshd configuration, create a *.conf file under
18+
# /etc/ssh/sshd_config.d/ which will be automatically included below
19+
Include /etc/ssh/sshd_config.d/*.conf
20+
state: present
21+
insertafter: "# default value."
22+
validate: sshd -t -f %s
23+
notify:
24+
- Restart sshd
25+
become: true
26+
when: ansible_facts.distribution_major_version == '8'
27+
128
- name: Template sshd configuration
229
# NB: If parameters are defined multiple times the first value wins;
330
# The default /etc/ssh/sshd_config has

0 commit comments

Comments
 (0)