- name: Install ssh packages action: ${ansible_pkg_mgr} pkg=${item} state=installed update_cache=yes with_items: - openssh-server - openssh-client when_boolean: ${with_ssh} - name: Install sshd configuration action: template src=ssh/sshd_config.j2 dest=/etc/ssh/sshd_config owner=root group=root mode=0644 notify: - Restart ssh when_boolean: ${with_ssh} - name: Ensure ssh is running action: service name=ssh state=started when_boolean: ${with_ssh}