File tree 4 files changed +28
-18
lines changed
4 files changed +28
-18
lines changed Original file line number Diff line number Diff line change 23
23
gather_facts : true
24
24
vars :
25
25
distro : " {{ansible_distribution}}"
26
- tasks :
27
- - when : ansible_virtualization_type != "docker"
28
- meta : end_play
29
26
27
+ pre_tasks :
28
+ - meta : end_play
29
+ when :
30
+ - ansible_facts.virtualization_type != "docker"
31
+
32
+ roles :
33
+ - role : sshd
34
+
35
+ tasks :
30
36
- name : Ensure requisite apt packages are installed
31
37
apt :
32
38
name : " {{ common_packages + packages }}"
134
140
content : |
135
141
i-am-mitogen-test-docker-image
136
142
137
- - copy :
138
- dest : /etc/ssh/banner.txt
139
- src : ../data/docker/ssh_login_banner.txt
140
-
141
143
- name : Ensure /etc/sudoers.d exists
142
144
file :
143
145
state : directory
169
171
line : " %wheel ALL=(ALL) ALL"
170
172
when : ansible_os_family == 'RedHat'
171
173
172
- - name : Enable SSH banner
173
- lineinfile :
174
- path : /etc/ssh/sshd_config
175
- line : Banner /etc/ssh/banner.txt
176
-
177
- - name : Allow remote SSH root login
178
- lineinfile :
179
- path : /etc/ssh/sshd_config
180
- line : PermitRootLogin yes
181
- regexp : ' .*PermitRootLogin.*'
182
-
183
174
- name : Allow remote SSH root login
184
175
lineinfile :
185
176
path : /etc/pam.d/sshd
Original file line number Diff line number Diff line change
1
+ sshd_config_file : /etc/ssh/sshd_config
File renamed without changes.
Original file line number Diff line number Diff line change
1
+ - name : Create login banner
2
+ copy :
3
+ src : banner.txt
4
+ dest : /etc/ssh/banner.txt
5
+ mode : u=rw,go=r
6
+
7
+ - name : Configure sshd_config
8
+ lineinfile :
9
+ path : " {{ sshd_config_file }}"
10
+ line : " {{ item.line }}"
11
+ regexp : " {{ item.regexp }}"
12
+ loop :
13
+ - line : Banner /etc/ssh/banner.txt
14
+ regexp : ' ^#? *Banner.*'
15
+ - line : PermitRootLogin yes
16
+ regexp : ' .*PermitRootLogin.*'
17
+ loop_control :
18
+ label : " {{ item.line }}"
You can’t perform that action at this time.
0 commit comments