homelab/ansible/books/tasks/users.yml
2025-06-03 23:07:46 +02:00

16 lines
502 B
YAML

- name: Disable PasswordAuthentication in sshd_config
ansible.builtin.lineinfile:
path: /etc/ssh/sshd_config
regexp: "^PasswordAuthentication"
line: "PasswordAuthentication no"
- name: Disable KbdInteractiveAuthentication in sshd_config
ansible.builtin.lineinfile:
path: /etc/ssh/sshd_config
regexp: "^KbdInteractiveAuthentication"
line: "KbdInteractiveAuthentication no"
- name: Restart sshd to apply changes
ansible.builtin.service:
name: ssh
state: restarted