-
-
Save riblo/3180d8f37f946cf2ae97e30cb2085b57 to your computer and use it in GitHub Desktop.
Packer file for building Windows base images
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": [ | |
{ | |
"type": "hyperv-iso", | |
"output_directory": "./output-{{ user `os_name` }}-base-hyperv/", | |
"temp_path": "C:\\ClusterStorage\\HYPData01\\PackerTemplates\\temp", | |
"vm_name": "{{ user `os_name` }}-base", | |
"iso_url": "{{ user `iso_url` }}", | |
"iso_checksum": "{{ user `iso_checksum` }}", | |
"iso_checksum_type": "sha1", | |
"communicator": "winrm", | |
"winrm_username": "Administrator", | |
"winrm_password": "R3fImage", | |
"winrm_timeout": "12h", | |
"shutdown_command": "C:/Windows/packer/PackerShutdown.bat", | |
"shutdown_timeout": "1h", | |
"floppy_files": [], | |
"secondary_iso_images": [ | |
"./answer_files/{{ user `os_name` }}/Autounattend.iso" | |
], | |
"cpu": 2, | |
"switch_name":"Hyper-V Logical SET Switch", | |
"vlan_id":"1260", | |
"disk_size": 81920, | |
"ram_size": 3072, | |
"generation": 2, | |
"enable_secure_boot":true, | |
"boot_wait": "0s", | |
"boot_command": [ | |
"a<wait>a<wait>a" | |
] | |
} | |
], | |
"provisioners": [ | |
{ | |
"type": "powershell", | |
"inline": [ | |
"$env:chocolateyUseWindowsCompression = 'false'", | |
"iwr https://chocolatey.org/install.ps1 -UseBasicParsing | iex" | |
], | |
"elevated_user": "Administrator", | |
"elevated_password": "R3fImage", | |
"valid_exit_codes": [ | |
0, | |
1 | |
] | |
}, | |
{ | |
"type": "powershell", | |
"script": "scripts/install_windows_updates.ps1", | |
"elevated_user": "Administrator", | |
"elevated_password": "R3fImage", | |
"valid_exit_codes": [ | |
0, | |
1, | |
2, | |
3, | |
5, | |
10, | |
15, | |
259 | |
] | |
}, | |
{ | |
"type": "windows-restart", | |
"restart_timeout": "1h" | |
}, | |
{ | |
"type": "powershell", | |
"script": "scripts/install_windows_updates.ps1", | |
"elevated_user": "Administrator", | |
"elevated_password": "R3fImage", | |
"valid_exit_codes": [ | |
0, | |
1, | |
2, | |
3, | |
5, | |
10, | |
15, | |
259 | |
] | |
}, | |
{ | |
"type": "windows-restart", | |
"restart_timeout": "1h" | |
}, | |
{ | |
"type": "powershell", | |
"script": "scripts/install_windows_updates.ps1", | |
"elevated_user": "Administrator", | |
"elevated_password": "R3fImage", | |
"valid_exit_codes": [ | |
0, | |
1, | |
2, | |
3, | |
5, | |
10, | |
15, | |
259 | |
] | |
}, | |
{ | |
"type": "windows-restart", | |
"restart_timeout": "1h" | |
}, | |
{ | |
"type": "powershell", | |
"script": "scripts/install_ps5.ps1", | |
"elevated_user": "Administrator", | |
"elevated_password": "R3fImage", | |
"valid_exit_codes": [ | |
0, | |
3010 | |
] | |
}, | |
{ | |
"type": "windows-restart", | |
"restart_timeout": "1h" | |
}, | |
{ | |
"type": "powershell", | |
"script": "scripts/install_windows_updates.ps1", | |
"elevated_user": "Administrator", | |
"elevated_password": "R3fImage", | |
"valid_exit_codes": [ | |
0, | |
2, | |
3, | |
5, | |
10, | |
15, | |
259 | |
] | |
}, | |
{ | |
"type": "windows-restart", | |
"restart_timeout": "1h" | |
}, | |
{ | |
"type": "powershell", | |
"script": "scripts/Uninstall_Smb1.ps1", | |
"elevated_user": "Administrator", | |
"elevated_password": "R3fImage" | |
}, | |
{ | |
"type": "windows-restart", | |
"restart_timeout": "1h" | |
}, | |
{ | |
"type": "powershell", | |
"script": "scripts/Enable_RemoteDesktop.ps1", | |
"elevated_user": "Administrator", | |
"elevated_password": "R3fImage" | |
}, | |
{ | |
"script": "scripts/clean_and_scrub.ps1", | |
"type": "powershell", | |
"elevated_user": "Administrator", | |
"elevated_password": "R3fImage" | |
}, | |
{ | |
"type": "powershell", | |
"script": "scripts/save_shutdown_command.ps1" | |
} | |
], | |
"variables": { | |
"os_name": "", | |
"iso_checksum": "", | |
"iso_url": "", | |
"guest_os_type": "", | |
"install_vbox_tools": "" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment