- 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
