dsgnr / packer-vsphere-templates

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Packer vSphere templates

A collection of Packer templates to standardise, and automate the building of VM templates in vSphere.

A number of things are performed during the image building procedure;

  • Disable swap (if applicable)
  • Installing common packages
  • Kernel parameters defined for ip_forward and bridge-nf-call-iptables
  • Run package upgrades
  • Sanitise the VM ready for templating

Virtual machines are deployed from these templates via cloud-init for automated IP provisioning and startup scripts. These are defined in vSphere guest customisations.

Assumptions

Usage

An example vSphere configuration file has been created at config.pkgvars.hcl.example. This file should be copied and updated accordingly to the respective vSphere you would like to provision the template in.

Example for vSphere;

$ cp config.pkgvars.hcl.example config.pkgvars.hcl
$ vim config.pkgvars.hcl # edit the required parameters

Deploying a VM template is simple. An example of creating a new Ubuntu 22.04 template in the LON3 vSphere;

packer init ubuntu-22.04-lts
packer build -var-file=config.pkgvars.hcl ubuntu-22.04-lts

When complete, the build will power down the template and convert it to a vSphere template in the vsphere_template_dir or elsewhere if this has been modified.

About


Languages

Language:HCL 65.8%Language:Shell 18.5%Language:Smarty 15.7%