Created
September 15, 2020 15:47
-
-
Save brettmillerb/fb4dd3bc0ea26afd52ea6f6232cd585b to your computer and use it in GitHub Desktop.
Packer Template Windows Updates
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"builders": [ | |
{ | |
"capture_container_name": "vsts-buildimagetask", | |
"capture_name_prefix": "{{user `capture_name_prefix`}}", | |
"client_id": "{{user `client_id`}}", | |
"client_secret": "{{user `client_secret`}}", | |
"communicator": "winrm", | |
"image_offer": "{{user `image_offer`}}", | |
"image_publisher": "{{user `image_publisher`}}", | |
"image_sku": "{{user `image_sku`}}", | |
"location": "{{user `location`}}", | |
"object_id": "{{user `object_id`}}", | |
"os_type": "Windows", | |
"resource_group_name": "dsncontrol-{{user `environment`}}-RG", | |
"storage_account": "dsncontrol{{user `environment` | lower}}", | |
"subscription_id": "{{user `subscription_id`}}", | |
"tenant_id": "{{user `tenant_id`}}", | |
"type": "azure-arm", | |
"vm_size": "Standard_D3_v2", | |
"winrm_insecure": "true", | |
"winrm_timeout": "15m", | |
"winrm_use_ssl": "true", | |
"winrm_username": "packer" | |
} | |
], | |
"post-processors": [], | |
"provisioners": [ | |
{ | |
"type": "windows-shell", | |
"inline": [ | |
"cmd /c \"if exist c:\\\\DeployTemp rd /s /q c:\\\\DeployTemp\"", | |
"cmd /c \"mkdir c:\\\\DeployTemp\"" | |
] | |
}, | |
{ | |
"type": "windows-update" | |
}, | |
{ | |
"type": "file", | |
"source": "{{user `package_path`}}", | |
"destination": "c:\\DeployTemp" | |
}, | |
{ | |
"type": "powershell", | |
"inline": [ | |
"cd \"C:\\DeployTemp\"", | |
"C:\\DeployTemp\\{{user `script_imageconfig_path`}}" | |
] | |
}, | |
{ | |
"type": "file", | |
"source": "C:\\DeployTemp\\TestResults.xml", | |
"destination": "{{user `defaultdir`}}\\TestResults.xml", | |
"direction": "download" | |
}, | |
{ | |
"type": "powershell", | |
"inline": [ | |
"if( Test-Path $Env:SystemRoot\\windows\\system32\\Sysprep\\unattend.xml ){ rm $Env:SystemRoot\\windows\\system32\\Sysprep\\unattend.xml -Force}", | |
"& $Env:SystemRoot\\System32\\Sysprep\\Sysprep.exe /oobe /generalize /quit /quiet" | |
] | |
} | |
], | |
"variables": { | |
"capture_name_prefix": "", | |
"client_id": "", | |
"client_secret": "", | |
"image_offer": "", | |
"image_publisher": "", | |
"image_sku": "", | |
"location": "", | |
"object_id": "", | |
"package_name": "", | |
"package_path": "", | |
"script_imageconfig_path": "", | |
"script_windowsupdate_path": "", | |
"subscription_id": "", | |
"tenant_id": "", | |
"environment": "" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment