I am working on building an image that will house default items in a secondary drive.
For instance:
C:\ Main OS
E:\ Secondary Drive.
I have it where it will build the drive, but when running packer, I am not sure how to get it to install the OS on the C: on its own, it prompts for selection.
Here is the packer Cod I have so far, I am not sure how to change the ISO paths to install on the correct drive. Could this be in the autounattend.xml?
source "vsphere-iso" "SQL" {
CPUs = "${var.vm-cpu-num}"
RAM = "${var.vm-mem-size}"
RAM_reserve_all = true
cluster = "${var.vsphere-cluster}"
communicator = "winrm"
convert_to_template = "true"
datacenter = "${var.vsphere-datacenter}"
datastore = "${var.vsphere-datastore}"
firmware = "bios"
floppy_files = ["autounattend.xml", "./scripts/enable-rdp.cmd", "./scripts/enable-winrm.ps1", "./scripts/install-vm-tools.ps1", "./scripts/set-temp.ps1", "./drivers/pvscsi.cat", "./drivers/pvscsi.inf", "./drivers/pvscsi.sys", "./drivers/txtsetup.oem", "./scripts/sqlSetup.ps1", "./scripts/install-bginfo.ps1", "./distribution/bginfo.zip"]
folder = "${var.vsphere-folder}"
guest_os_type = "windows9Server64Guest"
insecure_connection = "true"
iso_paths = ["${var.os_iso_path}", "[] /usr/lib/vmware/isoimages/windows.iso"]
cd_files = ["${var.cd_iso_path}"]
password = "${var.vsphere-password}"
remove_cdrom = false
username = "${var.vsphere-user}"
vcenter_server = "${var.vsphere-server}"
vm_name = "${var.vm-name-sql}-${legacy_isotime("20061020304")}"
winrm_password = "${var.winadmin-password}"
winrm_timeout = "2h"
winrm_username = "Administrator"
disk_controller_type = ["pvscsi"]
network_adapters{
network = "${var.vsphere-network}"
network_card = "vmxnet3"
}
storage{
disk_size = "${var.vm-disk-size}"
disk_thin_provisioned = true
disk_controller_index = 0
}
storage{
disk_size = "${var.vm-disk-size}"
disk_thin_provisioned = true
disk_controller_index = 0
}
}
# a build block invokes sources and runs provisioning steps on them. The
# documentation for build blocks can be found here:
# https://www.packer.io/docs/templates/hcl_templates/blocks/build
build {
sources = ["source.vsphere-iso.SQL"]
provisioner "powershell" {
inline = ["A:/install-bginfo.ps1"]
}
provisioner "powershell" {
inline = ["A:/sqlSetup.ps1"]
}
provisioner "windows-update" {
search_criteria = "IsInstalled=0"
filters = [
"exclude:$_.Title -like '*Preview*'",
"include:$true",
]
update_limit = 25
}
}