Attempting to build an image for a VKS Windows worker node using version 1.34.2 with image builder returns a fatal vsphere-iso.vsphere error
search cancel

Attempting to build an image for a VKS Windows worker node using version 1.34.2 with image builder returns a fatal vsphere-iso.vsphere error

book

Article ID: 442476

calendar_today

Updated On:

Products

VMware vSphere Kubernetes Service

Issue/Introduction

When attempting to build an image using image builder for a VKS Windows worker node using version 1.34.2, an error message similar to the following is received:

vsphere-iso.vsphere: TASK [systemprep : Install Windows updates based on KB numbers] ****************
    vsphere-iso.vsphere: fatal: [default]: FAILED! => {"msg": "The conditional check 'windows_updates_kbs_numbers|length > 0' failed. The error was: Invalid conditional detected: module 'ast' has no attribute 'Str'\n\nThe error appears to be in '/image-builder/images/capi/ansible/windows/roles/systemprep/tasks/main.yml': line 72, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n# will skip this task.\n- name: Install Windows updates based on KB numbers\n ^ here\n"}

vsphere-iso.vsphere:
    vsphere-iso.vsphere: PLAY RECAP *********************************************************************
    vsphere-iso.vsphere: default : ok=14 changed=12 unreachable=0 failed=1 skipped=1 rescued=0 ignored=0
    vsphere-iso.vsphere:
==> vsphere-iso.vsphere: Error executing Ansible: Non-zero exit status: exit status 2
==> vsphere-iso.vsphere: Step "StepProvision" failed
==> vsphere-iso.vsphere: Provisioning step had errors: Running the cleanup provisioner, if present...
==> vsphere-iso.vsphere: Clearing boot order...
==> vsphere-iso.vsphere: Powering off virtual machine...
==> vsphere-iso.vsphere: Deleting floppy image...
==> vsphere-iso.vsphere: Destroying VM...
==> vsphere-iso.vsphere: Closing sessions...

Environment

vSphere Supervisor 9.x

Cause

The python version in use on the system creating the image is incompatible with the Ansible version that is being used with the creation of the image.

The recent release of Python 3.14 package in the photon-updates repository has caused this new version to be installed in the builder container image.


Resolution

The Python version needs to be pinned to 3.11 in the builder docker container image to overcome this issue.

 

  • In order to resolve this issue, the container image will need to be built with specific python packages as detailed below:
    • Edit the Dockerfile file to replace the line that reads "RUN tdnf -y --enablerepo=photon install openssh-clients-9.3p2-17.ph5" with the following content:
      • RUN tdnf -y install python3-3.11.15-1.1.ph5 python3-pip-24.3.1-5.ph5 --enablerepo=photon --disablerepo=photon-updates
    • Edit the Dockerfile file to update line that states
      • "RUN for package in unzip git wget build-essential python3-pip jq coreutils xorriso grep ; do tdnf -y install "$package" --refresh; done"
    • to be
      • "RUN for package in openssh-clients unzip git wget build-essential jq coreutils xorriso grep ; do tdnf -y install "$package" --refresh; done"