aboutsummaryrefslogtreecommitdiff
path: root/tasks/main.yml
blob: 8b6afb15910883070491be8d235036875ecc4f83 (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