--- - name: Set default family of packages for SSH ansible.builtin.set_fact: ssh_packages: [openssh, openssh-clients, openssh-server] - name: Set family of packages for SSH on Debian-based OSs ansible.builtin.set_fact: ssh_packages: [openssh-client, openssh-server] when: ansible_distribution in [ "Debian", "Ubuntu" ] - name: Set family of packages for SSH on archLinux ansible.builtin.set_fact: ssh_packages: [openssh] when: ansible_distribution == "Archlinux" - name: Install the SSH family ansible.builtin.package: name: "{{ ssh_packages }}" state: present