
An additional step-by-step guide can be found here which also details the ESXi installation process: https://clo.ng/blog/detectionlab-on-esxi/
sudo ln -s "/Applications/VMware Fusion.app/Contents/Library/VMware OVF Tool/ovftool" "/usr/local/bin/ovftool"sudo ln -s /Applications/VMware\ OVF\ Tool/ovftool /usr/local/bin/ovftoolpip3 install ansible pywinrm --user or by creating and using a virtual environment.brew install hudochenkov/sshpass/sshpass as brew install sshpass does not allow it to be installed.DetectionLab/ESXi/Packer/variables.json to match your ESXi configuration. The esxi_network_with_dhcp_and_internet variable refers to any ESXi network that will be able to provide DHCP and internet access to the VM while it’s being built in Packer. This is usually VM Network.

If you’re using ESXi 6.x (as opposed to 7.x), remove the following two directives from builders array:
{
"builders": [
{
"vnc_over_websocket": true, <---- Remove
"insecure_connection": true, <---- Remove
"vnc_disable_password": true,
"keep_registered": true,
...
to each of the following files: * DetectionLab/ESXi/Packer/windows_10_esxi.json * DetectionLab/ESXi/Packer/windows_2016_esxi.json * DetectionLab/ESXi/Packer/ubuntu2004_esxi.json
The remaining steps on this page apply to both both ESXi 6.x and 7.x:
DetectionLab/ESXi/Packer directory, run:PACKER_CACHE_DIR=../../Packer/packer_cache packer build -var-file variables.json windows_10_esxi.jsonPACKER_CACHE_DIR=../../Packer/packer_cache packer build -var-file variables.json windows_2016_esxi.jsonPACKER_CACHE_DIR=../../Packer/packer_cache packer build -var-file variables.json ubuntu2004_esxi.jsonThese commands can be run in parallel from three separate terminal sessions.

(1 Minute) Once the Packer builds finish, verify that you now see Windows10, WindowsServer2016, and Ubuntu2004 in your ESXi console

(5 Minutes) In DetectionLab/ESXi, Create a terraform.tfvars file (RECOMMENDED) to override the default variables listed in variables.tf.

(25 Minutes) From DetectionLab/ESXi, run terraform init. The ESXi Terraform provider should install automatically during this step:
```
$ terraform init
Initializing the backend…
Initializing provider plugins… - Finding josenk/esxi versions matching “1.8.0”… - Installing josenk/esxi v1.8.0… - Installed josenk/esxi v1.8.0 (self-signed, key ID A3C2BB2C490C3920)
Partner and community providers are signed by their developers. If you’d like to know more about provider signing, you can read about it here: https://www.terraform.io/docs/plugins/signing.html
Terraform has been successfully initialized!
6. Running terraform apply should then prompt us to create the logger, dc, wef, and win10 instances:
$ terraform apply
Do you want to perform these actions? Terraform will perform the actions described above. Only ‘yes’ will be accepted to approve. ```
If an ESXi server is managed by a vCenter, terraform will fail with: Access to resource settings on the host is restricted to the server that is managing it: xx.xx.xx. To allow terraform to work, a user can SSH into the ESXi server and run:
/etc/init.d/vpxa stop; /etc/init.d/hostd restart
This will disconnect the host from the vCenter. Once the terrafrom is complete, run /etc/init.d/vpxa start to reconnect with the vCenter server.
Once finished, you should see something like the following:

DetectionLab/ESXi/AnsibleDetectionLab/ESXi/Ansible/inventory.yml and replace the IP Addresses with the respective IP Addresses of your ESXi VMs. At times, the Terraform output is unable to derive the IP address of hosts, so you may have to log into the ESXi console to find that information and then enter the IP addresses into inventory.yml

ansible-playbook -v detectionlab.yml. This will provision the hosts one by one using Ansible. If you’d like to provision each host individually in parallel, you can use ansible-playbook -v detectionlab.yml –tags “[logger|dc|wef|win10]” and run each in a separate terminal tab.
If running Ansible causes a fork() related error message, set the following environment variable before running Ansible: export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES. More about this here..

If you run into any issues along the way, please open an issue on Github and I’ll do my best to find a solution.
Note: Run the following commands as a root user or with sudo
logger_bootstrap.sh into individual Ansible tasksansible-playbook -v detectionlab.yml --tags="<hostname>" --start-at-task="taskname"As usual, this work is based off the heavy lifting that others have done. My primary sources for this work were: * Josenk’s Terraform-ESXI-Provider - Without this, there would be no way to deploy DL to ESXi without paying for VSphere. Send him/her some love 💌 * Automate Windows VM Creation and Configuration in vSphere Using Packer, Terraform and Ansible - Dmitry Teslya * Building Virtual Machines with Packer on ESXi 6 - Nick Charlton * The DetectionLab work that juju4 has been doing on Azure and Ansible * lofi hip hop radio - beats to relax/study to 🔉
Thank you to all of the sponsors who made this possible!