blob: d8f4c0116e69fcd7c067e562354f1dec38bf2e6d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
---
- name: Disable PasswordAuthentication
tags:
- ssh
block:
- name: Disable PasswordAuthentication in sshd config
ansible.builtin.lineinfile:
path: /etc/ssh/sshd_config
regexp: "^[#]?\\s?PasswordAuthentication"
line: "PasswordAuthentication no"
register: disable_passwds
- name: Restart service sshd
when: disable_passwds.changed
ansible.builtin.service:
name: sshd
state: restarted
|