- name: Setup gitlab runner on the Jumphost hosts: jumphost become: true ignore_errors: "{{ ansible_check_mode }}" vars: {} tasks: - name: define rhel vm with specific specs community.libvirt.libvirt_domain: command: define name: gitlab-runner-vm state: running memory: 16384 vcpu: 2 disk: - size: 50G type: qcow2 path: /var/lib/libvirt/images/gitlab-runner.qcow2 networks: - name: default os_type: linux os_variant: rhel9.0 graphics: type: none - name: install rhel on the vm (ISO path should point to your rhel 9 iso) community.libvirt.libvirt_domain: command: install name: gitlab-runner-vm state: running cdrom: /path/to/rhel9.iso graphics: vnc boot_dev: cdrom - name: wait for vm to boot wait_for: timeout: 600 - name: install and configure gitlab runner, docker dependencies using virt-customize command: > virt-customize -a /var/lib/libvirt/images/gitlab-runner.qcow2 --run-command "dnf install -y dnf-plugins-core" --run-command "dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo" --run-command "dnf install -y docker-ce docker-ce-cli containerd.io" --run-command "systemctl enable --now docker" --run-command "curl -L https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.rpm.sh -o /tmp/gitlab-runner-install.sh" --run-command "chmod +x /tmp/gitlab-runner-install.sh && /tmp/gitlab-runner-install.sh" --run-command "dnf install -y gitlab-runner" --run-command "systemctl enable --now gitlab-runner" --run-command "usermod -aG docker gitlab-runner"