---
- name: Configure RHEL 9 dnf vars
  hosts: rhel9
  strategy: free
  tasks:

    - name: Install releasevermajor
      ansible.builtin.copy:
        content: '9'
        dest: /etc/dnf/vars/releasevermajor
        mode: '0644'
        owner: root
        group: root
      become: true

    - name: Install releaseverminor
      ansible.builtin.copy:
        content: '8'
        dest: /etc/dnf/vars/releaseverminor
        mode: '0644'
        owner: root
        group: root
      become: true

    - name: Install reporoot
      ansible.builtin.copy:
        content: 'nightly'
        dest: /etc/dnf/vars/reporoot
        mode: '0644'
        owner: root
        group: root
      become: true

- name: Install RHEL 10 dnf vars
  hosts: rhel10
  strategy: free
  tasks:

    - name: Install releasevermajor
      ansible.builtin.copy:
        content: '10'
        dest: /etc/dnf/vars/releasevermajor
        mode: '0644'
        owner: root
        group: root
      become: true

    - name: Install releaseverminor
      ansible.builtin.copy:
        content: '2'
        dest: /etc/dnf/vars/releaseverminor
        mode: '0644'
        owner: root
        group: root
      become: true

    - name: Install reporoot
      ansible.builtin.copy:
        content: 'nightly'
        dest: /etc/dnf/vars/reporoot
        mode: '0644'
        owner: root
        group: root
      become: true

- name: Install download.devel.redhat.com repos
  hosts: 'rhel9:rhel10'
  strategy: free
  tasks:

    - name: Install download.devel.redhat.com.repo
      ansible.builtin.copy:
        content: |
          [appstream]
          name=appstream
          baseurl=https://download.devel.redhat.com/rhel-$releasevermajor/$reporoot/RHEL-$releasevermajor/latest-RHEL-$releasevermajor.$releaseverminor/compose/AppStream/$arch/os
          enabled=1
          gpgcheck=0
          keepcache=0
          sslverify=0

          [baseos]
          name=baseos
          baseurl=https://download.devel.redhat.com/rhel-$releasevermajor/$reporoot/RHEL-$releasevermajor/latest-RHEL-$releasevermajor.$releaseverminor/compose/BaseOS/$arch/os
          enabled=1
          gpgcheck=0
          keepcache=0
          sslverify=0

          [crb]
          name=crb
          baseurl=https://download.devel.redhat.com/rhel-$releasevermajor/$reporoot/RHEL-$releasevermajor/latest-RHEL-$releasevermajor.$releaseverminor/compose/CRB/$arch/os
          enabled=0
          gpgcheck=0
          keepcache=0
          sslverify=0
        dest: /etc/yum.repos.d/download.devel.redhat.com.repo
        mode: '0644'
        owner: root
        group: root
      become: true

- name: Configure CentOS 9 dnf vars
  hosts: centos9
  strategy: free
  tasks:

    - name: Install dev_stream
      ansible.builtin.copy:
        content: 'stream-9'
        dest: /etc/dnf/vars/dev_stream
        mode: '0644'
        owner: root
        group: root
      become: true

- name: Configure CentOS 10 dnf vars
  hosts: centos10
  strategy: free
  tasks:

    - name: Install dev_stream
      ansible.builtin.copy:
        content: 'stream-10'
        dest: /etc/dnf/vars/dev_stream
        mode: '0644'
        owner: root
        group: root
      become: true

- name: Install composes.stream.centos.org repos
  hosts: 'centos9:centos10'
  strategy: free
  tasks:

    - name: Install composes.stream.centos.org.repo
      ansible.builtin.copy:
        content: |
          [dev-appstream]
          name=dev-appstream
          baseurl=https://composes.stream.centos.org/$dev_stream/development/latest-CentOS-Stream/compose/AppStream/x86_64/os/
          enabled=1
          gpgcheck=0
          sslverify=0

          [dev-baseos]
          name=dev-baseos
          baseurl=https://composes.stream.centos.org/$dev_stream/development/latest-CentOS-Stream/compose/BaseOS/x86_64/os/
          enabled=1
          gpgcheck=0
          sslverify=0

          [dev-crb]
          name=dev-crb
          baseurl=https://composes.stream.centos.org/$dev_stream/development/latest-CentOS-Stream/compose/CRB/x86_64/os/
          enabled=0
          gpgcheck=0
          sslverify=0
        dest: /etc/yum.repos.d/composes.stream.centos.org.repo
        mode: '0644'
        owner: root
        group: root
      become: true
