From 989dd0a84e05ccd28638ea738a1143482a642165 Mon Sep 17 00:00:00 2001 From: Adrien Delorme Date: Tue, 14 Jul 2020 16:22:23 +0200 Subject: [PATCH] almost working --- examples/hcl/linux/build.alpine.pkr.hcl | 21 ++++++++---- examples/hcl/linux/etc/http/alpine-answers | 2 +- examples/hcl/linux/etc/http/alpine-setup.sh | 2 -- .../hcl/linux/etc/http/alpine-vsphere-answers | 22 +++++++++++++ .../hcl/linux/source.virtualbox-iso.pkr.hcl | 2 +- examples/hcl/linux/source.vsphere-iso.pkr.hcl | 33 +++++++++++++++++++ examples/hcl/linux/variables.alpine.pkr.hcl | 31 ++++++++++++++--- 7 files changed, 99 insertions(+), 14 deletions(-) create mode 100644 examples/hcl/linux/etc/http/alpine-vsphere-answers diff --git a/examples/hcl/linux/build.alpine.pkr.hcl b/examples/hcl/linux/build.alpine.pkr.hcl index 0e0e87d45..8e4d1d846 100644 --- a/examples/hcl/linux/build.alpine.pkr.hcl +++ b/examples/hcl/linux/build.alpine.pkr.hcl @@ -3,7 +3,7 @@ build { name = "alpine" description = <" ] } + + +source "vsphere-iso" "base-alpine-amd64" { + vcenter_server = var.vcenter_endpoint + username = var.vcenter_user + password = var.vcenter_password + host = var.esxi_host + insecure_connection = true + + datacenter = var.datacenter_name + datastore = "datastore1" + + ssh_username = "root" + ssh_password = var.alpine_password + + CPUs = 1 + RAM = 512 * 2 + RAM_reserve_all = true + + guest_os_type = "otherLinux64Guest" + + floppy_files = local.floppy_files_alpine_vsphere + + network_adapters { + network = "VM Network" + network_card = "vmxnet3" + } + + storage { + disk_size = 32768 + disk_thin_provisioned = true + } +} diff --git a/examples/hcl/linux/variables.alpine.pkr.hcl b/examples/hcl/linux/variables.alpine.pkr.hcl index 176321a23..8531b43de 100644 --- a/examples/hcl/linux/variables.alpine.pkr.hcl +++ b/examples/hcl/linux/variables.alpine.pkr.hcl @@ -5,13 +5,14 @@ variable "alpine_password" { } locals { - iso_url_alpine_380 = "http://dl-cdn.alpinelinux.org/alpine/v3.8/releases/x86_64/alpine-standard-3.8.0-x86_64.iso" - iso_checksum_url_alpine_380 = "http://dl-cdn.alpinelinux.org/alpine/v3.8/releases/x86_64/alpine-standard-3.8.0-x86_64.iso.sha256" - floppy_files = [ + iso_url_alpine_312 = "http://dl-cdn.alpinelinux.org/alpine/v3.12/releases/x86_64/alpine-virt-3.12.0-x86_64.iso" + iso_checksum_url_alpine_312 = "http://dl-cdn.alpinelinux.org/alpine/v3.12/releases/x86_64/alpine-virt-3.12.0-x86_64.iso.sha256" + floppy_files_alpine = [ "${local.http_directory}/alpine-answers", "${local.http_directory}/alpine-setup.sh" ] - alpine_380_floppy_boot_command = [ + + alpine_312_floppy_boot_command = [ "root", "mount -t vfat /dev/fd0 /media/floppy", "setup-alpine -f /media/floppy/alpine-answers", @@ -29,4 +30,26 @@ locals { "/media/floppy/alpine-setup.sh", ] + floppy_files_alpine_vsphere = [ + "${local.http_directory}/alpine-vsphere-answers", + "${local.http_directory}/alpine-setup.sh" + ] + + alpine_312_floppy_boot_command_vsphere = [ + "root", + "mount -t vfat /dev/fd0 /media/floppy", + "setup-alpine -f /media/floppy/alpine-vsphere-answers", + "${var.alpine_password}", + "${var.alpine_password}", + "", + "y", + "", + "reboot", + "", + "root", + "${var.alpine_password}", + "mount -t vfat /dev/fd0 /media/floppy", + "/media/floppy/alpine-setup.sh", + ] + }