- name: Disable SSH password auth lineinfile: dest: /etc/ssh/sshd_config regexp: "^#PasswordAuthentication yes" line: "PasswordAuthentication no" notify: Restart sshd - name: Change SSH port lineinfile: dest: /etc/ssh/sshd_config regexp: "^#Port 22" line: "Port {{ sshd_port }}" notify: Restart sshd