Azure rendering solution deployment framework

This commit is contained in:
Rick Shahid 2022-11-27 10:03:55 -08:00
Родитель 79333d9df7
Коммит 5f94446661
18 изменённых файлов: 245 добавлений и 84 удалений

Просмотреть файл

@ -6,6 +6,10 @@ variable "regionName" {
default = "WestUS2" # Set to the target Azure region name (az account list-locations --query [].name)
}
variable "renderManager" {
default = "Deadline" # RoyalRender or Deadline
}
variable "securityResourceGroupName" {
default = "ArtistAnywhere" # Alphanumeric, underscores, hyphens, periods and parenthesis are allowed
}
@ -53,6 +57,10 @@ output "regionName" {
value = var.regionName
}
output "renderManager" {
value = var.renderManager
}
output "securityResourceGroupName" {
value = var.securityResourceGroupName
}

Просмотреть файл

@ -62,7 +62,6 @@ imageTemplates = [
osDiskSizeGB = 0
timeoutMinutes = 120
outputVersion = "0.0.0"
renderManager = "Deadline" # RoyalRender or Deadline
renderEngines = []
}
},
@ -81,7 +80,6 @@ imageTemplates = [
osDiskSizeGB = 480
timeoutMinutes = 240
outputVersion = "1.0.0"
renderManager = "Deadline" # RoyalRender or Deadline
renderEngines = [
"Blender",
"PBRT"
@ -103,7 +101,6 @@ imageTemplates = [
osDiskSizeGB = 480
timeoutMinutes = 240
outputVersion = "1.1.0"
renderManager = "Deadline" # RoyalRender or Deadline
renderEngines = [
"Blender",
"PBRT",
@ -127,7 +124,6 @@ imageTemplates = [
osDiskSizeGB = 512
timeoutMinutes = 240
outputVersion = "2.0.0"
renderManager = "Deadline" # RoyalRender or Deadline
renderEngines = [
"Blender",
"PBRT"
@ -149,7 +145,6 @@ imageTemplates = [
osDiskSizeGB = 512
timeoutMinutes = 240
outputVersion = "2.1.0"
renderManager = "Deadline" # RoyalRender or Deadline
renderEngines = [
"Blender",
"PBRT",
@ -173,7 +168,6 @@ imageTemplates = [
osDiskSizeGB = 0
timeoutMinutes = 180
outputVersion = "0.0.0"
renderManager = "Deadline" # RoyalRender or Deadline
renderEngines = []
}
},
@ -192,7 +186,6 @@ imageTemplates = [
osDiskSizeGB = 480
timeoutMinutes = 420
outputVersion = "1.0.0"
renderManager = "Deadline" # RoyalRender or Deadline
renderEngines = [
"Blender",
"PBRT"
@ -214,7 +207,6 @@ imageTemplates = [
osDiskSizeGB = 480
timeoutMinutes = 420
outputVersion = "1.1.0"
renderManager = "Deadline" # RoyalRender or Deadline
renderEngines = [
"Blender",
"PBRT",
@ -238,7 +230,6 @@ imageTemplates = [
osDiskSizeGB = 512
timeoutMinutes = 420
outputVersion = "2.0.0"
renderManager = "Deadline" # RoyalRender or Deadline
renderEngines = [
"Blender",
"PBRT"
@ -260,7 +251,6 @@ imageTemplates = [
osDiskSizeGB = 512
timeoutMinutes = 420
outputVersion = "2.1.0"
renderManager = "Deadline" # RoyalRender or Deadline
renderEngines = [
"Blender",
"PBRT",

Просмотреть файл

@ -114,7 +114,7 @@ if ($machineType -eq "Scheduler") {
switch ($renderManager) {
"RoyalRender" {
$schedulerVersion = "8.4.02"
$schedulerVersion = "8.4.03"
}
"Deadline" {
$schedulerVersion = "10.2.0.9"
@ -161,8 +161,11 @@ switch ($renderManager) {
Write-Host "Customize (End): Royal Render Installer"
Set-Location -Path $rootDirectory
[System.Environment]::SetEnvironmentVariable("RR_ROOT", $pwd.Path)
if ($machineType -eq "Scheduler") {
Write-Host "Customize (Start): Royal Render Server"
# $installFile = "win__rrServerconsole.bat"
# Start-Process -FilePath .\$installFile -Wait -RedirectStandardOutput "rr-server.output.txt" -RedirectStandardError "rr-server.error.txt"
Write-Host "Customize (End): Royal Render Server"
}

Просмотреть файл

@ -148,7 +148,7 @@ fi
case $renderManager in
"RoyalRender")
schedulerVersion="8.4.02"
schedulerVersion="8.4.03"
;;
"Deadline")
schedulerVersion="10.2.0.9"
@ -198,8 +198,11 @@ case $renderManager in
echo "Customize (End): Royal Render Installer"
cd $rootDirectory
export RR_ROOT=$(pwd)
if [ $machineType == "Scheduler" ]; then
echo "Customize (Start): Royal Render Server"
# installFile="lx__rrServerconsole.sh"
# ./$installFile 1> "rr-server.output.txt" 2> "rr-server.error.txt"
echo "Customize (End): Royal Render Server"
fi

Просмотреть файл

@ -68,7 +68,6 @@ variable "imageTemplates" {
osDiskSizeGB = number
timeoutMinutes = number
outputVersion = string
renderManager = string
renderEngines = list(string)
}
)
@ -223,21 +222,24 @@ resource "azurerm_resource_group_template_deployment" "image_builder" {
resource_group_name = azurerm_resource_group.image.name
deployment_mode = "Incremental"
parameters_content = jsonencode({
"renderManager" = {
value = module.global.renderManager
}
"managedIdentityName" = {
value = module.global.managedIdentityName
},
}
"managedIdentityResourceGroupName" = {
value = module.global.securityResourceGroupName
},
}
"imageGalleryName" = {
value = var.imageGallery.name
},
}
"imageTemplates" = {
value = var.imageTemplates
},
}
"imageScriptContainer" = {
value = "https://${data.azurerm_storage_account.storage.name}.blob.core.windows.net/${azurerm_storage_container.container.name}/"
},
}
"keyVaultSecretAdminUsername" = {
value = data.azurerm_key_vault_secret.admin_username.value
}
@ -250,6 +252,9 @@ resource "azurerm_resource_group_template_deployment" "image_builder" {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"renderManager": {
"type": "string"
},
"managedIdentityName": {
"type": "string"
},
@ -296,6 +301,10 @@ resource "azurerm_resource_group_template_deployment" "image_builder" {
"name": "scriptFilePath",
"type": "string"
},
{
"name": "renderManager",
"type": "string"
},
{
"name": "adminUsername",
"type": "string"
@ -327,7 +336,7 @@ resource "azurerm_resource_group_template_deployment" "image_builder" {
{
"type": "Shell",
"inline": [
"[format('cat {0} | tr -d \r | {1} /bin/bash', concat(parameters('scriptFilePath'), parameters('imageTemplate').image.customizeScript), concat('buildConfigEncoded=', base64(string(union(parameters('imageTemplate').build, createObject('adminUsername', parameters('adminUsername')), createObject('adminPassword', parameters('adminPassword')))))))]"
"[format('cat {0} | tr -d \r | {1} /bin/bash', concat(parameters('scriptFilePath'), parameters('imageTemplate').image.customizeScript), concat('buildConfigEncoded=', base64(string(union(parameters('imageTemplate').build, createObject('renderManager', parameters('renderManager')), createObject('adminUsername', parameters('adminUsername')), createObject('adminPassword', parameters('adminPassword')))))))]"
]
}
]
@ -346,6 +355,10 @@ resource "azurerm_resource_group_template_deployment" "image_builder" {
{
"name": "scriptFilePath",
"type": "string"
},
{
"name": "renderManager",
"type": "string"
}
],
"output": {
@ -373,9 +386,9 @@ resource "azurerm_resource_group_template_deployment" "image_builder" {
{
"type": "PowerShell",
"inline": [
"[format('{0} {1}', concat(parameters('scriptFilePath'), parameters('imageTemplate').image.customizeScript), concat('-buildConfigEncoded ', base64(string(parameters('imageTemplate').build))))]"
"[format('{0} {1}', concat(parameters('scriptFilePath'), parameters('imageTemplate').image.customizeScript), concat('-buildConfigEncoded ', base64(string(union(parameters('imageTemplate').build, createObject('renderManager', parameters('renderManager')))))))]"
],
"runElevated": "[if(and(equals(parameters('imageTemplate').build.renderManager, 'Deadline'), equals(parameters('imageTemplate').build.machineType, 'Scheduler')), true(), false())]"
"runElevated": "[if(and(equals(parameters('renderManager'), 'Deadline'), equals(parameters('imageTemplate').build.machineType, 'Scheduler')), true(), false())]"
}
]
}
@ -408,7 +421,7 @@ resource "azurerm_resource_group_template_deployment" "image_builder" {
"sku": "[reference(resourceId('Microsoft.Compute/galleries/images', parameters('imageGalleryName'), parameters('imageTemplates')[copyIndex()].image.definitionName), variables('imageGalleryApiVersion')).identifier.sku]",
"version": "[parameters('imageTemplates')[copyIndex()].image.inputVersion]"
},
"customize": "[if(equals(reference(resourceId('Microsoft.Compute/galleries/images', parameters('imageGalleryName'), parameters('imageTemplates')[copyIndex()].image.definitionName), variables('imageGalleryApiVersion')).osType, 'Windows'), fx.GetCustomizeCommandsWindows(parameters('imageScriptContainer'), parameters('imageTemplates')[copyIndex()], variables('localDownloadPathWindows')), fx.GetCustomizeCommandsLinux(parameters('imageScriptContainer'), parameters('imageTemplates')[copyIndex()], variables('localDownloadPathLinux'), parameters('keyVaultSecretAdminUsername'), parameters('keyVaultSecretAdminPassword')))]",
"customize": "[if(equals(reference(resourceId('Microsoft.Compute/galleries/images', parameters('imageGalleryName'), parameters('imageTemplates')[copyIndex()].image.definitionName), variables('imageGalleryApiVersion')).osType, 'Windows'), fx.GetCustomizeCommandsWindows(parameters('imageScriptContainer'), parameters('imageTemplates')[copyIndex()], variables('localDownloadPathWindows'), parameters('renderManager')), fx.GetCustomizeCommandsLinux(parameters('imageScriptContainer'), parameters('imageTemplates')[copyIndex()], variables('localDownloadPathLinux'), parameters('renderManager'), parameters('keyVaultSecretAdminUsername'), parameters('keyVaultSecretAdminPassword')))]",
"buildTimeoutInMinutes": "[parameters('imageTemplates')[copyIndex()].build.timeoutMinutes]",
"distribute": [
{

Просмотреть файл

@ -25,7 +25,13 @@ virtualMachines = [
enable = true
fileName = "initialize.sh"
parameters = {
fileSystemMounts = [
fileSystemMountsStorage = [
]
fileSystemMountsStorageCache = [
]
fileSystemMountsRoyalRender = [
]
fileSystemMountsDeadline = [
"scheduler.artist.studio:/DeadlineRepository /mnt/scheduler nfs defaults 0 0"
]
autoScale = {
@ -68,7 +74,13 @@ virtualMachines = [
enable = true
fileName = "initialize.ps1"
parameters = {
fileSystemMounts = [
fileSystemMountsStorage = [
]
fileSystemMountsStorageCache = [
]
fileSystemMountsRoyalRender = [
]
fileSystemMountsDeadline = [
"mount -o anon \\\\scheduler.artist.studio\\DeadlineRepository S:"
]
autoScale = {

Просмотреть файл

@ -35,13 +35,26 @@ if ("${autoScale.enable}" -ne "true") {
$mountFile = "C:\Windows\Temp\mounts.bat"
New-Item -ItemType File -Path $mountFile
%{ for fsMount in fileSystemMounts }
%{ for fsMount in fileSystemMountsStorage }
Add-Content -Path $mountFile -Value "${fsMount}"
%{ endfor }
%{ for fsMount in fileSystemMountsStorageCache }
Add-Content -Path $mountFile -Value "${fsMount}"
%{ endfor }
%{ if renderManager == "RoyalRender" }
%{ for fsMount in fileSystemMountsRoyalRender }
Add-Content -Path $mountFile -Value "${fsMount}"
%{ endfor }
%{ endif }
%{ if renderManager == "Deadline" }
%{ for fsMount in fileSystemMountsDeadline }
Add-Content -Path $mountFile -Value "${fsMount}"
%{ endfor }
%{ endif }
$taskName = "AAA Storage Mounts"
$taskName = "AAA File System Mounts"
$taskAction = New-ScheduledTaskAction -Execute $mountFile
$taskTrigger = New-ScheduledTaskTrigger -AtStartup
Register-ScheduledTask -TaskName $taskName -Action $taskAction -Trigger $taskTrigger -AsJob -User System -Force
Start-Process -FilePath $mountFile -Wait -RedirectStandardOutput "$mountFile.output.txt" -RedirectStandardError "$mountFile.error.txt"
Start-Process -FilePath $mountFile -Wait -RedirectStandardOutput "fs-mounts.output.txt" -RedirectStandardError "fs-mounts.error.txt"

Просмотреть файл

@ -35,11 +35,30 @@ if [ ${autoScale.enable} == true ]; then
systemctl --now enable scale.timer
fi
%{ for fsMount in fileSystemMounts }
%{ for fsMount in fileSystemMountsStorage }
fsMountPoint=$(cut -d ' ' -f 2 <<< "${fsMount}")
mkdir -p $fsMountPoint
echo "${fsMount}" >> /etc/fstab
%{ endfor }
%{ for fsMount in fileSystemMountsStorageCache }
fsMountPoint=$(cut -d ' ' -f 2 <<< "${fsMount}")
mkdir -p $fsMountPoint
echo "${fsMount}" >> /etc/fstab
%{ endfor }
%{ if renderManager == "RoyalRender" }
%{ for fsMount in fileSystemMountsRoyalRender }
fsMountPoint=$(cut -d ' ' -f 2 <<< "${fsMount}")
mkdir -p $fsMountPoint
echo "${fsMount}" >> /etc/fstab
%{ endfor }
%{ endif }
%{ if renderManager == "Deadline" }
%{ for fsMount in fileSystemMountsDeadline }
fsMountPoint=$(cut -d ' ' -f 2 <<< "${fsMount}")
mkdir -p $fsMountPoint
echo "${fsMount}" >> /etc/fstab
%{ endfor }
%{ endif }
mount -a
if [ ${cycleCloud.enable} == true ]; then

Просмотреть файл

@ -66,7 +66,10 @@ variable "virtualMachines" {
fileName = string
parameters = object(
{
fileSystemMounts = list(string)
fileSystemMountsStorage = list(string)
fileSystemMountsStorageCache = list(string)
fileSystemMountsRoyalRender = list(string)
fileSystemMountsDeadline = list(string)
autoScale = object(
{
enable = bool
@ -305,6 +308,7 @@ resource "azurerm_virtual_machine_extension" "custom_linux" {
{ tenantId = data.azurerm_client_config.current.tenant_id },
{ subscriptionId = data.azurerm_client_config.current.subscription_id },
{ regionName = module.global.regionName },
{ renderManager = module.global.renderManager },
{ networkResourceGroupName = data.azurerm_virtual_network.compute.resource_group_name },
{ networkName = data.azurerm_virtual_network.compute.name },
{ networkSubnetName = data.azurerm_subnet.farm.name },
@ -389,7 +393,9 @@ resource "azurerm_virtual_machine_extension" "custom_windows" {
virtual_machine_id = "${azurerm_resource_group.scheduler.id}/providers/Microsoft.Compute/virtualMachines/${each.value.name}"
settings = jsonencode({
"commandToExecute": "PowerShell -ExecutionPolicy Unrestricted -EncodedCommand ${textencodebase64(
templatefile(each.value.customExtension.fileName, each.value.customExtension.parameters), "UTF-16LE"
templatefile(each.value.customExtension.fileName, merge(each.value.customExtension.parameters,
{ renderManager = module.global.renderManager }
)), "UTF-16LE"
)}"
})
depends_on = [

Просмотреть файл

@ -32,11 +32,17 @@ virtualMachineScaleSets = [
enable = true
fileName = "initialize.sh"
parameters = {
fileSystemMounts = [
"scheduler.artist.studio:/DeadlineRepository /mnt/scheduler nfs defaults 0 0",
"azrender1.blob.core.windows.net:/azrender1/show /mnt/show/write nfs sec=sys,vers=3,proto=tcp,nolock 0 0",
fileSystemMountsStorage = [
"azrender1.blob.core.windows.net:/azrender1/show /mnt/show/write nfs sec=sys,vers=3,proto=tcp,nolock 0 0"
]
fileSystemMountsStorageCache = [
# "cache.artist.studio:/mnt/show /mnt/show/read nfs hard,proto=tcp,mountproto=tcp,retry=30,nolock 0 0"
]
fileSystemMountsRoyalRender = [
]
fileSystemMountsDeadline = [
"scheduler.artist.studio:/DeadlineRepository /mnt/scheduler nfs defaults 0 0"
]
fileSystemPermissions = [
"chmod 777 /mnt/show/write"
]
@ -89,11 +95,17 @@ virtualMachineScaleSets = [
enable = true
fileName = "initialize.ps1"
parameters = {
fileSystemMounts = [
"mount -o anon \\\\scheduler.artist.studio\\DeadlineRepository S:",
"mount -o anon nolock \\\\azrender1.blob.core.windows.net\\azrender1\\show W:",
fileSystemMountsStorage = [
"mount -o anon nolock \\\\azrender1.blob.core.windows.net\\azrender1\\show W:"
]
fileSystemMountsStorageCache = [
# "mount -o anon nolock \\\\cache.artist.studio\\mnt\\show R:"
]
fileSystemMountsRoyalRender = [
]
fileSystemMountsDeadline = [
"mount -o anon \\\\scheduler.artist.studio\\DeadlineRepository S:"
]
fileSystemPermissions = [
"icacls W: /grant Everyone:F"
]

Просмотреть файл

@ -10,20 +10,31 @@ for ($i = 0; $i -lt 12; $i++) {
Register-ScheduledTask -TaskName $taskName -Action $taskAction -Trigger $taskTrigger -AsJob -User System -Force
}
%{ if length(fileSystemMounts) > 0 }
$mountFile = "C:\Windows\Temp\mounts.bat"
New-Item -ItemType File -Path $mountFile
%{ for fsMount in fileSystemMounts }
$mountFile = "C:\Windows\Temp\mounts.bat"
New-Item -ItemType File -Path $mountFile
%{ for fsMount in fileSystemMountsStorage }
Add-Content -Path $mountFile -Value "${fsMount}"
%{ endfor }
%{ for fsMount in fileSystemMountsStorageCache }
Add-Content -Path $mountFile -Value "${fsMount}"
%{ endfor }
%{ if renderManager == "RoyalRender" }
%{ for fsMount in fileSystemMountsRoyalRender }
Add-Content -Path $mountFile -Value "${fsMount}"
%{ endfor }
$taskName = "AAA Storage Mounts"
$taskAction = New-ScheduledTaskAction -Execute $mountFile
$taskTrigger = New-ScheduledTaskTrigger -AtStartup
Register-ScheduledTask -TaskName $taskName -Action $taskAction -Trigger $taskTrigger -AsJob -User System -Force
Start-Process -FilePath $mountFile -Wait -RedirectStandardOutput "$mountFile.output.txt" -RedirectStandardError "$mountFile.error.txt"
%{ for fsPermission in fileSystemPermissions }
${fsPermission}
%{ endif }
%{ if renderManager == "Deadline" }
%{ for fsMount in fileSystemMountsDeadline }
Add-Content -Path $mountFile -Value "${fsMount}"
%{ endfor }
%{ endif }
$taskName = "AAA File System Mounts"
$taskAction = New-ScheduledTaskAction -Execute $mountFile
$taskTrigger = New-ScheduledTaskTrigger -AtStartup
Register-ScheduledTask -TaskName $taskName -Action $taskAction -Trigger $taskTrigger -AsJob -User System -Force
Start-Process -FilePath $mountFile -Wait -RedirectStandardOutput "fs-mounts.output.txt" -RedirectStandardError "fs-mounts.error.txt"
%{ for fsPermission in fileSystemPermissions }
${fsPermission}
%{ endfor }

Просмотреть файл

@ -23,14 +23,31 @@ echo "[Install]" >> $timerPath
echo "WantedBy=timers.target" >> $timerPath
systemctl --now enable terminate.timer
%{ if length(fileSystemMounts) > 0 }
%{ for fsMount in fileSystemMounts }
%{ for fsMount in fileSystemMountsStorage }
fsMountPoint=$(cut -d ' ' -f 2 <<< "${fsMount}")
mkdir -p $fsMountPoint
echo "${fsMount}" >> /etc/fstab
%{ endfor }
%{ for fsMount in fileSystemMountsStorageCache }
fsMountPoint=$(cut -d ' ' -f 2 <<< "${fsMount}")
mkdir -p $fsMountPoint
echo "${fsMount}" >> /etc/fstab
%{ endfor }
%{ if renderManager == "RoyalRender" }
%{ for fsMount in fileSystemMountsRoyalRender }
fsMountPoint=$(cut -d ' ' -f 2 <<< "${fsMount}")
mkdir -p $fsMountPoint
echo "${fsMount}" >> /etc/fstab
%{ endfor }
mount -a
%{ for fsPermission in fileSystemPermissions }
${fsPermission}
%{ endif }
%{ if renderManager == "Deadline" }
%{ for fsMount in fileSystemMountsDeadline }
fsMountPoint=$(cut -d ' ' -f 2 <<< "${fsMount}")
mkdir -p $fsMountPoint
echo "${fsMount}" >> /etc/fstab
%{ endfor }
%{ endif }
mount -a
%{ for fsPermission in fileSystemPermissions }
${fsPermission}
%{ endfor }

Просмотреть файл

@ -73,8 +73,11 @@ variable "virtualMachineScaleSets" {
fileName = string
parameters = object(
{
fileSystemMounts = list(string)
fileSystemPermissions = list(string)
fileSystemMountsStorage = list(string)
fileSystemMountsStorageCache = list(string)
fileSystemMountsRoyalRender = list(string)
fileSystemMountsDeadline = list(string)
fileSystemPermissions = list(string)
}
)
}
@ -251,7 +254,9 @@ resource "azurerm_linux_virtual_machine_scale_set" "farm" {
auto_upgrade_minor_version = true
settings = jsonencode({
"script": "${base64encode(
templatefile(each.value.customExtension.fileName, each.value.customExtension.parameters)
templatefile(each.value.customExtension.fileName, merge(each.value.customExtension.parameters,
{ renderManager = module.global.renderManager }
))
)}"
})
}
@ -353,7 +358,9 @@ resource "azurerm_windows_virtual_machine_scale_set" "farm" {
auto_upgrade_minor_version = true
settings = jsonencode({
"commandToExecute": "PowerShell -ExecutionPolicy Unrestricted -EncodedCommand ${textencodebase64(
templatefile(each.value.customExtension.fileName, each.value.customExtension.parameters), "UTF-16LE"
templatefile(each.value.customExtension.fileName, merge(each.value.customExtension.parameters,
{ renderManager = module.global.renderManager }
)), "UTF-16LE"
)}"
})
}

Просмотреть файл

@ -25,10 +25,16 @@ virtualMachines = [
enable = true
fileName = "initialize.sh"
parameters = {
fileSystemMounts = [
"scheduler.artist.studio:/DeadlineRepository /mnt/scheduler nfs defaults 0 0",
fileSystemMountsStorage = [
"azrender1.blob.core.windows.net:/azrender1/show /mnt/show nfs sec=sys,vers=3,proto=tcp,nolock 0 0"
]
fileSystemMountsStorageCache = [
]
fileSystemMountsRoyalRender = [
]
fileSystemMountsDeadline = [
"scheduler.artist.studio:/DeadlineRepository /mnt/scheduler nfs defaults 0 0"
]
teradiciLicenseKey = ""
}
}
@ -57,10 +63,16 @@ virtualMachines = [
enable = true
fileName = "initialize.ps1"
parameters = {
fileSystemMounts = [
"mount -o anon \\\\scheduler.artist.studio\\DeadlineRepository S:",
fileSystemMountsStorage = [
"mount -o anon nolock \\\\azrender1.blob.core.windows.net\\azrender1\\show W:"
]
fileSystemMountsStorageCache = [
]
fileSystemMountsRoyalRender = [
]
fileSystemMountsDeadline = [
"mount -o anon \\\\scheduler.artist.studio\\DeadlineRepository S:"
]
teradiciLicenseKey = ""
}
}

Просмотреть файл

@ -5,17 +5,28 @@ $ErrorActionPreference = "Stop"
Start-Process -FilePath "PowerShell.exe" -ArgumentList "-ExecutionPolicy Unrestricted -File ""$agentFile"" -RegistrationCode ${teradiciLicenseKey}" -Wait -RedirectStandardOutput "$agentFile.output.txt" -RedirectStandardError "$agentFile.error.txt"
%{ endif }
%{ if length(fileSystemMounts) > 0 }
$mountFile = "C:\Windows\Temp\mounts.bat"
New-Item -ItemType File -Path $mountFile
%{ for fsMount in fileSystemMounts }
$mountFile = "C:\Windows\Temp\mounts.bat"
New-Item -ItemType File -Path $mountFile
%{ for fsMount in fileSystemMountsStorage }
Add-Content -Path $mountFile -Value "${fsMount}"
%{ endfor }
%{ for fsMount in fileSystemMountsStorageCache }
Add-Content -Path $mountFile -Value "${fsMount}"
%{ endfor }
%{ if renderManager == "RoyalRender" }
%{ for fsMount in fileSystemMountsRoyalRender }
Add-Content -Path $mountFile -Value "${fsMount}"
%{ endfor }
$taskName = "AAA Storage Mounts"
$taskAction = New-ScheduledTaskAction -Execute $mountFile
$taskTrigger = New-ScheduledTaskTrigger -AtStartup
Register-ScheduledTask -TaskName $taskName -Action $taskAction -Trigger $taskTrigger -AsJob -User System -Force
Start-Process -FilePath $mountFile -Wait -RedirectStandardOutput "$mountFile.output.txt" -RedirectStandardError "$mountFile.error.txt"
%{ endif }
%{ if renderManager == "Deadline" }
%{ for fsMount in fileSystemMountsDeadline }
Add-Content -Path $mountFile -Value "${fsMount}"
%{ endfor }
%{ endif }
$taskName = "AAA File System Mounts"
$taskAction = New-ScheduledTaskAction -Execute $mountFile
$taskTrigger = New-ScheduledTaskTrigger -AtStartup
Register-ScheduledTask -TaskName $taskName -Action $taskAction -Trigger $taskTrigger -AsJob -User System -Force
Start-Process -FilePath $mountFile -Wait -RedirectStandardOutput "fs-mounts.output.txt" -RedirectStandardError "fs-mounts.error.txt"

Просмотреть файл

@ -6,11 +6,28 @@ source /etc/profile.d/aaa.sh # https://github.com/Azure/WALinuxAgent/issues/1561
pcoip-register-host --registration-code=${teradiciLicenseKey}
%{ endif }
%{ if length(fileSystemMounts) > 0 }
%{ for fsMount in fileSystemMounts }
%{ for fsMount in fileSystemMountsStorage }
fsMountPoint=$(cut -d ' ' -f 2 <<< "${fsMount}")
mkdir -p $fsMountPoint
echo "${fsMount}" >> /etc/fstab
%{ endfor }
%{ for fsMount in fileSystemMountsStorageCache }
fsMountPoint=$(cut -d ' ' -f 2 <<< "${fsMount}")
mkdir -p $fsMountPoint
echo "${fsMount}" >> /etc/fstab
%{ endfor }
%{ if renderManager == "RoyalRender" }
%{ for fsMount in fileSystemMountsRoyalRender }
fsMountPoint=$(cut -d ' ' -f 2 <<< "${fsMount}")
mkdir -p $fsMountPoint
echo "${fsMount}" >> /etc/fstab
%{ endfor }
mount -a
%{ endif }
%{ if renderManager == "Deadline" }
%{ for fsMount in fileSystemMountsDeadline }
fsMountPoint=$(cut -d ' ' -f 2 <<< "${fsMount}")
mkdir -p $fsMountPoint
echo "${fsMount}" >> /etc/fstab
%{ endfor }
%{ endif }
mount -a

Просмотреть файл

@ -62,8 +62,11 @@ variable "virtualMachines" {
fileName = string
parameters = object(
{
fileSystemMounts = list(string)
teradiciLicenseKey = string
fileSystemMountsStorage = list(string)
fileSystemMountsStorageCache = list(string)
fileSystemMountsRoyalRender = list(string)
fileSystemMountsDeadline = list(string)
teradiciLicenseKey = string
}
)
}
@ -215,7 +218,9 @@ resource "azurerm_virtual_machine_extension" "custom_linux" {
virtual_machine_id = "${azurerm_resource_group.workstation.id}/providers/Microsoft.Compute/virtualMachines/${each.value.name}"
settings = jsonencode({
"script": "${base64encode(
templatefile(each.value.customExtension.fileName, each.value.customExtension.parameters)
templatefile(each.value.customExtension.fileName, merge(each.value.customExtension.parameters,
{ renderManager = module.global.renderManager }
))
)}"
})
depends_on = [
@ -288,7 +293,9 @@ resource "azurerm_virtual_machine_extension" "custom_windows" {
virtual_machine_id = "${azurerm_resource_group.workstation.id}/providers/Microsoft.Compute/virtualMachines/${each.value.name}"
settings = jsonencode({
"commandToExecute": "PowerShell -ExecutionPolicy Unrestricted -EncodedCommand ${textencodebase64(
templatefile(each.value.customExtension.fileName, each.value.customExtension.parameters), "UTF-16LE"
templatefile(each.value.customExtension.fileName, merge(each.value.customExtension.parameters,
{ renderManager = module.global.renderManager }
)), "UTF-16LE"
)}"
})
depends_on = [

Просмотреть файл

@ -182,8 +182,8 @@ New-Item -ItemType Directory -Path $localDirectory -Force
1. Review and edit the config values in `config.auto.tfvars` for your deployment.
* Make sure you have sufficient compute (*Spot*) cores quota available in your Azure subscription.
* Make sure the **imageId** config references the correct custom image in your Azure subscription.
* Make sure the **fileSystemMounts** config has the correct values (e.g., storage account name).
* If your config includes cache mounting, which is the default config, make sure [4 Storage Cache](#4-storage-cache) is deployed and *running* before deploying this module.
* Make sure the **fileSystemMounts*** configs have the correct values (e.g., storage account name).
* If your config has cache mounts, make sure [4 Storage Cache](#4-storage-cache) is deployed and *running* before deploying this module.
* Make sure the **fileSystemPermissions** config has the appropriate value for your environment.
1. Run `terraform init -backend-config ../0.global/backend.config` to initialize the current local directory (append `-upgrade` if older providers are detected)
1. Run `terraform apply` to generate the Terraform deployment [Plan](https://www.terraform.io/docs/cli/run/index.html#planning) (append `-destroy` to delete Azure resources)
@ -197,8 +197,8 @@ New-Item -ItemType Directory -Path $localDirectory -Force
1. Review and edit the config values in `config.auto.tfvars` for your deployment.
* Make sure you have sufficient compute cores quota available in your Azure subscription.
* Make sure the **imageId** config references the correct custom image in your Azure subscription.
* Make sure the **fileSystemMounts** config has the correct values (e.g., storage cache mount).
* If your config includes cache mounting, which is the default config, make sure [4 Storage Cache](#4-storage-cache) is deployed and *running* before deploying this module.
* Make sure the **fileSystemMounts*** configs have the correct values (e.g., storage cache mount).
* If your config has cache mounts, make sure [4 Storage Cache](#4-storage-cache) is deployed and *running* before deploying this module.
1. Run `terraform init -backend-config ../0.global/backend.config` to initialize the current local directory (append `-upgrade` if older providers are detected)
1. Run `terraform apply` to generate the Terraform deployment [Plan](https://www.terraform.io/docs/cli/run/index.html#planning) (append `-destroy` to delete Azure resources)
1. Review and confirm the displayed Terraform deployment plan to add, change and/or destroy Azure resources