/terraform-packet-vmware

Deprecated: See https://github.com/equinix/terraform-metal-vsphere

Primary LanguagePythonApache License 2.0Apache-2.0

VMware on Equinix Metal

This repo has Terraform plans to deploy a multi-node vSphere cluster with vSan enabled on Equinix Metal. Follow this simple instructions below and you should be able to go from zero to vSphere in 30 minutes.

Install Terraform

Terraform is just a single binary. Visit their download page, choose your operating system, make the binary executable, and move it into your path.

Here is an example for macOS:

curl -LO https://releases.hashicorp.com/terraform/0.14.5/terraform_0.14.5_darwin_amd64.zip
unzip terraform_0.14.5_darwin_amd64.zip
chmod +x terraform 
sudo mv terraform /usr/local/bin/

Download this project

To download this project and get in the directory, run the following commands:

git clone https://github.com/equinix/terraform-metal-vsphere.git
cd terraform-metal-vsphere

Initialize Terraform

Terraform uses modules to deploy infrastructure. In order to initialize the modules your simply run: terraform init. This should download five modules into a hidden directory .terraform

Setup an S3 compatible object store

You need to use an S3 compatible object store in order to download closed source packages such as vCenter and the vSan SDK. Minio works great for this, which is an open source object store is a workable option.

You will need to layout the S3 structure to look like this:

https://s3.example.com: 
    | 
    |__ vmware 
        | 
        |__ VMware-VCSA-all-6.7.0-14367737.iso
        | 
        |__ vsanapiutils.py
        | 
        |__ vsanmgmtObjects.py

These files can be downloaded from My VMware. Once logged in to "My VMware" the download links are as follows:

You will need to find the two individual Python files in the vSAN SDK zip file and place them in the S3 bucket as shown above.

Modify your variables

There are many variables which can be set to customize your install within vars.tf. The default variables to bring up a 3 node vSphere cluster and linux router using Equinix Metal's c3.medium.x86. Change each default variable at your own risk.

There are some variables you must set with a terraform.tfvars files. You need to set auth_token & organization_id to connect to Equinix Metal and the project_name which will be created in Equinix Metal. We will need an S3 compatible object store to download "Closed Source" packages such as vCenter. You'll provide s3_url, s3_bucket_name, s3_access_key, s3_secret_key as well as the vCenter ISO file name as vcenter_iso_name.

Here is a quick command plus sample values to start file for you (make sure you adjust the variables to match your environment, pay special attention that the vcenter_iso_name matches whats in your bucket):

cat <<EOF >terraform.tfvars 
auth_token = "cefa5c94-e8ee-4577-bff8-1d1edca93ed8" 
organization_id = "42259e34-d300-48b3-b3e1-d5165cd14169" 
project_name = "vmware-metal-project-1"
s3_url = "https://s3.example.com" 
s3_bucket_name = "vmware" 
s3_access_key = "4fa85962-975f-4650-b603-17f1cb9dee10" 
s3_secret_key = "becf3868-3f07-4dbb-a6d5-eacfd7512b09" 
vcenter_iso_name = "VMware-VCSA-all-6.7.0-XXXXXXX.iso" 
EOF 

Deploy the Equinix Metal vSphere cluster

All there is left to do now is to deploy the cluster:

terraform apply --auto-approve 

This should end with output similar to this:

Apply complete! Resources: 50 added, 0 changed, 0 destroyed. 
 
Outputs: 
 
VPN_Endpoint = 139.178.85.49 
VPN_PSK = @U69neoBD2vlGdHbe@o1 
VPN_Pasword = 0!kfeooo?FaAvyZ2 
VPN_User = vm_admin 
vCenter_Appliance_Root_Password = n4$REf6p*oMo2eYr 
vCenter_FQDN = vcva.metal.local 
vCenter_Password = bzN4UE7m3g$DOf@P 
vCenter_Username = Administrator@vsphere.local 

Connect to the Environment

There is an L2TP IPsec VPN setup. There is an L2TP IPsec VPN client for every platform. You'll need to reference your operating system's documentation on how to connect to an L2TP IPsec VPN.

MAC how to configure L2TP IPsec VPN

Chromebook how to configure LT2P IPsec VPN

Make sure to enable all traffic to use the VPN (aka do not enable split tunneling) on your L2TP client.

Some corporate networks block outbound L2TP traffic. If you are experiencing issues connecting, you may try a guest network or personal hotspot.

Cleaning the environment

To clean up a created environment (or a failed one), run terraform destroy --auto-approve.

If this does not work for some reason, you can manually delete each of the resources created in Equinix Metal (including the project) and then delete your terraform state file, rm -f terraform.tfstate.