From 30944f7f82dc37a6fc2b72f985c657a7e2035fae Mon Sep 17 00:00:00 2001 From: Alexander Hosking Date: Wed, 4 Jan 2017 01:29:10 -0500 Subject: [PATCH] A working esxi deployment for base ubuntu 14 node --- ahoskingit/terraform/plex.tf | 49 +++++++++++++++++++ ahoskingit/terraform/terraform.tfstate | 34 +++++++++++++ ahoskingit/terraform/terraform.tfstate.backup | 34 +++++++++++++ ahoskingit/terraform/variables.tf | 4 ++ 4 files changed, 121 insertions(+) create mode 100644 ahoskingit/terraform/plex.tf create mode 100644 ahoskingit/terraform/terraform.tfstate create mode 100644 ahoskingit/terraform/terraform.tfstate.backup create mode 100644 ahoskingit/terraform/variables.tf diff --git a/ahoskingit/terraform/plex.tf b/ahoskingit/terraform/plex.tf new file mode 100644 index 0000000..e48213c --- /dev/null +++ b/ahoskingit/terraform/plex.tf @@ -0,0 +1,49 @@ +# 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/" + + network_interface { + label = "VM Network" + } + + disk { + datastore = "Nas" + template = "ubuntu_14" + } +} diff --git a/ahoskingit/terraform/terraform.tfstate b/ahoskingit/terraform/terraform.tfstate new file mode 100644 index 0000000..1169772 --- /dev/null +++ b/ahoskingit/terraform/terraform.tfstate @@ -0,0 +1,34 @@ +{ + "version": 3, + "terraform_version": "0.7.13", + "serial": 4, + "lineage": "55e8cea6-ab83-4a86-9270-0d029e8cac97", + "modules": [ + { + "path": [ + "root" + ], + "outputs": {}, + "resources": { + "vsphere_folder.plex": { + "type": "vsphere_folder", + "depends_on": [], + "primary": { + "id": "Datacenter/terraform/plex", + "attributes": { + "datacenter": "Datacenter", + "existing_path": "", + "id": "Datacenter/terraform/plex", + "path": "terraform/plex" + }, + "meta": {}, + "tainted": false + }, + "deposed": [], + "provider": "" + } + }, + "depends_on": [] + } + ] +} diff --git a/ahoskingit/terraform/terraform.tfstate.backup b/ahoskingit/terraform/terraform.tfstate.backup new file mode 100644 index 0000000..1169772 --- /dev/null +++ b/ahoskingit/terraform/terraform.tfstate.backup @@ -0,0 +1,34 @@ +{ + "version": 3, + "terraform_version": "0.7.13", + "serial": 4, + "lineage": "55e8cea6-ab83-4a86-9270-0d029e8cac97", + "modules": [ + { + "path": [ + "root" + ], + "outputs": {}, + "resources": { + "vsphere_folder.plex": { + "type": "vsphere_folder", + "depends_on": [], + "primary": { + "id": "Datacenter/terraform/plex", + "attributes": { + "datacenter": "Datacenter", + "existing_path": "", + "id": "Datacenter/terraform/plex", + "path": "terraform/plex" + }, + "meta": {}, + "tainted": false + }, + "deposed": [], + "provider": "" + } + }, + "depends_on": [] + } + ] +} diff --git a/ahoskingit/terraform/variables.tf b/ahoskingit/terraform/variables.tf new file mode 100644 index 0000000..06abd61 --- /dev/null +++ b/ahoskingit/terraform/variables.tf @@ -0,0 +1,4 @@ +# set these puppies on the command line with -var "variable=val" +variable "vsphere_user" {} +variable "vsphere_password" {} +variable "vsphere_server" {}