--- # sshd tasks - name: install SSH packages tags: - packages - sshd apt: > state=latest name={{ item }} with_items: - openssh-blacklist-extra - ssh when: "ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu'" - name: ensure service "ssh" is enabled and started tags: - services - sshd service: > enabled=yes name=ssh state=started when: "ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu'" - name: ensure service "sshd" is enabled and started tags: - services - sshd service: > enabled=yes name=sshd state=started when: "ansible_distribution != 'Debian' and ansible_distribution != 'Ubuntu'"