This repo contains templates that are specifically configured to be built with HashiCorp Packer and utilize Cloud-Init as the customization engine on VMware vSphere
- HashiCorp Packer 1.78
- mkpasswd
- Ubuntu -
apt install whois
- Ubuntu -
- Internet Connection - Packer will download the Ubuntu ISO from the internet
- Generate your SSH keys by running
create-ssh-keys.sh
- Copy the contents of the
packer.pub
file - Paste the contents on line 12 of templates/build.pkrvars.hcl
- Edit the
build_username
on line 9 of templates/build.pkrvars.hcl - Edit the
build_password
on line 10 of templates/build.pkrvars.hcl - In a linux terminal run
mkpasswd -m sha-512
and enter your desired password - Copy the output and edit the
build_password_encrypted
on line 11 of templates/build.pkrvars.hcl
- Edit the
vsphere_endpoint
variable on line 8 of templates/vsphere.pkrvars.hcl - Edit the
vsphere_username
variable on line 9 of templates/vsphere.pkrvars.hcl - Edit the
vsphere_password
variable on line 10 of templates/vsphere.pkrvars.hcl
- Edit the
vsphere_datacenter
variable on line 14 of templates/vsphere.pkrvars.hcl - Edit the
vsphere_cluster
variable on line 15 of templates/vsphere.pkrvars.hcl - Edit the
vsphere_datastore
variable on line 16 of templates/vsphere.pkrvars.hcl - Edit the
vsphere_network
variable on line 17 of templates/vsphere.pkrvars.hcl - Edit the
vsphere_folder
variable on line 18 of templates/vsphere.pkrvars.hcl If these folders don't exist, Packer will create them.
- Edit the
vsphere_vm_version
variable on line 22 of templates/vsphere.pkrvars.hcl to match the version your environment supports
- Run
build-ubuntu-20.sh
- This Packer setup downloads the Ubuntu Server ISO from a pre-determined URL located in templates/ubuntu/20/linux-ubuntu-server.auto.pkrvars.hcl
- You can change the URL to something else or a newer release and re-run Packer
- Packer may throw an error for a checksum mismatch and if it does you can copy the new value output via the terminal to the config file so that they match
-
Add dynamic fetching of public ssh key during build instead of manually requiring variable changes in build.hcl
-
Add additional distro's
- CentOS