From c2b7f1bf80df96b367749c2480ebef19539a267a Mon Sep 17 00:00:00 2001 From: Adrien Delorme Date: Mon, 13 Jul 2020 10:51:58 +0200 Subject: [PATCH 1/9] move "ubuntu" examples to "linux" --- examples/hcl/{ubuntu => linux}/README.md | 0 examples/hcl/{ubuntu => linux}/build.pkr.hcl | 0 examples/hcl/{ubuntu => linux}/etc/http/preseed.cfg | 0 examples/hcl/{ubuntu => linux}/etc/http/preseed_hardcoded_ip.cfg | 0 examples/hcl/{ubuntu => linux}/etc/scripts/010-update.sh | 0 examples/hcl/{ubuntu => linux}/etc/scripts/020-sshd.sh | 0 examples/hcl/{ubuntu => linux}/etc/scripts/030-networking.sh | 0 examples/hcl/{ubuntu => linux}/etc/scripts/040-sudoers.sh | 0 examples/hcl/{ubuntu => linux}/etc/scripts/050-vagrant.sh | 0 examples/hcl/{ubuntu => linux}/etc/scripts/060-virtualbox.sh | 0 examples/hcl/{ubuntu => linux}/etc/scripts/070-vmware.sh | 0 examples/hcl/{ubuntu => linux}/etc/scripts/080-parallels.sh | 0 examples/hcl/{ubuntu => linux}/etc/scripts/090-hyperv.sh | 0 examples/hcl/{ubuntu => linux}/etc/scripts/100-cleanup.sh | 0 examples/hcl/{ubuntu => linux}/etc/scripts/110-minimize.sh | 0 examples/hcl/{ubuntu => linux}/source.esxi-vmware-iso.pkr.hcl | 0 examples/hcl/{ubuntu => linux}/source.parallels-iso.pkr.hcl | 0 examples/hcl/{ubuntu => linux}/source.qemu.pkr.hcl | 0 examples/hcl/{ubuntu => linux}/source.virtualbox-iso.pkr.hcl | 0 examples/hcl/{ubuntu => linux}/source.vmware-iso.pkr.hcl | 0 examples/hcl/{ubuntu => linux}/source.vsphere-iso.pkr.hcl | 0 examples/hcl/{ubuntu => linux}/variables.16.04.pkr.hcl | 0 examples/hcl/{ubuntu => linux}/variables.18.04.pkr.hcl | 0 examples/hcl/{ubuntu => linux}/variables.common.pkr.hcl | 0 24 files changed, 0 insertions(+), 0 deletions(-) rename examples/hcl/{ubuntu => linux}/README.md (100%) rename examples/hcl/{ubuntu => linux}/build.pkr.hcl (100%) rename examples/hcl/{ubuntu => linux}/etc/http/preseed.cfg (100%) rename examples/hcl/{ubuntu => linux}/etc/http/preseed_hardcoded_ip.cfg (100%) rename examples/hcl/{ubuntu => linux}/etc/scripts/010-update.sh (100%) rename examples/hcl/{ubuntu => linux}/etc/scripts/020-sshd.sh (100%) rename examples/hcl/{ubuntu => linux}/etc/scripts/030-networking.sh (100%) rename examples/hcl/{ubuntu => linux}/etc/scripts/040-sudoers.sh (100%) rename examples/hcl/{ubuntu => linux}/etc/scripts/050-vagrant.sh (100%) rename examples/hcl/{ubuntu => linux}/etc/scripts/060-virtualbox.sh (100%) rename examples/hcl/{ubuntu => linux}/etc/scripts/070-vmware.sh (100%) rename examples/hcl/{ubuntu => linux}/etc/scripts/080-parallels.sh (100%) rename examples/hcl/{ubuntu => linux}/etc/scripts/090-hyperv.sh (100%) rename examples/hcl/{ubuntu => linux}/etc/scripts/100-cleanup.sh (100%) rename examples/hcl/{ubuntu => linux}/etc/scripts/110-minimize.sh (100%) rename examples/hcl/{ubuntu => linux}/source.esxi-vmware-iso.pkr.hcl (100%) rename examples/hcl/{ubuntu => linux}/source.parallels-iso.pkr.hcl (100%) rename examples/hcl/{ubuntu => linux}/source.qemu.pkr.hcl (100%) rename examples/hcl/{ubuntu => linux}/source.virtualbox-iso.pkr.hcl (100%) rename examples/hcl/{ubuntu => linux}/source.vmware-iso.pkr.hcl (100%) rename examples/hcl/{ubuntu => linux}/source.vsphere-iso.pkr.hcl (100%) rename examples/hcl/{ubuntu => linux}/variables.16.04.pkr.hcl (100%) rename examples/hcl/{ubuntu => linux}/variables.18.04.pkr.hcl (100%) rename examples/hcl/{ubuntu => linux}/variables.common.pkr.hcl (100%) diff --git a/examples/hcl/ubuntu/README.md b/examples/hcl/linux/README.md similarity index 100% rename from examples/hcl/ubuntu/README.md rename to examples/hcl/linux/README.md diff --git a/examples/hcl/ubuntu/build.pkr.hcl b/examples/hcl/linux/build.pkr.hcl similarity index 100% rename from examples/hcl/ubuntu/build.pkr.hcl rename to examples/hcl/linux/build.pkr.hcl diff --git a/examples/hcl/ubuntu/etc/http/preseed.cfg b/examples/hcl/linux/etc/http/preseed.cfg similarity index 100% rename from examples/hcl/ubuntu/etc/http/preseed.cfg rename to examples/hcl/linux/etc/http/preseed.cfg diff --git a/examples/hcl/ubuntu/etc/http/preseed_hardcoded_ip.cfg b/examples/hcl/linux/etc/http/preseed_hardcoded_ip.cfg similarity index 100% rename from examples/hcl/ubuntu/etc/http/preseed_hardcoded_ip.cfg rename to examples/hcl/linux/etc/http/preseed_hardcoded_ip.cfg diff --git a/examples/hcl/ubuntu/etc/scripts/010-update.sh b/examples/hcl/linux/etc/scripts/010-update.sh similarity index 100% rename from examples/hcl/ubuntu/etc/scripts/010-update.sh rename to examples/hcl/linux/etc/scripts/010-update.sh diff --git a/examples/hcl/ubuntu/etc/scripts/020-sshd.sh b/examples/hcl/linux/etc/scripts/020-sshd.sh similarity index 100% rename from examples/hcl/ubuntu/etc/scripts/020-sshd.sh rename to examples/hcl/linux/etc/scripts/020-sshd.sh diff --git a/examples/hcl/ubuntu/etc/scripts/030-networking.sh b/examples/hcl/linux/etc/scripts/030-networking.sh similarity index 100% rename from examples/hcl/ubuntu/etc/scripts/030-networking.sh rename to examples/hcl/linux/etc/scripts/030-networking.sh diff --git a/examples/hcl/ubuntu/etc/scripts/040-sudoers.sh b/examples/hcl/linux/etc/scripts/040-sudoers.sh similarity index 100% rename from examples/hcl/ubuntu/etc/scripts/040-sudoers.sh rename to examples/hcl/linux/etc/scripts/040-sudoers.sh diff --git a/examples/hcl/ubuntu/etc/scripts/050-vagrant.sh b/examples/hcl/linux/etc/scripts/050-vagrant.sh similarity index 100% rename from examples/hcl/ubuntu/etc/scripts/050-vagrant.sh rename to examples/hcl/linux/etc/scripts/050-vagrant.sh diff --git a/examples/hcl/ubuntu/etc/scripts/060-virtualbox.sh b/examples/hcl/linux/etc/scripts/060-virtualbox.sh similarity index 100% rename from examples/hcl/ubuntu/etc/scripts/060-virtualbox.sh rename to examples/hcl/linux/etc/scripts/060-virtualbox.sh diff --git a/examples/hcl/ubuntu/etc/scripts/070-vmware.sh b/examples/hcl/linux/etc/scripts/070-vmware.sh similarity index 100% rename from examples/hcl/ubuntu/etc/scripts/070-vmware.sh rename to examples/hcl/linux/etc/scripts/070-vmware.sh diff --git a/examples/hcl/ubuntu/etc/scripts/080-parallels.sh b/examples/hcl/linux/etc/scripts/080-parallels.sh similarity index 100% rename from examples/hcl/ubuntu/etc/scripts/080-parallels.sh rename to examples/hcl/linux/etc/scripts/080-parallels.sh diff --git a/examples/hcl/ubuntu/etc/scripts/090-hyperv.sh b/examples/hcl/linux/etc/scripts/090-hyperv.sh similarity index 100% rename from examples/hcl/ubuntu/etc/scripts/090-hyperv.sh rename to examples/hcl/linux/etc/scripts/090-hyperv.sh diff --git a/examples/hcl/ubuntu/etc/scripts/100-cleanup.sh b/examples/hcl/linux/etc/scripts/100-cleanup.sh similarity index 100% rename from examples/hcl/ubuntu/etc/scripts/100-cleanup.sh rename to examples/hcl/linux/etc/scripts/100-cleanup.sh diff --git a/examples/hcl/ubuntu/etc/scripts/110-minimize.sh b/examples/hcl/linux/etc/scripts/110-minimize.sh similarity index 100% rename from examples/hcl/ubuntu/etc/scripts/110-minimize.sh rename to examples/hcl/linux/etc/scripts/110-minimize.sh diff --git a/examples/hcl/ubuntu/source.esxi-vmware-iso.pkr.hcl b/examples/hcl/linux/source.esxi-vmware-iso.pkr.hcl similarity index 100% rename from examples/hcl/ubuntu/source.esxi-vmware-iso.pkr.hcl rename to examples/hcl/linux/source.esxi-vmware-iso.pkr.hcl diff --git a/examples/hcl/ubuntu/source.parallels-iso.pkr.hcl b/examples/hcl/linux/source.parallels-iso.pkr.hcl similarity index 100% rename from examples/hcl/ubuntu/source.parallels-iso.pkr.hcl rename to examples/hcl/linux/source.parallels-iso.pkr.hcl diff --git a/examples/hcl/ubuntu/source.qemu.pkr.hcl b/examples/hcl/linux/source.qemu.pkr.hcl similarity index 100% rename from examples/hcl/ubuntu/source.qemu.pkr.hcl rename to examples/hcl/linux/source.qemu.pkr.hcl diff --git a/examples/hcl/ubuntu/source.virtualbox-iso.pkr.hcl b/examples/hcl/linux/source.virtualbox-iso.pkr.hcl similarity index 100% rename from examples/hcl/ubuntu/source.virtualbox-iso.pkr.hcl rename to examples/hcl/linux/source.virtualbox-iso.pkr.hcl diff --git a/examples/hcl/ubuntu/source.vmware-iso.pkr.hcl b/examples/hcl/linux/source.vmware-iso.pkr.hcl similarity index 100% rename from examples/hcl/ubuntu/source.vmware-iso.pkr.hcl rename to examples/hcl/linux/source.vmware-iso.pkr.hcl diff --git a/examples/hcl/ubuntu/source.vsphere-iso.pkr.hcl b/examples/hcl/linux/source.vsphere-iso.pkr.hcl similarity index 100% rename from examples/hcl/ubuntu/source.vsphere-iso.pkr.hcl rename to examples/hcl/linux/source.vsphere-iso.pkr.hcl diff --git a/examples/hcl/ubuntu/variables.16.04.pkr.hcl b/examples/hcl/linux/variables.16.04.pkr.hcl similarity index 100% rename from examples/hcl/ubuntu/variables.16.04.pkr.hcl rename to examples/hcl/linux/variables.16.04.pkr.hcl diff --git a/examples/hcl/ubuntu/variables.18.04.pkr.hcl b/examples/hcl/linux/variables.18.04.pkr.hcl similarity index 100% rename from examples/hcl/ubuntu/variables.18.04.pkr.hcl rename to examples/hcl/linux/variables.18.04.pkr.hcl diff --git a/examples/hcl/ubuntu/variables.common.pkr.hcl b/examples/hcl/linux/variables.common.pkr.hcl similarity index 100% rename from examples/hcl/ubuntu/variables.common.pkr.hcl rename to examples/hcl/linux/variables.common.pkr.hcl From 715c6d3a860b46083da35012fd7be8e4464f5ea1 Mon Sep 17 00:00:00 2001 From: Adrien Delorme Date: Mon, 13 Jul 2020 12:31:20 +0200 Subject: [PATCH 2/9] add alpine example for virtualbox-iso --- examples/hcl/linux/build.alpine.pkr.hcl | 28 ++++++++++++++++ .../{build.pkr.hcl => build.ubuntu.pkr.hcl} | 0 examples/hcl/linux/etc/http/alpine-answers | 15 +++++++++ examples/hcl/linux/etc/http/alpine-setup.sh | 19 +++++++++++ .../hcl/linux/source.virtualbox-iso.pkr.hcl | 11 +++++++ examples/hcl/linux/variables.alpine.pkr.hcl | 33 +++++++++++++++++++ 6 files changed, 106 insertions(+) create mode 100644 examples/hcl/linux/build.alpine.pkr.hcl rename examples/hcl/linux/{build.pkr.hcl => build.ubuntu.pkr.hcl} (100%) create mode 100644 examples/hcl/linux/etc/http/alpine-answers create mode 100644 examples/hcl/linux/etc/http/alpine-setup.sh create mode 100644 examples/hcl/linux/variables.alpine.pkr.hcl diff --git a/examples/hcl/linux/build.alpine.pkr.hcl b/examples/hcl/linux/build.alpine.pkr.hcl new file mode 100644 index 000000000..4b90ce38f --- /dev/null +++ b/examples/hcl/linux/build.alpine.pkr.hcl @@ -0,0 +1,28 @@ + +build { + name = "alpine" + description = </usr/local/bin/shutdown <", + "mount -t vfat /dev/fd0 /media/floppy", + "setup-alpine -f /media/floppy/alpine-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", + "reboot", + ] + +} \ No newline at end of file From 77411107c2224e9538b0b6b5f61983e9484b1b8f Mon Sep 17 00:00:00 2001 From: Adrien Delorme Date: Mon, 13 Jul 2020 12:34:00 +0200 Subject: [PATCH 3/9] Update variables.alpine.pkr.hcl --- examples/hcl/linux/variables.alpine.pkr.hcl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/hcl/linux/variables.alpine.pkr.hcl b/examples/hcl/linux/variables.alpine.pkr.hcl index 471a98ee0..699563541 100644 --- a/examples/hcl/linux/variables.alpine.pkr.hcl +++ b/examples/hcl/linux/variables.alpine.pkr.hcl @@ -30,4 +30,4 @@ locals { "reboot", ] -} \ No newline at end of file +} From cd0f72a7b66d53c52e97b525a2b9c583f3a39f62 Mon Sep 17 00:00:00 2001 From: Adrien Delorme Date: Mon, 13 Jul 2020 12:49:07 +0200 Subject: [PATCH 4/9] alpine example: restart ssh server instead of rebooting --- examples/hcl/linux/build.alpine.pkr.hcl | 1 - examples/hcl/linux/etc/http/alpine-setup.sh | 4 ++++ examples/hcl/linux/variables.alpine.pkr.hcl | 1 - 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/examples/hcl/linux/build.alpine.pkr.hcl b/examples/hcl/linux/build.alpine.pkr.hcl index 4b90ce38f..dc7a8c80c 100644 --- a/examples/hcl/linux/build.alpine.pkr.hcl +++ b/examples/hcl/linux/build.alpine.pkr.hcl @@ -21,7 +21,6 @@ EOF boot_wait = "10s" } - provisioner "shell" { inline = ["echo hi"] } diff --git a/examples/hcl/linux/etc/http/alpine-setup.sh b/examples/hcl/linux/etc/http/alpine-setup.sh index 8c73c0f80..9b286f332 100644 --- a/examples/hcl/linux/etc/http/alpine-setup.sh +++ b/examples/hcl/linux/etc/http/alpine-setup.sh @@ -13,7 +13,11 @@ poweroff EOF chmod +x /usr/local/bin/shutdown +ifconfig eth0 up && udhcpc -i eth0 + sed -i "/#PermitRootLogin/c\PermitRootLogin yes" /etc/ssh/sshd_config sed -i "/#PasswordAuthentication/c\PasswordAuthentication yes" /etc/ssh/sshd_config mkdir ~/.ssh # copy ssy key ? + +/etc/init.d/sshd restart \ No newline at end of file diff --git a/examples/hcl/linux/variables.alpine.pkr.hcl b/examples/hcl/linux/variables.alpine.pkr.hcl index 699563541..176321a23 100644 --- a/examples/hcl/linux/variables.alpine.pkr.hcl +++ b/examples/hcl/linux/variables.alpine.pkr.hcl @@ -27,7 +27,6 @@ locals { "${var.alpine_password}", "mount -t vfat /dev/fd0 /media/floppy", "/media/floppy/alpine-setup.sh", - "reboot", ] } From 918696c07a15fd2c8fce2c03569719799648d9ef Mon Sep 17 00:00:00 2001 From: Adrien Delorme Date: Mon, 13 Jul 2020 12:50:46 +0200 Subject: [PATCH 5/9] Update alpine-setup.sh --- examples/hcl/linux/etc/http/alpine-setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/hcl/linux/etc/http/alpine-setup.sh b/examples/hcl/linux/etc/http/alpine-setup.sh index 9b286f332..4b9b013c7 100644 --- a/examples/hcl/linux/etc/http/alpine-setup.sh +++ b/examples/hcl/linux/etc/http/alpine-setup.sh @@ -20,4 +20,4 @@ sed -i "/#PasswordAuthentication/c\PasswordAuthentication yes" /etc/ssh/sshd_con mkdir ~/.ssh # copy ssy key ? -/etc/init.d/sshd restart \ No newline at end of file +/etc/init.d/sshd restart From 2664e72682e75e50a5fe92cd28436730936314c2 Mon Sep 17 00:00:00 2001 From: Adrien Delorme Date: Mon, 13 Jul 2020 15:27:55 +0200 Subject: [PATCH 6/9] alpine: move floppy file to general folder --- examples/hcl/linux/build.alpine.pkr.hcl | 1 - examples/hcl/linux/source.virtualbox-iso.pkr.hcl | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/hcl/linux/build.alpine.pkr.hcl b/examples/hcl/linux/build.alpine.pkr.hcl index dc7a8c80c..0e0e87d45 100644 --- a/examples/hcl/linux/build.alpine.pkr.hcl +++ b/examples/hcl/linux/build.alpine.pkr.hcl @@ -17,7 +17,6 @@ EOF iso_checksum = "file:${local.iso_checksum_url_alpine_380}" output_directory = "virtualbox_iso_alpine_380_amd64" boot_command = local.alpine_380_floppy_boot_command - floppy_files = local.floppy_files boot_wait = "10s" } diff --git a/examples/hcl/linux/source.virtualbox-iso.pkr.hcl b/examples/hcl/linux/source.virtualbox-iso.pkr.hcl index f772c6889..da7c88cc1 100644 --- a/examples/hcl/linux/source.virtualbox-iso.pkr.hcl +++ b/examples/hcl/linux/source.virtualbox-iso.pkr.hcl @@ -22,4 +22,5 @@ source "virtualbox-iso" "base-alpine-amd64" { ssh_password = var.alpine_password ssh_wait_timeout = "60m" shutdown_command = "poweroff" + floppy_files = local.floppy_files } From 989dd0a84e05ccd28638ea738a1143482a642165 Mon Sep 17 00:00:00 2001 From: Adrien Delorme Date: Tue, 14 Jul 2020 16:22:23 +0200 Subject: [PATCH 7/9] 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", + ] + } From 81f7fd69559d86cfa0ee5511593d4512ac013e3c Mon Sep 17 00:00:00 2001 From: Adrien Delorme Date: Tue, 14 Jul 2020 17:04:27 +0200 Subject: [PATCH 8/9] better timing --- examples/hcl/linux/variables.alpine.pkr.hcl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/examples/hcl/linux/variables.alpine.pkr.hcl b/examples/hcl/linux/variables.alpine.pkr.hcl index 8531b43de..62c0e47cb 100644 --- a/examples/hcl/linux/variables.alpine.pkr.hcl +++ b/examples/hcl/linux/variables.alpine.pkr.hcl @@ -41,15 +41,16 @@ locals { "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", + "", ] } From 1b91252b238f86a5e590f4b44aa904d41365f56d Mon Sep 17 00:00:00 2001 From: Adrien Delorme Date: Wed, 15 Jul 2020 11:53:55 +0200 Subject: [PATCH 9/9] add alpine esxi example --- examples/hcl/linux/build.alpine.pkr.hcl | 7 ++++++ .../hcl/linux/source.esxi-vmware-iso.pkr.hcl | 25 +++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/examples/hcl/linux/build.alpine.pkr.hcl b/examples/hcl/linux/build.alpine.pkr.hcl index 8e4d1d846..156a1d159 100644 --- a/examples/hcl/linux/build.alpine.pkr.hcl +++ b/examples/hcl/linux/build.alpine.pkr.hcl @@ -29,6 +29,13 @@ EOF boot_wait = "10s" } + source "source.vmware-iso.esxi-base-alpine-amd64" { + name = "3.12-from-esxi" + iso_url = local.iso_url_alpine_312 + iso_checksum = "file:${local.iso_checksum_url_alpine_312}" + boot_command = local.alpine_312_floppy_boot_command_vsphere + } + provisioner "shell" { inline = ["echo hi"] } diff --git a/examples/hcl/linux/source.esxi-vmware-iso.pkr.hcl b/examples/hcl/linux/source.esxi-vmware-iso.pkr.hcl index 53257272b..eb6393a93 100644 --- a/examples/hcl/linux/source.esxi-vmware-iso.pkr.hcl +++ b/examples/hcl/linux/source.esxi-vmware-iso.pkr.hcl @@ -22,3 +22,28 @@ source "vmware-iso" "esxi-base-ubuntu-amd64" { remote_datastore = var.datastore remote_private_key_file = var.remote_private_key_file_path } + +source "vmware-iso" "esxi-base-alpine-amd64" { + headless = var.headless + boot_wait = "10s" + guest_os_type = "otherLinux64Guest" + floppy_files = local.floppy_files_alpine_vsphere + ssh_port = 22 + ssh_timeout = "10000s" + ssh_username = "root" + ssh_password = var.alpine_password + tools_upload_flavor = "linux" + shutdown_command = "poweroff" + vmx_data = { + "cpuid.coresPerSocket" = "1" + "ethernet0.pciSlotNumber" = "32" + } + vmx_remove_ethernet_interfaces = true + + remote_type = "esx5" + remote_host = var.esxi_host + remote_username = var.esxi_user + remote_password = var.esxi_password + remote_datastore = var.datastore + remote_private_key_file = var.remote_private_key_file_path +}