Deploy OVA w/ default configuration
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Danny Bessems 2021-02-04 09:32:03 +01:00
parent 267ffac40d
commit 2f4035afa7
5 changed files with 70 additions and 9 deletions

View File

@ -19,7 +19,7 @@ steps:
commands:
- |
terraform -chdir=terraform plan \
-var="vsphere_password=$${VSPHERE_PASSWORD}" -var="repo_username=$${REPO_USERNAME}" -var="repo_password=$${REPO_PASSWORD}" \
-var="vsphere_password=$${VSPHERE_PASSWORD}" -var="repo_username=$${REPO_USERNAME}" -var="repo_password=$${REPO_PASSWORD}" -var="adds_password=$${ADDS_PASSWORD}"\
-var-file='vsphere.tfvars' \
-input=false \
-out=terraform.plan
@ -31,6 +31,8 @@ steps:
from_secret: repo_username
REPO_PASSWORD:
from_secret: repo_password
ADDS_PASSWORD:
from_secret: adds_password
# TF_LOG: TRACE
- name: Terraform Apply
image: bv11-cr01.bessems.eu/library/packer-extended

53
terraform/DC01.tf Normal file
View File

@ -0,0 +1,53 @@
resource "vsphere_virtual_machine" "TF-DC01" {
name = "TF-DC01"
resource_pool_id = data.vsphere_resource_pool.pool.id
datastore_id = data.vsphere_datastore.vmdatastore.id
folder = var.vsphere_vmfolder
num_cpus = 2
memory = 4096
network_interface {
network_id = data.vsphere_network.network.id
}
disk {
label = "disk0"
unit_number = 0
size = 40
thin_provisioned = true
}
vapp {
properties = {
# "deployment.type" = "primary"
"guestinfo.hostname" = "TF-DC01"
"guestinfo.ipaddress" = "10.0.0.21"
"guestinfo.prefixlength" = "24"
# "guestinfo.dnsserver" = "0.0.0.0"
"guestinfo.gateway" = "10.0.0.1"
"addsconfig.domainname" = "srv.io"
"addsconfig.netbiosname" = "SRV"
"addsconfig.administratorpw" = var.adds_password
"addsconfig.safemodepw" = var.adds_password
"addsconfig.ntpserver" = "0.pool.ntp.org,1.pool.ntp.org,2.pool.ntp.org"
# "dhcpconfig.startip" = "10.0.0.50"
# "dhcpconfig.endip" = "10.0.0.250"
# "dhcpconfig.subnetmask" = "255.255.255.0"
# "dhcpconfig.gateway" = "10.0.0.1"
# "dhcpconfig.leaseduration" = "01:00:00.00"
}
}
clone {
template_uuid = vsphere_content_library_item.ADDS.id
}
# # This does not actually achieve protection from destruction, see https://github.com/hashicorp/terraform/issues/17599
# lifecycle {
# prevent_destroy = true
# }
}

View File

@ -29,16 +29,16 @@ resource "vsphere_virtual_machine" "TF-SRV01" {
# "deployment.type" = "standalone"
"guestinfo.hostname" = "TF-SRV01"
"guestinfo.administratorpw" = "Secret123!"
"guestinfo.ntpserver" = "0.pool.ntp.org,1.pool.ntp.org,2.pool.ntp.org"
# "guestinfo.administratorpw" = "Secret123!"
# "guestinfo.ntpserver" = "0.pool.ntp.org,1.pool.ntp.org,2.pool.ntp.org"
"guestinfo.ipaddress" = "10.0.0.42"
"guestinfo.prefixlength" = "24"
"guestinfo.dnsserver" = "10.0.0.5"
"guestinfo.dnsserver" = "10.0.0.21"
"guestinfo.gateway" = "10.0.0.1"
"addsconfig.domainname" = ""
"addsconfig.username" = ""
"addsconfig.password" = ""
"addsconfig.domainname" = "srv.io"
"addsconfig.username" = "SRV\\Administrator"
"addsconfig.password" = var.adds_password
}
}
@ -46,6 +46,10 @@ resource "vsphere_virtual_machine" "TF-SRV01" {
template_uuid = vsphere_content_library_item.Server2019.id
}
depends_on = [
vsphere_virtual_machine.TF-DC01
]
# # This does not actually achieve protection from destruction, see https://github.com/hashicorp/terraform/issues/17599
# lifecycle {
# prevent_destroy = true

View File

@ -12,4 +12,6 @@ variable "vsphere_vmfolder" {}
variable "vsphere_network" {}
variable "repo_username" {}
variable "repo_password" {}
variable "repo_password" {}
variable "adds_password" {}

View File

@ -6,4 +6,4 @@ vsphere_hostip = "192.168.11.200"
vsphere_vmdatastore = "Datastore02.SSD"
vsphere_cldatastore = "Datastore01.NAS"
vsphere_vmfolder = "/Terraform"
vsphere_network = "LAN"
vsphere_network = "Isolated"