---
- name: Calico | Add wireguard yum repo
  when:
    - calico_wireguard_enabled
  block:

    - name: Calico | Add wireguard yum repo
      yum_repository:
        name: copr:copr.fedorainfracloud.org:jdoss:wireguard
        file: _copr:copr.fedorainfracloud.org:jdoss:wireguard
        description: Copr repo for wireguard owned by jdoss
        baseurl: "{{ calico_wireguard_repo }}"
        gpgcheck: yes
        gpgkey: https://download.copr.fedorainfracloud.org/results/jdoss/wireguard/pubkey.gpg
        skip_if_unavailable: yes
        enabled: yes
        repo_gpgcheck: no
      when:
        - ansible_os_family in ['RedHat']
        - ansible_distribution not in ['Fedora']
        - ansible_facts['distribution_major_version'] | int < 9