diff --git a/ansible/group_vars/all.yml b/ansible/group_vars/all.yml index 72237f4373..fdab540e84 100644 --- a/ansible/group_vars/all.yml +++ b/ansible/group_vars/all.yml @@ -72,9 +72,9 @@ virtual_machines: rhcos: project: rhcos-cloud images: - - "{{ lookup('ansible.builtin.pipe', 'scripts/fetch_ocp_rhcos_bootimage.sh 4.19') }}" + - "{{ lookup('ansible.builtin.pipe', 'scripts/fetch_ocp_rhcos_bootimage.sh 4.22 x86_64.images.gcp.name rhel-10') }}" + - "{{ lookup('ansible.builtin.pipe', 'scripts/fetch_ocp_rhcos_bootimage.sh 4.22 x86_64.images.gcp.name rhel-9') }}" - "{{ lookup('ansible.builtin.pipe', 'scripts/fetch_ocp_rhcos_bootimage.sh 4.18') }}" - - "{{ lookup('ansible.builtin.pipe', 'scripts/fetch_ocp_rhcos_bootimage.sh 4.16') }}" - "{{ lookup('ansible.builtin.pipe', 'scripts/fetch_ocp_rhcos_bootimage.sh 4.14') }}" - "{{ lookup('ansible.builtin.pipe', 'scripts/fetch_ocp_rhcos_bootimage.sh 4.12') }}" username: core @@ -93,9 +93,9 @@ virtual_machines: arch: arm64 machine_type: t2a-standard-2 images: - - "{{ lookup('ansible.builtin.pipe', 'scripts/fetch_ocp_rhcos_bootimage.sh 4.19 aarch64.images.gcp.name') }}" + - "{{ lookup('ansible.builtin.pipe', 'scripts/fetch_ocp_rhcos_bootimage.sh 4.22 aarch64.images.gcp.name rhel-10') }}" + - "{{ lookup('ansible.builtin.pipe', 'scripts/fetch_ocp_rhcos_bootimage.sh 4.22 aarch64.images.gcp.name rhel-9') }}" - "{{ lookup('ansible.builtin.pipe', 'scripts/fetch_ocp_rhcos_bootimage.sh 4.18 aarch64.images.gcp.name') }}" - - "{{ lookup('ansible.builtin.pipe', 'scripts/fetch_ocp_rhcos_bootimage.sh 4.16 aarch64.images.gcp.name') }}" username: core ignition: ignition: diff --git a/ansible/scripts/fetch_ocp_rhcos_bootimage.sh b/ansible/scripts/fetch_ocp_rhcos_bootimage.sh index d90f57e016..e8034a4fb6 100755 --- a/ansible/scripts/fetch_ocp_rhcos_bootimage.sh +++ b/ansible/scripts/fetch_ocp_rhcos_bootimage.sh @@ -1,7 +1,7 @@ #!/bin/bash if [ -z "$1" ]; then - echo "Usage: $0 []" + echo "Usage: $0 [] []" exit 1 fi @@ -10,7 +10,15 @@ OCP_VERSION=$1 # Json path with architecture and image name, e.g., x86_64.images.gcp.name or s390x.artifacts.ibmcloud.release JSONPATH=${2:-"x86_64.images.gcp.name"} -URL="https://raw.githubusercontent.com/openshift/installer/release-${OCP_VERSION}/data/data/coreos/rhcos.json" +# Optional RHEL variant (e.g., rhel-9, rhel-10) for OCP 4.22+ which splits +# RHCOS images into separate coreos-rhel-9.json and coreos-rhel-10.json files. +RHEL_VARIANT=${3:-""} + +if [ -n "$RHEL_VARIANT" ]; then + URL="https://raw.githubusercontent.com/openshift/installer/release-${OCP_VERSION}/data/data/coreos/coreos-${RHEL_VARIANT}.json" +else + URL="https://raw.githubusercontent.com/openshift/installer/release-${OCP_VERSION}/data/data/coreos/rhcos.json" +fi json_data=$(curl --retry 5 --retry-delay 2 -sS "$URL") if [ -z "$json_data" ]; then