File tree Expand file tree Collapse file tree 4 files changed +28
-18
lines changed
Expand file tree Collapse file tree 4 files changed +28
-18
lines changed Original file line number Diff line number Diff line change 2323 gather_facts : true
2424 vars :
2525 distro : " {{ansible_distribution}}"
26- tasks :
27- - when : ansible_virtualization_type != "docker"
28- meta : end_play
2926
27+ pre_tasks :
28+ - meta : end_play
29+ when :
30+ - ansible_facts.virtualization_type != "docker"
31+
32+ roles :
33+ - role : sshd
34+
35+ tasks :
3036 - name : Ensure requisite apt packages are installed
3137 apt :
3238 name : " {{ common_packages + packages }}"
134140 content : |
135141 i-am-mitogen-test-docker-image
136142
137- - copy :
138- dest : /etc/ssh/banner.txt
139- src : ../data/docker/ssh_login_banner.txt
140-
141143 - name : Ensure /etc/sudoers.d exists
142144 file :
143145 state : directory
169171 line : " %wheel ALL=(ALL) ALL"
170172 when : ansible_os_family == 'RedHat'
171173
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-
183174 - name : Allow remote SSH root login
184175 lineinfile :
185176 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