File tree Expand file tree Collapse file tree 1 file changed +20
-15
lines changed Expand file tree Collapse file tree 1 file changed +20
-15
lines changed Original file line number Diff line number Diff line change 1
- - name : Grab facts to determine distribution
2
- setup :
1
+ - name : Ensure drop in directory exists
2
+ file :
3
+ path : /etc/ssh/sshd_config.d/*.conf
4
+ state : directory
5
+ owner : root
6
+ group : root
7
+ mode : 700
8
+ become : true
9
+
10
+ - name : Ensure drop in directory is included
11
+ lineinfile :
12
+ dest : /etc/ssh/sshd_config
13
+ regexp : " ^Include /etc/ssh/sshd_config.d/*.conf"
14
+ line : " Include /etc/ssh/sshd_config.d/*.conf"
15
+ state : present
16
+ insertafter : EOF
17
+ validate : sshd -t -f %s
18
+ notify :
19
+ - Restart sshd
20
+ become : true
3
21
4
22
- name : Template sshd configuration
5
23
# NB: If parameters are defined multiple times the first value wins;
16
34
validate : sshd -t -f %s
17
35
notify :
18
36
- 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'
You can’t perform that action at this time.
0 commit comments