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

                      

                             







                                                                                    
                                                                     
---
- name: Configure sshd
  become: true
  ansible.builtin.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' }