summaryrefslogtreecommitdiff
path: root/admin/sshd_config.yaml
blob: b610be152f658f16d3f838df0fc2c7b28fc27e3c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
---
- hosts: all
  gather_facts: false
  tasks:
    - name: ensure SSH login with password is disabled
      lineinfile:
        dest: /etc/ssh/sshd_config
        regexp: "^#?PasswordAuthentication"
        line: PasswordAuthentication no
        state: present
      become: yes
      notify:
      - restart ssh

    - name: Set authorized key taken from file
      ansible.posix.authorized_key:
        user: "{{ ansible_ssh_user }}"
        state: present
        key: "{{ lookup('file', item) }}"
      with_items:
        - keys/bbrown.pub
        - keys/bclough.pub
        - keys/dbotting.pub
        - keys/gperkins.pub
        - keys/palvarez.pub

  handlers:
    - name: restart ssh
      service:
        name: ssh
        state: restarted
      become: yes