VMware PowerShell – VM Advanced Settings – ‘guestinfo.ignition.config.data’

VMware PowerShell – VM Advanced Settings – ‘guestinfo.ignition.config.data’

Working this evening with my colleague Dean this evening he asked me to create a quick PowerShell script to help him with an OpenShift 4 installation.  What he needed to do was to edit the advanced setting ‘guest.ignition.config.data’ with a base64 encoding value.

The quick and dirty version of the script is below;

#Edit 'Base64_64' values to the bootstrap, master and worker variables below
$bootstrap = 'Base64_Value'
$master = 'Base64_Value'
$worker = 'Base64_Value'

#Edit 'VM_Name' with the Virtual Machine names for your bootstrap, master and workers
Get-AdvancedSetting -entity 'bootstrap_VM_Name' -Name 'guestinfo.ignition.config.data' | Set-AdvancedSetting -Value $bootstrap -Confirm:$false
Get-AdvancedSetting -entity 'master_VM_Name' -Name 'guestinfo.ignition.config.data' | Set-AdvancedSetting -Value $master -Confirm:$false
Get-AdvancedSetting -entity 'workers_VM_Name' -Name 'guestinfo.ignition.config.data' | Set-AdvancedSetting -Value $worker -Confirm:$false

#Edit 'VM_Name' with the Virtual Machine names for your bootstrap, master and workers
Get-AdvancedSetting -entity 'bootstrap_VM_Name' -Name 'guestinfo.ignition.config.data.encoding' | Set-AdvancedSetting -Value 'base64' -Confirm:$false
Get-AdvancedSetting -entity 'master_VM_Name' -Name 'guestinfo.ignition.config.data.encoding' | Set-AdvancedSetting -Value 'base64' -Confirm:$false
Get-AdvancedSetting -entity 'workers_VM_Name' -Name 'guestinfo.ignition.config.data.encoding' | Set-AdvancedSetting -Value 'base64' -Confirm:$false

The script above is for if you are working with an environment where the advanced setting values have already been created.  If you are working with new machines and these advanced settings don’t yet exist they can be created with a simple code change;

#Edit 'Base64_64' values to the bootstrap, master and worker variables below
$bootstrap = 'Base64_Value'
$master = 'Base64_Value'
$worker = 'Base64_Value'

#Edit 'VM_Name' with the Virtual Machine names for your bootstrap, master and workers
New-AdvancedSetting -Name 'guestinfo.ignition.config.data' -Value $bootstrap -entity 'bootstrap_VM_Name' -Confirm:$false
New-AdvancedSetting -Name 'guestinfo.ignition.config.data' -Value $master -entity 'master_VM_Name' -Confirm:$false
New-AdvancedSetting -Name 'guestinfo.ignition.config.data' -Value $worker -entity 'worker_VM_Name' -Confirm:$false

#Edit 'VM_Name' with the Virtual Machine names for your bootstrap, master and workers
New-AdvancedSetting -Name 'guestinfo.ignition.config.data.encoding' -Value 'base64' -entity 'bootstrap_VM_Name' -Confirm:$false
New-AdvancedSetting -Name 'guestinfo.ignition.config.data.encoding' -Value 'base64' -entity 'master_VM_Name' -Confirm:$false
New-AdvancedSetting -Name 'guestinfo.ignition.config.data.encoding' -Value 'base64' -entity 'worker_VM_Name' -Confirm:$false

There you have it, quick and dirty scripts to simplify the task.

If you had the time you could build a single script to test to see if the value existed and either populate or create the settings as required.  I might come back and do that a little later, but at the moment it’s gone 11pm…

Thanks

Simon