--- - name: Ensure openssh-server is installed ansible.builtin.package: name: openssh-server state: present - name: Ensure SSH service is enabled and running ansible.builtin.service: name: ssh state: started enabled: true - name: Ensure SSH server configuration is proper ansible.builtin.template: src: templates/sshd_config.j2 dest: /etc/ssh/sshd_config owner: root group: root mode: "0644" validate: "/usr/sbin/sshd -t -f %s" notify: Restart SSH service