Fix vApp properties & interpolation
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Danny Bessems 2021-02-02 14:03:16 +01:00
parent c01153aa45
commit 60268b7f84
3 changed files with 22 additions and 27 deletions

View File

@ -36,11 +36,18 @@ steps:
image: bv11-cr01.bessems.eu/library/packer-extended
commands:
- |
terraform apply \
-chdir=terraform \
terraform -chdir=terraform apply \
-var="vsphere_password=$${VSPHERE_PASSWORD}" -var="repo_username=$${REPO_USERNAME}" -var="repo_password=$${REPO_PASSWORD}" \
-var-file='vsphere.tfvars' \
-input=false \
-auto-approve \
terraform.plan
environment:
TF_AUTOMATION: yes
VSPHERE_PASSWORD:
from_secret: vsphere_password
REPO_USERNAME:
from_secret: repo_username
REPO_PASSWORD:
from_secret: repo_password
# TF_LOG: TRACE

View File

@ -8,21 +8,21 @@ resource "vsphere_content_library" "library" {
resource "vsphere_content_library_item" "Server2019" {
name = "Windows-Server-2019-LTSC"
library_id = vsphere_content_library.library.id
file_url = "https://{{user `repo_username`}}:{{user `repo_password`}}@sn.itch.fyi/Repository/rel/Windows-Server-2019-LTSC.ova"
file_url = "https://${var.repo_username}:${var.repo_password}@sn.itch.fyi/Repository/rel/Windows-Server-2019-LTSC.ova"
}
resource "vsphere_content_library_item" "ADCS" {
name = "ADCS-appliance"
library_id = vsphere_content_library.library.id
file_url = "https://{{user `repo_username`}}:{{user `repo_password`}}@sn.itch.fyi/Repository/rel/ADCS-appliance.ova"
file_url = "https://${var.repo_username}:${var.repo_password}@sn.itch.fyi/Repository/rel/ADCS-appliance.ova"
}
resource "vsphere_content_library_item" "ADDS" {
name = "ADDS-appliance"
library_id = vsphere_content_library.library.id
file_url = "https://{{user `repo_username`}}:{{user `repo_password`}}@sn.itch.fyi/Repository/rel/ADDS-appliance.ova"
file_url = "https://${var.repo_username}:${var.repo_password}@sn.itch.fyi/Repository/rel/ADDS-appliance.ova"
}
resource "vsphere_content_library_item" "Win10" {
name = "Windows 10"
library_id = vsphere_content_library.library.id
file_url = "https://{{user `repo_username`}}:{{user `repo_password`}}@sn.itch.fyi/Repository/rel/Windows10.ova"
file_url = "https://${var.repo_username}:${var.repo_password}@sn.itch.fyi/Repository/rel/Windows10.ova"
}

View File

@ -1,5 +1,5 @@
resource "vsphere_virtual_machine" "TF-Windows2019" {
name = "TF-Windows2019"
resource "vsphere_virtual_machine" "TF-SRV01" {
name = "TF-SRV01"
resource_pool_id = data.vsphere_resource_pool.pool.id
datastore_id = data.vsphere_datastore.vmdatastore.id
folder = var.vsphere_vmfolder
@ -14,35 +14,23 @@ resource "vsphere_virtual_machine" "TF-Windows2019" {
disk {
label = "disk0"
unit_number = 0
size = 150
size = 40
thin_provisioned = true
}
disk {
label = "disk1"
unit_number = 1
size = 225
size = 25
thin_provisioned = true
}
vapp {
properties = {
"guestinfo.hostname" = "<<vm-hostname>>"
"guestinfo.ipaddress" = "<<vm-ipaddress>>"
"guestinfo.netmask" = "<<vm-netmask>>"
"guestinfo.gateway" = "<<vm-gateway>>"
"guestinfo.dns" = "<<vm-dns>>"
"guestinfo.domain_name" = "<<vm-searchdomain>>"
"guestinfo.ntp" = "<<vm-ntp>>"
"guestinfo.enable_domain_join" = "<<ad-enable-domain-join>>"
"guestinfo.domain_short_name" = "<<ad-netbios>>"
"guestinfo.domain_join_user" = "<<ad-user>>"
"guestinfo.domain_join_password" = "<<ad-password>>"
"guestinfo.domain_controller" = "<<ad-domaincontroller>>"
"guestinfo.viadmin_password" = "<<pass-viadmin>>"
"guestinfo.viuser_password" = "<<pass-viuser>>"
"guestinfo.viservice_password" = "<<pass-viservice>>"
"guestinfo.project_name" = "<<proj-name>>"
"guestinfo.monitor_server" = "<<mon-address>>"
"guestinfo.hostname" = "TF-SRV01"
"guestinfo.ipaddress" = "10.0.0.42"
"guestinfo.prefixlength" = "24"
"guestinfo.dnsserver" = "10.0.0.5"
"guestinfo.gateway" = "10.0.0.1"
}
}