Skip to content
This repository has been archived by the owner on Sep 16, 2020. It is now read-only.

vmware-archive/terraforming-vsphere

Repository files navigation

DEPRECATION

This repo is going to be archived. The terraform templates that should be used for deploying an Ops Manager, PAS and/or PKS, can be found at https://github.com/pivotal/paving No PRs or Issues will be responded to here.

Terraforming vSphere

Please note that the master branch is generally unstable. If you are looking for something "tested", please consume one of our releases.

What Does This Do?

You will get a booted ops-manager VM plus some networking.

Looking to setup a different IAAS?

Prerequisites

Your system needs terraform:

brew update
brew install terraform

The vCenter Role must have the following privileges:

  1. Datastore
  2. Folder (all)
  3. Network
  4. Resource
  5. Virtual Machine
  6. vCenter Inventory Service
  7. License

Refer to vSphere Terraform Provider documentation.

Are you using Platform Automation?

Skip the creation of the Ops Manager VM to use Platform Automation. Be sure to include om_vm = false in your vars. If you create your Ops Manager using terraform, you will not be able to manage it with Platform Automation.

Deployment of the infrastructure is still required.

Var File

Copy the stub content below into a file called terraform.tfvars and put it in the root of this project. These vars will be used when you run terraform apply. You should fill in the stub values with the correct content.

env_name              = "some-env"
vcenter_user          = "some-user"
vcenter_password      = "some-password"
vcenter_server        = "some-server"
vcenter_dc            = "some-datacenter"
vcenter_cluster       = "some-cluster"
vcenter_rp            = "some-cluster/some-resource-pool"
vcenter_ds            = "some-datastore"
om_ipv4_address       = "x.x.x.x"
om_netmask0           = "255.x.x.x"
om_gateway            = "x.x.x.x"
om_DNS                = "x.x.x.x"
om_ntp_servers        = "x.x.x.x"
om_admin_password     = "some-password"
om_custom_hostname    = "some-hostname"
vcenter_network       = "some-network"
vcenter_vms           = "some-parent-folder/some-vms-folder"
om_template           = "some-ops-manager-template"

Var Details

  • env_name: (required) Environment name.

  • vsphere_user: (required) Username for vSphere API operations.

  • vsphere_password: (required) Password for vSphere API operations.

  • vsphere_server: (required) vCenter server name for vSphere API operations.

  • vcenter_dc: (required) Datacenter for launching vms.

  • vcenter_cluster: (required) Cluster for launching vms.

  • vcenter_ds: (required) Datastore for the virtual disks.

  • om_ipv4_address: (optional) OpsMgr static IPv4 address. Leave unset if DHCP is desired.

  • om_netmask0: (optional) OpsMgr netmask. Leave unset if DHCP is desired.

  • om_gateway: (optional) OpsMgr gateway. Leave unset if DHCP is desired.

  • om_DNS: (optional) OpsMgr DNS Servers, comma separated. Leave unset if DHCP is desired.

  • om_ntp_servers: (required) OpsMgr NTP Servers, comma separated.

  • om_admin_password: (required) OpsMgr VM password. The username is 'ubuntu'.

  • om_custom_hostname: (optional) OpsMgr Hostname. Default is 'pivotal-ops-manager'.

  • vcenter_network: (required) Label for the network interface.

  • vcenter_vms: (required) Folder for launching vms.

  • vcenter_rp: (optional) Resource Pool for launching vms.

  • om_template: (optional) Ops Manager vm template.

  • om_vmdk: (optional) If not specifying vcenter_template, specify path to a vmdk in the vcenter_ds.

  • allow_unverified_ssl: (optional) Defaults to false. Set to true if your vcenter uses self-signed certs.

Running

Note: please make sure you have created the terraform.tfvars file above as mentioned.

Standing up environment

terraform init
terraform plan -out=plan
terraform apply

Tearing down environment

Note: This will only destroy resources deployed by Terraform. You will need to clean up anything deployed on top of that infrastructure yourself. On a vanilla vSphere deployment, running om delete-installation first will suffice. If you are using PAS with NSX-T, in order to clean up all NSX-T resources you will need to run cf delete-org $orgname for every org in your CF deployment.

terraform destroy