VMware vSphere

 View Only

Issues with knife-vsphere job after patching ESXi and VCSA

  • 1.  Issues with knife-vsphere job after patching ESXi and VCSA

    Posted Aug 25, 2021 04:14 PM

    For months, I have been using knife-vsphere within a Jenkins job to patch my templates in vSphere 6.7. After manually patching my ESXi and VCSA last month, I have had an issue where when using knife-vsphere a cloned VM from template results in the NIC being in a disconnected state. I am unable to reproduce this when done manually within vSphere.

    Essentially the process of patching is as follows: clone VM from template -> rename original template -> power on and patch the cloned VM -> power off and convert the new VM to template -> delete the original template

    It is during the "power on and patch the cloned VM" process that I have discovered that the NIC is not in a connected state, despite the setting "connect at power on". This was working previously to my patching. The following is my code for clone and power on:

    knife vsphere vm clone "$VMNAME" --template "[OLD]$VMTEMPLATE" -f "$TMPLFOLDER" --dest-folder "$TMPLFOLDER" --vsdc "$VSDC" $VSVM_OPTS $VSVM_COPTS
    knife vsphere vm state "$VMNAME" --state on --vsdc "$VSDC" $VSVM_OPTS

    I have tried reinstalling VMT, NIC, and even editing the script with a specific command to change the NIC state to up (knife vsphere vm net up "$VMNAME" --vsdc "$VSDC" $VSVM_OPTS), but all have resulted in the same NIC disconnected state.

    Anyone familiar with knife-vsphere and/or  may have run into this issue?