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

    - shell:
        cmd: |
          cp -pr /home/zuul/src/git.openstack.org/openstack/packstack {{ ansible_user_dir }}/workspace

    - shell:
        cmd: |
          set -e
          set -x
          dnf -y install wget
          rm -rf /etc/yum.repos.d/fedora*
          wget -O /etc/yum.repos.d/fedora-stable.repo http://trunk.rdoproject.org/fedora/delorean-deps.repo
          dnf clean all
          sudo sed -i '/^exclude.*/d' /etc/dnf/dnf.conf
          dnf -y install libxml2-devel libxslt-devel ruby-devel zlib-devel
          dnf -y install gcc gettext diffstat doxygen patch patchutils subversion systemtap git python-setuptools wget redhat-lsb-core libselinux-python yum-plugin-priorities dnf-yum
          pip uninstall requests -y || true
        executable: /bin/bash
        chdir: '{{ ansible_user_dir }}/workspace'
      become: true
      environment: '{{ zuul }}'

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

    - shell:
        cmd: |
          cp -pr /home/zuul/src/git.openstack.org/openstack/packstack {{ ansible_user_dir }}/workspace

    - shell:
        cmd: |
          set -e
          set -x
          dnf -y install wget
          rm -rf /etc/yum.repos.d/fedora*
          wget -O /etc/yum.repos.d/fedora-stable.repo http://trunk.rdoproject.org/fedora/delorean-deps.repo
          dnf clean all
          sudo sed -i '/^exclude.*/d' /etc/dnf/dnf.conf
          dnf -y install libxml2-devel libxslt-devel ruby-devel zlib-devel
          dnf -y install gcc gettext diffstat doxygen patch patchutils subversion systemtap git python-setuptools wget redhat-lsb-core libselinux-python yum-plugin-priorities dnf-yum virt-what
          pip uninstall requests -y || true
        executable: /bin/bash
        chdir: '{{ ansible_user_dir }}/workspace'
      become: true
      environment: '{{ zuul }}'

Fix virtualization detection for Fedora jobs
Fix virtualization detection for Fedora jobs

Previously, the facter detection for virtual machines could fail
to detect an OpenStack VM as such, creating issues in CI jobs because
we selected KVM virtualization instead of QEMU.

This can be fixed by adding the virt-what binary, which is used by
facter to detect if a machine is virtual or not [1].

[1] - https://github.com/puppetlabs/facter/blob/2aa2d1cd6487f73fb8e311cf027dcf30c2166e28/lib/src/facts/linux/virtualization_resolver.cc#L62-L64

Change-Id: I9278887bfdbca209e7f3498273b85edd8efd987f
