From 40729933a102406f24511d243b5bb727eb84a8b4 Mon Sep 17 00:00:00 2001 From: h4xhor Date: Wed, 1 Nov 2023 15:16:18 +0800 Subject: [PATCH] AUSTA-278: Group step "Perform Deploy ESXi Drivers to a Drop Directory with Windows Worker" is now a deploy followed by a move. (#20) Co-authored-by: Default User --- ...l-Machine-on-ESXi-with-Windows-Worker.html | 80 +++++++++---------- ...-a-Drop-Directory-with-Windows-Worker.html | 73 +++++++++++++++-- .../README.md | 1 - .../README.md | 1 + .../metadata.json | 6 +- .../metadata.json | 16 ++++ .../script.txt | 5 ++ .../metadata.json | 6 +- 8 files changed, 136 insertions(+), 52 deletions(-) delete mode 100644 steps/deployesxidriverstoadropdirectorywithwindowsworker/README.md create mode 100644 steps/deployesxidriverswithwindowsworker/README.md rename steps/{deployesxidriverstoadropdirectorywithwindowsworker => deployesxidriverswithwindowsworker}/metadata.json (61%) create mode 100644 steps/moveesxidriverstodropdirectorywithwindowsworker/metadata.json create mode 100644 steps/moveesxidriverstodropdirectorywithwindowsworker/script.txt diff --git a/docs/Build-Virtual-Machine-on-ESXi-with-Windows-Worker.html b/docs/Build-Virtual-Machine-on-ESXi-with-Windows-Worker.html index 3c4ecc9..636557c 100644 --- a/docs/Build-Virtual-Machine-on-ESXi-with-Windows-Worker.html +++ b/docs/Build-Virtual-Machine-on-ESXi-with-Windows-Worker.html @@ -1037,46 +1037,46 @@

                 
-if ${{virtualMachineBootLoaderIsBios}}
-then
-
-  $ErrorActionPreference = "Stop"
-  Import-Module VMware.VimAutomation.Core
-
-  Connect-VIServer {vmwareVcenterNode.ip} `
-      -User {vmwareVcenterUser.user} `
-      -Password {vmwareVcenterUser.password}
-
-  if ($? -eq $false) {
-      Write-Host "Error: Not connected."
-      exit 1
-  }
-
-  $vm = Get-VM -Name "{newVmNode.fqn}"
-
-  # the device name of the hard disk to which to boot
-  $strBootHDiskDeviceName = "Hard disk 1"
-
-  # get the VirtualDisk device, then grab its Key (DeviceKey, used later)
-  $intHDiskDeviceKey = ($vm.ExtensionData.Config.Hardware.Device | ?{$_.DeviceInfo.Label -eq $strBootHDiskDeviceName}).Key
-
-  # bootable Disk BootOption device, for use in setting BootOrder (the corresponding VirtualDisk device is bootable, assumed)
-  $oBootableHDisk = New-Object -TypeName VMware.Vim.VirtualMachineBootOptionsBootableDiskDevice -Property @{"DeviceKey" = $intHDiskDeviceKey}
-
-  # bootable CDROM device (per the docs, the first CDROM with bootable media found is used)
-  $oBootableCDRom = New-Object -Type VMware.Vim.VirtualMachineBootOptionsBootableCdromDevice
-
-  $spec = New-Object VMware.Vim.VirtualMachineConfigSpec -Property @{
-      "BootOptions" = New-Object VMware.Vim.VirtualMachineBootOptions -Property @{
-          BootOrder = $oBootableHDisk, $oBootableCDRom
-      } # end new-object
-  } # end new-object
-
-  # reconfig the VM to use the spec with the new BootOrder
-  $vm.ExtensionData.ReconfigVM_Task($spec)
-
-else
-    echo "Skipping for UEFI boot."
+if ${{virtualMachineBootLoaderIsBios}}
+then
+
+  $ErrorActionPreference = "Stop"
+  Import-Module VMware.VimAutomation.Core
+
+  Connect-VIServer {vmwareVcenterNode.ip} `
+      -User {vmwareVcenterUser.user} `
+      -Password {vmwareVcenterUser.password}
+
+  if ($? -eq $false) {
+      Write-Host "Error: Not connected."
+      exit 1
+  }
+
+  $vm = Get-VM -Name "{newVmNode.fqn}"
+
+  # the device name of the hard disk to which to boot
+  $strBootHDiskDeviceName = "Hard disk 1"
+
+  # get the VirtualDisk device, then grab its Key (DeviceKey, used later)
+  $intHDiskDeviceKey = ($vm.ExtensionData.Config.Hardware.Device | ?{$_.DeviceInfo.Label -eq $strBootHDiskDeviceName}).Key
+
+  # bootable Disk BootOption device, for use in setting BootOrder (the corresponding VirtualDisk device is bootable, assumed)
+  $oBootableHDisk = New-Object -TypeName VMware.Vim.VirtualMachineBootOptionsBootableDiskDevice -Property @{"DeviceKey" = $intHDiskDeviceKey}
+
+  # bootable CDROM device (per the docs, the first CDROM with bootable media found is used)
+  $oBootableCDRom = New-Object -Type VMware.Vim.VirtualMachineBootOptionsBootableCdromDevice
+
+  $spec = New-Object VMware.Vim.VirtualMachineConfigSpec -Property @{
+      "BootOptions" = New-Object VMware.Vim.VirtualMachineBootOptions -Property @{
+          BootOrder = $oBootableHDisk, $oBootableCDRom
+      } # end new-object
+  } # end new-object
+
+  # reconfig the VM to use the spec with the new BootOrder
+  $vm.ExtensionData.ReconfigVM_Task($spec)
+
+else
+    echo "Skipping for UEFI boot."
 fi
                 
             
diff --git a/docs/Perform-Deploy-ESXi-Drivers-to-a-Drop-Directory-with-Windows-Worker.html b/docs/Perform-Deploy-ESXi-Drivers-to-a-Drop-Directory-with-Windows-Worker.html index b70b98b..59ad1d2 100644 --- a/docs/Perform-Deploy-ESXi-Drivers-to-a-Drop-Directory-with-Windows-Worker.html +++ b/docs/Perform-Deploy-ESXi-Drivers-to-a-Drop-Directory-with-Windows-Worker.html @@ -206,8 +206,16 @@

- - Step 1 - Deploy ESXi Drivers to a Drop Directory with Windows Worker + + Step 1 - Deploy ESXi Drivers with Windows Worker + +

+ + + +

+ + Step 2 - Move ESXi Drivers to Drop Directory with Windows Worker

@@ -301,9 +309,9 @@
@@ -311,7 +319,7 @@

-

Deploys ESXi drivers to the drivers drop in directory at {automationWorkerWindowsBaseDirectory}/drivers-{newVmNode.fqn}.

+

Deploys ESXi drivers to /c$/software/drivers-{newVmNode.fqn}.

@@ -363,7 +371,7 @@

-{automationWorkerWindowsBaseDirectory}/drivers-{newVmNode.fqn}, relative to the home directory +/c$/software/drivers-{newVmNode.fqn}
@@ -371,6 +379,57 @@

+ + + + + + + + + + + + + + + + + + + + + + +
+

+ Execute the following script: +

+
+
+
+
+                
+$CURRENT_PATH = "C:\software\drivers-{newVmNode.fqn}"
+$DEST_FOLDER = "{automationWorkerWindowsBaseDirectory}"
+
+Write-Host "CURRENT_PATH=${CURRENT_PATH}\n DEST_FOLDER=${DEST_FOLDER}"
+Move-Item -Path "${CURRENT_PATH}" -Destination "${DEST_FOLDER}"
+                
+            
+
+
+ + + + +
diff --git a/steps/deployesxidriverstoadropdirectorywithwindowsworker/README.md b/steps/deployesxidriverstoadropdirectorywithwindowsworker/README.md deleted file mode 100644 index c55907e..0000000 --- a/steps/deployesxidriverstoadropdirectorywithwindowsworker/README.md +++ /dev/null @@ -1 +0,0 @@ -Deploys ESXi drivers to the drivers drop in directory at `{automationWorkerWindowsBaseDirectory}/drivers-{newVmNode.fqn}`. \ No newline at end of file diff --git a/steps/deployesxidriverswithwindowsworker/README.md b/steps/deployesxidriverswithwindowsworker/README.md new file mode 100644 index 0000000..9ae1758 --- /dev/null +++ b/steps/deployesxidriverswithwindowsworker/README.md @@ -0,0 +1 @@ +Deploys ESXi drivers to `/c$/software/drivers-{newVmNode.fqn}`. \ No newline at end of file diff --git a/steps/deployesxidriverstoadropdirectorywithwindowsworker/metadata.json b/steps/deployesxidriverswithwindowsworker/metadata.json similarity index 61% rename from steps/deployesxidriverstoadropdirectorywithwindowsworker/metadata.json rename to steps/deployesxidriverswithwindowsworker/metadata.json index 9eef358..88023dd 100644 --- a/steps/deployesxidriverstoadropdirectorywithwindowsworker/metadata.json +++ b/steps/deployesxidriverswithwindowsworker/metadata.json @@ -1,11 +1,11 @@ { "actionOnStepFail": null, "archiveKey": "winvmwaredrivers", - "deployPath": "{automationWorkerWindowsBaseDirectory}/drivers-{newVmNode.fqn}", + "deployPath": "/c$/software/drivers-{newVmNode.fqn}", "enabled": true, "externalUuid4": "1b89296f-232a-4c2a-986d-910e960d86d6", - "key": "deployesxidriverstoadropdirectorywithwindowsworker", - "name": "Deploy ESXi Drivers to a Drop Directory with Windows Worker", + "key": "deployesxidriverswithwindowsworker", + "name": "Deploy ESXi Drivers with Windows Worker", "osCredKey": "automationworkerwindowsuseradministrator", "serverKey": "automationworkerwindowsnode", "type": "com.servertribe.attune.tuples.StepPushDesignFileTuple", diff --git a/steps/moveesxidriverstodropdirectorywithwindowsworker/metadata.json b/steps/moveesxidriverstodropdirectorywithwindowsworker/metadata.json new file mode 100644 index 0000000..f0855a8 --- /dev/null +++ b/steps/moveesxidriverstodropdirectorywithwindowsworker/metadata.json @@ -0,0 +1,16 @@ +{ + "actionOnStepFail": null, + "enabled": true, + "externalUuid4": "a0a9e831-ce56-49fe-9e64-0e00876c4256", + "interpreter": 2, + "interpreterCommand": "", + "interpreterScriptExt": null, + "interpreterScriptSyntax": "", + "key": "moveesxidriverstodropdirectorywithwindowsworker", + "name": "Move ESXi Drivers to Drop Directory with Windows Worker", + "osCredKey": "automationworkerwindowsuseradministrator", + "serverKey": "automationworkerwindowsnode", + "successExitCode": 0, + "timeout": 120, + "type": "com.servertribe.attune.tuples.StepWinRmTuple" +} \ No newline at end of file diff --git a/steps/moveesxidriverstodropdirectorywithwindowsworker/script.txt b/steps/moveesxidriverstodropdirectorywithwindowsworker/script.txt new file mode 100644 index 0000000..06557d5 --- /dev/null +++ b/steps/moveesxidriverstodropdirectorywithwindowsworker/script.txt @@ -0,0 +1,5 @@ +$CURRENT_PATH = "C:\software\drivers-{newVmNode.fqn}" +$DEST_FOLDER = "{automationWorkerWindowsBaseDirectory}" + +Write-Host "CURRENT_PATH=${CURRENT_PATH}\n DEST_FOLDER=${DEST_FOLDER}" +Move-Item -Path "${CURRENT_PATH}" -Destination "${DEST_FOLDER}" \ No newline at end of file diff --git a/steps/performdeployesxidriverstoadropdirectorywithwindowsworker/metadata.json b/steps/performdeployesxidriverstoadropdirectorywithwindowsworker/metadata.json index 1999e32..d65b70e 100644 --- a/steps/performdeployesxidriverstoadropdirectorywithwindowsworker/metadata.json +++ b/steps/performdeployesxidriverstoadropdirectorywithwindowsworker/metadata.json @@ -8,7 +8,11 @@ "links": [ { "order": 0, - "stepKey": "deployesxidriverstoadropdirectorywithwindowsworker" + "stepKey": "deployesxidriverswithwindowsworker" + }, + { + "order": 50, + "stepKey": "moveesxidriverstodropdirectorywithwindowsworker" } ], "name": "Perform Deploy ESXi Drivers to a Drop Directory with Windows Worker",