aboutsummaryrefslogtreecommitdiff
path: root/tasks/main.yml
blob: 4137d8ce88d5263ed55cd75d1dd47d69a7792ba0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
---
- name: Disable PasswordAuthentication
  lineinfile:
    path: /etc/ssh/sshd_config
    regexp: "^[#]?\\s?PasswordAuthentication"
    line: "PasswordAuthentication no"
  tags:
    - ssh
  register: disable_passwds

- name: Restart service sshd
  when: disable_passwds.changed
    ansible.builtin.service:
      name: sshd
      state: restarted