Background

Build a virtual machine on an VMware ESXi hypervisor.

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

Pre-requisites

Procedure

Setup the repository area


Steps
1

First clone the Git repository.

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

2

Perform make at the root of the repository.

3

Go into the installer_blobs  folder.

4

Run the ./get_files.yml ansible playbook.

5

Run the ./mount_iso_folders.yml ansible playbook.

This ansible playbook mounts ISO files on to an iso_contents folder.


6

Go into the config  folder.

7

Create a config yaml file that describes the ESXi host.  

---
build:
  server: vsphere-1  # ESX host
  user: builder # ESX user with admin permissions
  password: Secret123 # ESX user's password
  network: VM Network # virtual network to create the VM on
  datastore: nvme1 # the datastore to create the VM on

vm:
  user: sysuser # the VM user
  password: Welcome123 # the VM password

blob:
  dir: installer_blobs # the folder path of the vendor files


Do not commit the config yaml file into Git, this file contains authentication information.


Building the virtual machine


Steps
1

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

Usage of ./builder:
  -c string
        Config file path.
  -n string
        Virtual machine name.
  -o string
        Operating system. Examples: debian, centos, ubuntu
  -r string
        Operating system release name. Examples: bullseye, 8-stream, focal
  -version
        Print program version.


2

An example argument list to the builder binary.

./builder -c config/vs-2.nvme1.yaml -n server-1 -o debian -r bullseye



Appendix


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