--- - name: Set default packages for wireguard ansible.builtin.set_fact: wg_packages: - wireguard-tools - name: Set packages for wireguard on Debian-based OSs ansible.builtin.set_fact: wg_packages: - wireguard when: ansible_distribution in [ "Debian", "Ubuntu" ] - name: Set packages for wireguard on archLinux ansible.builtin.set_fact: wg_packages: - wireguard - systemd-resolveconf when: ansible_distribution == "Archlinux" - name: Install wireguard and dependencies ansible.builtin.package: name: "{{ wg_packages }}" state: present