aboutsummaryrefslogblamecommitdiff
path: root/roles/sshd/tasks/main.yml
blob: c4dd9eaccfaee7001f2f0c1d92ae8232f411a2ad (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13












                                                                                    
---
- name: Configure sshd
  become: True
  lineinfile:
    dest: "/etc/ssh/sshd_config"
    regexp: "{{ item.regex }}"
    line: "{{ item.line }}"
  notify: Restart sshd
  loop:
    - { regex: '^(#\s*)?PermitEmptyPasswords'  , line: 'PermitEmptyPasswords no' }
    - { regex: '^(#\s*)?PermitRootLogin'       , line: 'PermitRootLogin no' }
    - { regex: '^(#\s*)?PasswordAuthentication', line: 'PasswordAuthentication no' }
    - { regex: '^(#\s*)?UsePAM'                , line: 'UsePAM yes' }