Background

Build a virtual machine on an VMware ESXi hypervisor.

Pre-requisites

  • A machine with the following packages
    • Go
    • Ansible
    • Hashicorp's Packer
    • OpenSSL binary
    • Git SCM

Procedure

Setup the repository area


Steps
1

First clone the Git repository.

https://github.com/tenzin-io/vmware-builder

2

Run the prepare_installers.yaml .  This file will download the all vendor ISO files.

3

Go to the installers folder.

4

Create a overrides.pkrvars.yaml file and populate the variables.

config.example.yml
# ESX variables
esx_server    = "vsphere-1"        # ESX server name
esx_username  = "packer"           # ESX user with admin permissions
esx_password  = "password"         # ESX user's password
esx_network   = "VM Network"       # ESX virtual network to create the VM on
esx_datastore = "datastore1"        # ESX datastore to create the VM on

# VM variables
ssh_keys_url = "https://github.com/username.keys"


Do not commit the yaml file into Git, this file contains ESX password information.

Building the virtual machine


Steps
1

The ./builder binary without options will print the usage information.

2

An example argument list to the builder binary.

./builder -o debian -r bullseye -n vm-1

Appendix


DocumentLink
1The vmware-builder Git repositoryhttps://github.com/tenzin-io/vmware-builder
2Hashicorp's Packerhttps://www.packer.io
  • No labels