Skip to content

Commit

Permalink
AUSTA-278: Group step "Perform Deploy ESXi Drivers to a Drop Director…
Browse files Browse the repository at this point in the history
…y with Windows Worker" is now a deploy followed by a move. (AttuneOps#20)

Co-authored-by: Default User <default@email.com>
  • Loading branch information
h4xhor and Default User authored Nov 1, 2023
1 parent f16fcf2 commit 4072993
Show file tree
Hide file tree
Showing 8 changed files with 136 additions and 52 deletions.
80 changes: 40 additions & 40 deletions docs/Build-Virtual-Machine-on-ESXi-with-Windows-Worker.html
Original file line number Diff line number Diff line change
Expand Up @@ -1037,46 +1037,46 @@ <h3 id="setbootorderwithwindowsworker">
<div class="col px-0">
<pre>
<code class="language-sql py-0">
if ${{virtualMachineBootLoaderIsBios}}
then

$ErrorActionPreference = &quot;Stop&quot;
Import-Module VMware.VimAutomation.Core

Connect-VIServer {vmwareVcenterNode.ip} `
-User {vmwareVcenterUser.user} `
-Password {vmwareVcenterUser.password}

if ($? -eq $false) {
Write-Host &quot;Error: Not connected.&quot;
exit 1
}

$vm = Get-VM -Name &quot;{newVmNode.fqn}&quot;

# the device name of the hard disk to which to boot
$strBootHDiskDeviceName = &quot;Hard disk 1&quot;

# 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 @{&quot;DeviceKey&quot; = $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 @{
&quot;BootOptions&quot; = 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 &quot;Skipping for UEFI boot.&quot;
if ${{virtualMachineBootLoaderIsBios}}
then

$ErrorActionPreference = &quot;Stop&quot;
Import-Module VMware.VimAutomation.Core

Connect-VIServer {vmwareVcenterNode.ip} `
-User {vmwareVcenterUser.user} `
-Password {vmwareVcenterUser.password}

if ($? -eq $false) {
Write-Host &quot;Error: Not connected.&quot;
exit 1
}

$vm = Get-VM -Name &quot;{newVmNode.fqn}&quot;

# the device name of the hard disk to which to boot
$strBootHDiskDeviceName = &quot;Hard disk 1&quot;

# 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 @{&quot;DeviceKey&quot; = $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 @{
&quot;BootOptions&quot; = 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 &quot;Skipping for UEFI boot.&quot;
fi
</code>
</pre>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,16 @@ <h6 class="text-right">


<p class="text-muted pt-2">
<a href="#deployesxidriverstoadropdirectorywithwindowsworker">
<strong>Step 1 -</strong> Deploy ESXi Drivers to a Drop Directory with Windows Worker
<a href="#deployesxidriverswithwindowsworker">
<strong>Step 1 -</strong> Deploy ESXi Drivers with Windows Worker
</a>
</p>



<p class="text-muted pt-2">
<a href="#moveesxidriverstodropdirectorywithwindowsworker">
<strong>Step 2 -</strong> Move ESXi Drivers to Drop Directory with Windows Worker
</a>
</p>

Expand Down Expand Up @@ -301,17 +309,17 @@ <h6 class="text-right">


<div class="row pt-5">
<h3 id="deployesxidriverstoadropdirectorywithwindowsworker">
<a href="#deployesxidriverstoadropdirectorywithwindowsworker">
<strong>Step 1 -</strong> Deploy ESXi Drivers to a Drop Directory with Windows Worker
<h3 id="deployesxidriverswithwindowsworker">
<a href="#deployesxidriverswithwindowsworker">
<strong>Step 1 -</strong> Deploy ESXi Drivers with Windows Worker
</a>
</h3>
</div>

<div class="row">
<div class="description col px-0">
<p>
<p>Deploys ESXi drivers to the drivers drop in directory at <code>{automationWorkerWindowsBaseDirectory}/drivers-{newVmNode.fqn}</code>. </p>
<p>Deploys ESXi drivers to <code>/c$/software/drivers-{newVmNode.fqn}</code>.</p>
</p>
</div>
</div>
Expand Down Expand Up @@ -363,14 +371,65 @@ <h3 id="deployesxidriverstoadropdirectorywithwindowsworker">
</div>
<div class="row py-1">
<code class="language-bash">
{automationWorkerWindowsBaseDirectory}/drivers-{newVmNode.fqn}, relative to the home directory
/c$/software/drivers-{newVmNode.fqn}
</code>
</div>









<div class="row pt-5">
<h3 id="moveesxidriverstodropdirectorywithwindowsworker">
<a href="#moveesxidriverstodropdirectorywithwindowsworker">
<strong>Step 2 -</strong> Move ESXi Drivers to Drop Directory with Windows Worker
</a>
</h3>
</div>

















<div class="row">
<p>
Execute the following script:
</p>
</div>
<div class="row">
<div class="col px-0">
<pre>
<code class="language-sql py-0">
$CURRENT_PATH = &quot;C:\software\drivers-{newVmNode.fqn}&quot;
$DEST_FOLDER = &quot;{automationWorkerWindowsBaseDirectory}&quot;

Write-Host &quot;CURRENT_PATH=${CURRENT_PATH}\n DEST_FOLDER=${DEST_FOLDER}&quot;
Move-Item -Path &quot;${CURRENT_PATH}&quot; -Destination &quot;${DEST_FOLDER}&quot;
</code>
</pre>
</div>
</div>






<div class="row pt-5">
<div class="col">
Expand Down

This file was deleted.

1 change: 1 addition & 0 deletions steps/deployesxidriverswithwindowsworker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Deploys ESXi drivers to `/c$/software/drivers-{newVmNode.fqn}`.
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
Original file line number Diff line number Diff line change
@@ -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"
}
Original file line number Diff line number Diff line change
@@ -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}"
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 4072993

Please sign in to comment.