| 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 | default(omit) }}" |
| 12 |
insertafter: "{{ item.insertafter | default(omit) }}" |
| 13 |
with_items: |
| 14 |
- line: AcceptEnv ANSIBLE_* MITOGEN_* |
| 15 |
insertafter: 'AcceptEnv.+' |
| 16 |
- line: Banner /etc/ssh/banner.txt |
| 17 |
regexp: '^#? *Banner.*' |
| 18 |
- line: MaxAuthTries {{ sshd_config__max_auth_tries }} |
| 19 |
regexp: '^#? *MaxAuthTries.*' |
| 20 |
- line: PermitRootLogin yes |
| 21 |
regexp: '.*PermitRootLogin.*' |
| 22 |
notify: |
| 23 |
- Restart sshd # Handler in platform specific role |