Hello,
We have a windows template that we customize with a static IP and run sysprep. However we have determined that sysprep doesn't remove the IP.
We have attempted to customize the Aria Assembler to overwrite that but it is currently not working. Any suggestions?
Thanks,
Can you share the Cloud Template?
Hi Damian,
Here is the Cloud Template YAML.
formatVersion: 1
inputs:
Function:
type: string
title: Function
description: Function that the server will be running.
oneOf:
- title: Application Services
const: A
- title: Backup Services
const: B
- title: Domain Controller
const: C
- title: DHCP Services
const: D
temppass:
type: string
title: Temporary Password
encrypted: true
description: Temporary password for the default account while the system is being deployed.
Description:
type: string
title: VM Description
description: Description of what the VM is running and it's use.
vm-size:
type: string
title: Machine Size
description: |-
Size of the Machine being deployed
Small 1vcpu 1gb ram
Med 2vcpu 4gb ram
Large 4vcpu 8gb ram
oneOf:
- title: Small
const: PL-LAB-Small
- title: Medium
const: PL-LAB-Medium
- title: Large
const: PL-LAB-Large
resources:
Cloud_vSphere_Network_1:
type: Cloud.vSphere.Network
properties:
networkType: existing
Cloud_vSphere_Disk_1:
type: Cloud.vSphere.Disk
properties:
capacityGb: 10
Cloud_Machine_1:
type: Cloud.vSphere.Machine
properties:
image: PL-LAB-W2K22
flavor: ${input.vm-size}
name: ${input.Function}V
function: ${input.Function}
poc_name: ${env.requestedBy}
description: ${input.Description}
folderName: ${env.projectName}/Tenant VMs
remoteAccess:
authentication: usernamePassword
username: Administrator
password: ${input.temppass}
attachedDisks:
- source: ${resource.Cloud_vSphere_Disk_1.id}
cloudConfigSettings:
deploymentFailOnCloudConfigRuntimeError: true
cloudConfig: |
#cloud-config
write_files:
content: |
$password = ConvertTo-SecureString '${secret.ADJoin}' -AsPlainText -Force
$username = 'administrator@xxx.com'
$credential = New-Object System.Management.Automation.PSCredential($username,$password)
$localpass = ConvertTo-SecureString '${secret.localpass}' -AsPlainText -Force
$localuser = '${secret.localuser}'
New-LocalUser $localuser -AccountNeverExpires -FullName "Local Admin" -Description 'Local Admin Account' -Password $localpass -PasswordNeverExpires
Add-LocalGroupMember -Group Administrators -Member $localuser
Add-Computer -DomainName xxx.com -OUPath "OU=KW-Test,DC=xxx,DC=com" -Credential $credential -Restart -Force
Invoke-Command -ComputerName localhost -Credential $credential -ScriptBlock {Add-LocalGroupMember -Group Administrators -Member "xxx\${env.requestedBy}"}
path: C:\setupscripts.ps1
runcmd:
- powershell -Command "Get-Disk | Where-Object PartitionStyle -Eq "RAW" | Initialize-Disk -PassThru | New-Partition -AssignDriveLetter -UseMaximumSize | Format-Volume -NewFileSystemLabel "DATA""
- powershell -Command "C:\setupscripts.ps1"
networks:
- network: ${resource.Cloud_vSphere_Network_1.id}
assignment: static
# ------------------------ ABX Actions ----------------------------#
create_dns: true # used to target the subscription
cnameRecord: ${resource.Cloud_Machine_1.resourceName} # provided by the custom hostnaming under infrastructure
# -----------------------------------------------------------------#
Cloud-Init doesn't support static IP.
In order to set an static IP, Aria Automation uses a Configuration Specification for vCenter. If you don't specify one, Automation creates one "on the fly" and passes it to vCenter.
When a Customization Spec is utilized, the VM will be restarted one or two times and this can break the execution of the Cloud-Init script. That is why, when you set a cloud-init script, Automation doesn't create the Customization Spec.
You can try to create your own Customization Spec in vCenter and add it to the Cloud Template but, in my experience, some times it works and some times it doesn't.
Cloud_Machine_1:
type: Cloud.vSphere.Machine
properties:
image: PL-LAB-W2K22
customizationSpec: My-CustomSpec