govc

Posted by Just Do It ! 행동하지 않으면 성공도 실패도 없다 on Sunday, June 28, 2020

govc


OVA_Names=("photon-3-kube-v1.18.3-vmware.1" "photon-3-haproxy-v1.2.4-vmware.1")
TKG_VM_FOLDER="tkg"

govc folder.create "/${GOVC_DATACENTER}/vm/${TKG_VM_FOLDER}"

for OVA_NAME in ${OVA_Names[@]}; do
  govc import.spec ${OVA_NAME}.ova | jq '.Name="OVA_NAME"' | jq '.NetworkMapping[0].Network="VM Network"' > ${OVA_NAME}.json
  sed -i 's|OVA_NAME|'${OVA_NAME}'|g' ${OVA_NAME}.json
  govc import.ova -options=${OVA_NAME}.json -folder="/${GOVC_DATACENTER}/vm/${TKG_VM_FOLDER}" ${OVA_NAME}.ova

  govc snapshot.create -vm ${OVA_NAME} initial
  govc vm.markastemplate ${OVA_NAME}
done