59 lines
1.5 KiB
Terraform
59 lines
1.5 KiB
Terraform
# Everything required to build the Plex server workload goes here
|
|
# ESXI is the intended provider
|
|
provider "vsphere" {
|
|
user = "${var.vsphere_user}"
|
|
password = "${var.vsphere_password}"
|
|
vsphere_server = "${var.vsphere_server}"
|
|
#Because no signed cert
|
|
allow_unverified_ssl = true
|
|
}
|
|
|
|
# Create a folder for the vm
|
|
#resource "vsphere_folder" "plex" {
|
|
# path = "terraform/plex"
|
|
# datacenter = "Datacenter"
|
|
#}
|
|
|
|
# Create Disk File from Template
|
|
#resource "vsphere_file" "ubuntu_disk" {
|
|
# datastore = "datastore1 (1)"
|
|
# datacenter = "Datacenter"
|
|
# source_file = "[Nas] ubuntu_mini_template/ubuntu_mini_template.vmdk"
|
|
# destination_file = "${vsphere_folder.plex.path}/plex.vmdk"
|
|
#}
|
|
|
|
# Create the disk image file
|
|
#resource "vsphere_virtual_disk" "plex_disk" {
|
|
# size = 2
|
|
# vmdk_path = "${vsphere_folder.plex.path}/plex.vmdk"
|
|
# datacenter = "Datacenter"
|
|
# datastore = "datastore1 (1)"
|
|
# type = "thin"
|
|
#}
|
|
|
|
# Create the VM
|
|
resource "vsphere_virtual_machine" "plex" {
|
|
name = "terraform_plex"
|
|
vcpu = 1
|
|
memory = 2048
|
|
resource_pool = "192.168.1.31/"
|
|
cluster = "192.168.1.32"
|
|
datacenter = "Datacenter"
|
|
domain = "vsphere.local"
|
|
skip_customization = true
|
|
|
|
network_interface {
|
|
label = "VM Network"
|
|
adapter_type = "VMXNET 3"
|
|
ipv4_address = "192.168.1.39"
|
|
ipv4_prefix_length = "24"
|
|
ipv4_gateway = "192.168.1.1"
|
|
}
|
|
|
|
disk {
|
|
datastore = "960GB Enterprise"
|
|
type = "thin"
|
|
template = "ubuntu_14"
|
|
}
|
|
}
|