- name: Install wireguard for RHEL 7 when: ansible_facts['distribution_major_version'] == '7' block: - name: Install repos yum: name: - elrepo-release - epel-release state: present - name: Install wireguard packages yum: name: - yum-plugin-elrepo state: present - name: Install wireguard packages yum: name: - kmod-wireguard - wireguard-tools state: present - name: Install wireguard for RHEL 8 when: ansible_facts['distribution_major_version'] == '8' block: - name: Install repos dnf: name: - elrepo-release - epel-release state: present - name: Install wireguard packages dnf: name: - kmod-wireguard - wireguard-tools state: present - name: Install wireguard for RHEL 9 when: ansible_facts['distribution_major_version'] == '9' block: - name: Install wireguard packages dnf: name: - wireguard-tools state: present - name: Enable wg-quick systemd unit systemd: name: wg-quick@{{ wireguard_ui_combined_env['WGUI_CONFIG_FILE_PATH'] | basename | split('.') | first }} enabled: yes daemon_reload: yes