- hosts: all
  name: packstack-centos9-pre
  tasks:
    - name: Ensure legacy workspace directory
      file:
        path: '{{ ansible_user_dir }}/workspace'
        state: directory

    - shell:
        cmd: |
          cp -pr {{ ansible_user_dir }}/src/opendev.org/x/packstack {{ ansible_user_dir }}/workspace

    - shell:
        cmd: |
          set -e
          set -x
          rm -rf /etc/yum.repos.d/delorean*
          # Remove epel repos
          rm -rf /etc/yum.repos.d/epel*
          dnf clean all
          sudo sed -i '/^exclude.*/d' /etc/dnf/dnf.conf
          dnf -y install dnf-plugins-core
          dnf config-manager --set-enabled crb
          dnf -y install libxml2-devel libxslt-devel ruby-devel zlib-devel
          dnf -y install gcc gettext diffstat doxygen patch patchutils subversion systemtap git python3-setuptools wget python3-libselinux virt-what yum
        executable: /bin/bash
        chdir: '{{ ansible_user_dir }}/workspace'
      become: true
      environment: '{{ zuul }}'

    # mariadb-10.11 is broken https://issues.redhat.com/browse/RDO-241
    - name: Temporary disable mariadb module
      shell: "sudo dnf module disable -y mariadb"
      when: ansible_distribution == "CentOS" and ansible_distribution_major_version == "9"
      become: true
      changed_when: False
