- name: Update apt repository cache ansible.builtin.apt: update_cache: yes cache_valid_time: 3600 - name: Install necessary packages ansible.builtin.apt: name: - g++ - qemu-kvm - libvirt-daemon - libvirt-daemon-system - libvirt-clients - build-essential - zip - unzip state: present - name: Remove older version of Go ansible.builtin.apt: name: golang state: absent - name: Install specific Go version ansible.builtin.unarchive: src: 'https://golang.org/dl/go1.21.8.linux-amd64.tar.gz' dest: /usr/local remote_src: yes creates: '/usr/local/go/bin/go' - name: Export Go binary path globally ansible.builtin.lineinfile: path: /etc/profile line: 'export PATH=$PATH:/usr/local/go/bin' create: yes - name: Ensure the libvirtd service is started and enabled ansible.builtin.systemd: name: libvirtd state: started enabled: yes - name: Create the OpenShift images directory for libvirt ansible.builtin.file: path: /var/lib/libvirt/openshift-images state: directory owner: root group: libvirt mode: '0755' - name: Clone the OpenShift Installer repository ansible.builtin.git: repo: 'https://github.com/openshift/installer' dest: '/tmp/openshift-installer' clone: yes update: yes - name: Build the OpenShift Installer ansible.builtin.shell: cmd: /tmp/openshift-installer/hack/build.sh chdir: /tmp/openshift-installer environment: PATH: '/usr/local/go/bin:{{ ansible_env.PATH }}'