# vim: ft=yaml.ansible
---
- name: Allow SSH login with public keys
ansible.builtin.lineinfile:
path: /etc/ssh/sshd_config
regexp: '^#?PubkeyAuthentication '
line: PubkeyAuthentication yes
state: present
notify: sshd
- name: Disallow SSH login with password
regexp: '^#?PasswordAuthentication '
line: PasswordAuthentication no
- name: Disallow root login over SSH
regexp: '^#?PermitRootLogin '
line: PermitRootLogin no