There are already some existing GitHub projects providing templates to create machines with Packer. However I created this project for learning purposes . In addition to the packer documentation I also took some inspiration from these great projects:
- kaorimatz: packer-templates
- mwrock: packer-templates
- MattHodge: PackerTemplates
- jacqinthebox: packer-templates
- chef-bento: packer-templates
- images - images for better illustration in the README.txt
- packerfiles - hcl (variables) for packera
- scripts - script to be used for provisioning
- unattended - preseed files for Linux and Autounattend files for Windows
- vagrantfiles
- @os version@ -
Additional information can be found in the related subfolders
In order to build VMs with packer you can use the gradle script build.gradle
as follows
-
Add a gradle.properties file and define the following values. The values represent tokens which will be replaced in respective answer and packer files
username=@username for user account to be created@
password=@password for user account 'username'@
rootpassword=@password for root/Administrator account@
-
Define additional parameters
builders=@packer builders to execute e.g. virtualbox-iso@
-
Build machines by calling either
gradle buildLinux -PconfigFile=xxx
orgradle buildWindows -PconfigFile=xxx
. You have to submit a config file (name formpackerfiles/iso
folder) which defines which distro / windows version to buildgradle clean buildWindows -PconfigFile=windows_server_2016_standard_x64.hcl
Remark: Some characters may break the scripts e.g. using $
will break windows-base.ps1