From 7ad08cdc10211821793e391068366fc108981dd0 Mon Sep 17 00:00:00 2001 From: Ryan Johnson Date: Wed, 29 Sep 2021 18:47:45 -0400 Subject: [PATCH] Refactor manifest output location. (#66) - Add default `manifests/` directory. - Update `.gitignore` to ignore `manifests/*.json`. - Add locals for `path_manifest`. - Update post-processor to use `${local.path_manifest}`. Also: * Restore `autounattend.pkrtpl.hcl` mistakingly deleted in #64. * Update `linux-*.pkrvars.hcl` formatting --- .gitignore | 6 +- .../linux-almalinux.auto.pkrvars.hcl | 4 +- .../linux/almalinux-8/linux-almalinux.pkr.hcl | 5 +- .../linux-centos-linux.auto.pkrvars.hcl | 4 +- .../centos-linux-8/linux-centos-linux.pkr.hcl | 5 +- builds/linux/centos-linux-8/output/.gitkeep | 1 - .../linux-centos-stream.auto.pkrvars.hcl | 4 +- .../linux-centos-stream.pkr.hcl | 5 +- builds/linux/centos-stream-8/output/.gitkeep | 1 - .../photon-4/linux-photon.auto.pkrvars.hcl | 4 +- builds/linux/photon-4/linux-photon.pkr.hcl | 11 +- builds/linux/photon-4/output/.gitkeep | 1 - .../linux-redhat-linux.auto.pkrvars.hcl | 4 +- .../redhat-linux-8/linux-redhat-linux.pkr.hcl | 5 +- builds/linux/redhat-linux-8/output/.gitkeep | 1 - .../linux-rocky-linux.auto.pkrvars.hcl | 4 +- .../rocky-linux-8/linux-rocky-linux.pkr.hcl | 5 +- builds/linux/rocky-linux-8/output/.gitkeep | 1 - .../linux-ubuntu-server.auto.pkrvars.hcl | 4 +- .../linux-ubuntu-server.pkr.hcl | 15 +- .../ubuntu-server-18-04-lts/output/.gitkeep | 1 - .../linux-ubuntu-server.auto.pkrvars.hcl | 4 +- .../linux-ubuntu-server.pkr.hcl | 5 +- .../ubuntu-server-20-04-lts/output/.gitkeep | 1 - .../data/autounattend.pkrtpl.hcl | 202 ++++++++++++++++++ .../windows-server-2016/output/.gitkeep | 1 - .../windows-server.pkr.hcl | 25 +-- .../windows-server-2019/output/.gitkeep | 1 - .../windows-server.pkr.hcl | 41 ++-- .../windows-server-2022/output/.gitkeep | 1 - .../windows-server.pkr.hcl | 25 +-- .../almalinux-8/output => manifests}/.gitkeep | 0 32 files changed, 301 insertions(+), 96 deletions(-) delete mode 100644 builds/linux/centos-linux-8/output/.gitkeep delete mode 100644 builds/linux/centos-stream-8/output/.gitkeep delete mode 100644 builds/linux/photon-4/output/.gitkeep delete mode 100644 builds/linux/redhat-linux-8/output/.gitkeep delete mode 100644 builds/linux/rocky-linux-8/output/.gitkeep delete mode 100644 builds/linux/ubuntu-server-18-04-lts/output/.gitkeep delete mode 100644 builds/linux/ubuntu-server-20-04-lts/output/.gitkeep create mode 100644 builds/windows/windows-server-2016/data/autounattend.pkrtpl.hcl delete mode 100644 builds/windows/windows-server-2016/output/.gitkeep delete mode 100644 builds/windows/windows-server-2019/output/.gitkeep delete mode 100644 builds/windows/windows-server-2022/output/.gitkeep rename {builds/linux/almalinux-8/output => manifests}/.gitkeep (100%) diff --git a/.gitignore b/.gitignore index bdc7b256b..65aedfa63 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,8 @@ crash.log # Configurations ## Ignore custom configurations. config/ -## Ignore certificatess. +## Ignore certificates. **/.crt -**/.p7b \ No newline at end of file +**/.p7b +## Ignore manifests. +manifests/*.json \ No newline at end of file diff --git a/builds/linux/almalinux-8/linux-almalinux.auto.pkrvars.hcl b/builds/linux/almalinux-8/linux-almalinux.auto.pkrvars.hcl index b6a4e9b58..bebde9810 100644 --- a/builds/linux/almalinux-8/linux-almalinux.auto.pkrvars.hcl +++ b/builds/linux/almalinux-8/linux-almalinux.auto.pkrvars.hcl @@ -33,8 +33,8 @@ iso_file = "iso-linux-almalinux-8.iso" iso_checksum = "44f56b309fa0cccf41f4d8a5ca3c9b91bb7da510ff8d8faf93fadef9262df872cb824aa7499c5ada5a7ae743be6b38261ed458c465d84e2504e38ca6f05107d7" // Boot Settings -vm_boot_order = "disk,cdrom" -vm_boot_wait = "2s" +vm_boot_order = "disk,cdrom" +vm_boot_wait = "2s" // Communicator Settings communicator_port = 22 diff --git a/builds/linux/almalinux-8/linux-almalinux.pkr.hcl b/builds/linux/almalinux-8/linux-almalinux.pkr.hcl index 6c38a2d25..fd5786a8c 100644 --- a/builds/linux/almalinux-8/linux-almalinux.pkr.hcl +++ b/builds/linux/almalinux-8/linux-almalinux.pkr.hcl @@ -20,7 +20,8 @@ packer { // Defines the local variables. locals { - buildtime = formatdate("YYYY-MM-DD hh:mm ZZZ", timestamp()) + buildtime = formatdate("YYYY-MM-DD hh:mm ZZZ", timestamp()) + path_manifest = "../../../manifests/" data_source_content = { "/ks.cfg" = templatefile("${path.cwd}/data/ks.pkrtpl.hcl", { build_username = var.build_username, build_password_encrypted = var.build_password_encrypted, vm_guest_os_language = var.vm_guest_os_language, vm_guest_os_keyboard = var.vm_guest_os_keyboard, vm_guest_os_timezone = var.vm_guest_os_timezone }) } @@ -132,7 +133,7 @@ build { } post-processor "manifest" { - output = "${path.cwd}/output/${local.buildtime}-${var.vm_guest_os_family}-${var.vm_guest_os_vendor}.json" + output = "${local.path_manifest}${local.buildtime}-${var.vm_guest_os_family}-${var.vm_guest_os_vendor}.json" strip_path = false } } \ No newline at end of file diff --git a/builds/linux/centos-linux-8/linux-centos-linux.auto.pkrvars.hcl b/builds/linux/centos-linux-8/linux-centos-linux.auto.pkrvars.hcl index 41946fc5f..a61b6cb7f 100644 --- a/builds/linux/centos-linux-8/linux-centos-linux.auto.pkrvars.hcl +++ b/builds/linux/centos-linux-8/linux-centos-linux.auto.pkrvars.hcl @@ -33,8 +33,8 @@ iso_file = "iso-linux-centos-linux-8.iso" iso_checksum = "ff1164dc26ba47616f2b26a18158398a7d7930487770a8bb9e573d5758e01255ebc11db68c22976abe684a857083a0fae445e9d41d11a24a2073cdb1b500ae9a" // Boot Settings -vm_boot_order = "disk,cdrom" -vm_boot_wait = "2s" +vm_boot_order = "disk,cdrom" +vm_boot_wait = "2s" // Communicator Settings communicator_port = 22 diff --git a/builds/linux/centos-linux-8/linux-centos-linux.pkr.hcl b/builds/linux/centos-linux-8/linux-centos-linux.pkr.hcl index 255746d53..ca457b6df 100644 --- a/builds/linux/centos-linux-8/linux-centos-linux.pkr.hcl +++ b/builds/linux/centos-linux-8/linux-centos-linux.pkr.hcl @@ -20,7 +20,8 @@ packer { // Defines the local variables. locals { - buildtime = formatdate("YYYY-MM-DD hh:mm ZZZ", timestamp()) + buildtime = formatdate("YYYY-MM-DD hh:mm ZZZ", timestamp()) + path_manifest = "../../../manifests/" data_source_content = { "/ks.cfg" = templatefile("${path.cwd}/data/ks.pkrtpl.hcl", { build_username = var.build_username, build_password_encrypted = var.build_password_encrypted, vm_guest_os_language = var.vm_guest_os_language, vm_guest_os_keyboard = var.vm_guest_os_keyboard, vm_guest_os_timezone = var.vm_guest_os_timezone }) } @@ -132,7 +133,7 @@ build { } post-processor "manifest" { - output = "${path.cwd}/output/${local.buildtime}-${var.vm_guest_os_family}-${var.vm_guest_os_vendor}.json" + output = "${local.path_manifest}${local.buildtime}-${var.vm_guest_os_family}-${var.vm_guest_os_vendor}.json" strip_path = false } } diff --git a/builds/linux/centos-linux-8/output/.gitkeep b/builds/linux/centos-linux-8/output/.gitkeep deleted file mode 100644 index d3f5a12fa..000000000 --- a/builds/linux/centos-linux-8/output/.gitkeep +++ /dev/null @@ -1 +0,0 @@ - diff --git a/builds/linux/centos-stream-8/linux-centos-stream.auto.pkrvars.hcl b/builds/linux/centos-stream-8/linux-centos-stream.auto.pkrvars.hcl index f80a093c6..33631bfb7 100644 --- a/builds/linux/centos-stream-8/linux-centos-stream.auto.pkrvars.hcl +++ b/builds/linux/centos-stream-8/linux-centos-stream.auto.pkrvars.hcl @@ -33,8 +33,8 @@ iso_file = "iso-linux-centos-stream-8.iso" iso_checksum = "552cf5dcdc9d3db41791a2b3bbbd18335d75607ca54e7aa8bf28a6ea1d49ce914a55da0bd839123aa96654b7de6db65cc786beb71e6233982ea96ce456a47035" // Boot Settings -vm_boot_order = "disk,cdrom" -vm_boot_wait = "2s" +vm_boot_order = "disk,cdrom" +vm_boot_wait = "2s" // Communicator Settings communicator_port = 22 diff --git a/builds/linux/centos-stream-8/linux-centos-stream.pkr.hcl b/builds/linux/centos-stream-8/linux-centos-stream.pkr.hcl index fd0c79965..29a2edaf4 100644 --- a/builds/linux/centos-stream-8/linux-centos-stream.pkr.hcl +++ b/builds/linux/centos-stream-8/linux-centos-stream.pkr.hcl @@ -20,7 +20,8 @@ packer { // Defines the local variables. locals { - buildtime = formatdate("YYYY-MM-DD hh:mm ZZZ", timestamp()) + buildtime = formatdate("YYYY-MM-DD hh:mm ZZZ", timestamp()) + path_manifest = "../../../manifests/" data_source_content = { "/ks.cfg" = templatefile("${path.cwd}/data/ks.pkrtpl.hcl", { build_username = var.build_username, build_password_encrypted = var.build_password_encrypted, vm_guest_os_language = var.vm_guest_os_language, vm_guest_os_keyboard = var.vm_guest_os_keyboard, vm_guest_os_timezone = var.vm_guest_os_timezone }) } @@ -132,7 +133,7 @@ build { } post-processor "manifest" { - output = "${path.cwd}/output/${local.buildtime}-${var.vm_guest_os_family}-${var.vm_guest_os_vendor}.json" + output = "${local.path_manifest}${local.buildtime}-${var.vm_guest_os_family}-${var.vm_guest_os_vendor}.json" strip_path = false } } diff --git a/builds/linux/centos-stream-8/output/.gitkeep b/builds/linux/centos-stream-8/output/.gitkeep deleted file mode 100644 index d3f5a12fa..000000000 --- a/builds/linux/centos-stream-8/output/.gitkeep +++ /dev/null @@ -1 +0,0 @@ - diff --git a/builds/linux/photon-4/linux-photon.auto.pkrvars.hcl b/builds/linux/photon-4/linux-photon.auto.pkrvars.hcl index f4f543d46..9401d59c9 100644 --- a/builds/linux/photon-4/linux-photon.auto.pkrvars.hcl +++ b/builds/linux/photon-4/linux-photon.auto.pkrvars.hcl @@ -30,8 +30,8 @@ iso_file = "iso-linux-photon-4.iso" iso_checksum = "9cb0ae0329a50733f56e921c1e220ce3e9d328499890b8202e05991daec34c4184ef03606caf706e9058035115c23fef1cacbb184200fca8ec577a191ad3f394" // Boot Settings -vm_boot_order = "disk,cdrom" -vm_boot_wait = "2s" +vm_boot_order = "disk,cdrom" +vm_boot_wait = "2s" // Communicator Settings communicator_port = 22 diff --git a/builds/linux/photon-4/linux-photon.pkr.hcl b/builds/linux/photon-4/linux-photon.pkr.hcl index 45ee51281..fca321804 100644 --- a/builds/linux/photon-4/linux-photon.pkr.hcl +++ b/builds/linux/photon-4/linux-photon.pkr.hcl @@ -20,7 +20,8 @@ packer { // Defines the local variables. locals { - buildtime = formatdate("YYYY-MM-DD hh:mm ZZZ", timestamp()) + buildtime = formatdate("YYYY-MM-DD hh:mm ZZZ", timestamp()) + path_manifest = "../../../manifests/" } // BLOCK: source @@ -69,9 +70,9 @@ source "vsphere-iso" "linux-photon" { iso_checksum = "${var.common_iso_hash}:${var.iso_checksum}" // Boot and Provisioning Settings - http_port_min = var.common_http_port_min - http_port_max = var.common_http_port_max - http_content = { + http_port_min = var.common_http_port_min + http_port_max = var.common_http_port_max + http_content = { "/ks.json" = templatefile("${path.cwd}/data/ks.pkrtpl.hcl", { build_username = var.build_username, build_password_encrypted = var.build_password_encrypted }) "/packages.json" = file("${path.cwd}/data/packages_minimal.json") } @@ -128,7 +129,7 @@ build { } post-processor "manifest" { - output = "${path.cwd}/output/${local.buildtime}-${var.vm_guest_os_family}-${var.vm_guest_os_vendor}.json" + output = "${local.path_manifest}${local.buildtime}-${var.vm_guest_os_family}-${var.vm_guest_os_vendor}.json" strip_path = false } } diff --git a/builds/linux/photon-4/output/.gitkeep b/builds/linux/photon-4/output/.gitkeep deleted file mode 100644 index d3f5a12fa..000000000 --- a/builds/linux/photon-4/output/.gitkeep +++ /dev/null @@ -1 +0,0 @@ - diff --git a/builds/linux/redhat-linux-8/linux-redhat-linux.auto.pkrvars.hcl b/builds/linux/redhat-linux-8/linux-redhat-linux.auto.pkrvars.hcl index 97a4b5202..8e563dcf0 100644 --- a/builds/linux/redhat-linux-8/linux-redhat-linux.auto.pkrvars.hcl +++ b/builds/linux/redhat-linux-8/linux-redhat-linux.auto.pkrvars.hcl @@ -33,8 +33,8 @@ iso_file = "iso-linux-redhat-linux-8.iso" iso_checksum = "3b3f4ad5a0b8ef289643bf8cb7f6f5a0fa7b2cbca747dc0ed6b588f574f38bee8c741b76519b8d0bf7dd4328d9ecc950bad443c22ddc8347837a4c58cd85b3a7" // Boot Settings -vm_boot_order = "disk,cdrom" -vm_boot_wait = "2s" +vm_boot_order = "disk,cdrom" +vm_boot_wait = "2s" // Communicator Settings communicator_port = 22 diff --git a/builds/linux/redhat-linux-8/linux-redhat-linux.pkr.hcl b/builds/linux/redhat-linux-8/linux-redhat-linux.pkr.hcl index 3b2f26365..ed8ee8939 100644 --- a/builds/linux/redhat-linux-8/linux-redhat-linux.pkr.hcl +++ b/builds/linux/redhat-linux-8/linux-redhat-linux.pkr.hcl @@ -20,7 +20,8 @@ packer { // Defines the local variables. locals { - buildtime = formatdate("YYYY-MM-DD hh:mm ZZZ", timestamp()) + buildtime = formatdate("YYYY-MM-DD hh:mm ZZZ", timestamp()) + path_manifest = "../../../manifests/" data_source_content = { "/ks.cfg" = templatefile("${path.cwd}/data/ks.pkrtpl.hcl", { build_username = var.build_username, build_password_encrypted = var.build_password_encrypted, vm_guest_os_language = var.vm_guest_os_language, vm_guest_os_keyboard = var.vm_guest_os_keyboard, vm_guest_os_timezone = var.vm_guest_os_timezone }) } @@ -134,7 +135,7 @@ build { } post-processor "manifest" { - output = "${path.cwd}/output/${local.buildtime}-${var.vm_guest_os_family}-${var.vm_guest_os_vendor}.json" + output = "${local.path_manifest}${local.buildtime}-${var.vm_guest_os_family}-${var.vm_guest_os_vendor}.json" strip_path = false } } diff --git a/builds/linux/redhat-linux-8/output/.gitkeep b/builds/linux/redhat-linux-8/output/.gitkeep deleted file mode 100644 index d3f5a12fa..000000000 --- a/builds/linux/redhat-linux-8/output/.gitkeep +++ /dev/null @@ -1 +0,0 @@ - diff --git a/builds/linux/rocky-linux-8/linux-rocky-linux.auto.pkrvars.hcl b/builds/linux/rocky-linux-8/linux-rocky-linux.auto.pkrvars.hcl index fecb6e9e0..014c038db 100644 --- a/builds/linux/rocky-linux-8/linux-rocky-linux.auto.pkrvars.hcl +++ b/builds/linux/rocky-linux-8/linux-rocky-linux.auto.pkrvars.hcl @@ -33,8 +33,8 @@ iso_file = "iso-linux-rocky-linux-8.iso" iso_checksum = "dbfacdbbfd50059a0dda5c19071bc2f55496f3651279eafa6f50d2ea2d941fdd8b43b8710e2187cdbfe630fa7efb5d3b047ee0cdbc2f8d09bd5f68a7014e0d0c" // Boot Settings -vm_boot_order = "disk,cdrom" -vm_boot_wait = "2s" +vm_boot_order = "disk,cdrom" +vm_boot_wait = "2s" // Communicator Settings communicator_port = 22 diff --git a/builds/linux/rocky-linux-8/linux-rocky-linux.pkr.hcl b/builds/linux/rocky-linux-8/linux-rocky-linux.pkr.hcl index fa3f11d7d..b83623287 100644 --- a/builds/linux/rocky-linux-8/linux-rocky-linux.pkr.hcl +++ b/builds/linux/rocky-linux-8/linux-rocky-linux.pkr.hcl @@ -20,7 +20,8 @@ packer { // Defines the local variables. locals { - buildtime = formatdate("YYYY-MM-DD hh:mm ZZZ", timestamp()) + buildtime = formatdate("YYYY-MM-DD hh:mm ZZZ", timestamp()) + path_manifest = "../../../manifests/" data_source_content = { "/ks.cfg" = templatefile("${path.cwd}/data/ks.pkrtpl.hcl", { build_username = var.build_username, build_password_encrypted = var.build_password_encrypted, vm_guest_os_language = var.vm_guest_os_language, vm_guest_os_keyboard = var.vm_guest_os_keyboard, vm_guest_os_timezone = var.vm_guest_os_timezone }) } @@ -132,7 +133,7 @@ build { } post-processor "manifest" { - output = "${path.cwd}/output/${local.buildtime}-${var.vm_guest_os_family}-${var.vm_guest_os_vendor}.json" + output = "${local.path_manifest}${local.buildtime}-${var.vm_guest_os_family}-${var.vm_guest_os_vendor}.json" strip_path = false } } diff --git a/builds/linux/rocky-linux-8/output/.gitkeep b/builds/linux/rocky-linux-8/output/.gitkeep deleted file mode 100644 index d3f5a12fa..000000000 --- a/builds/linux/rocky-linux-8/output/.gitkeep +++ /dev/null @@ -1 +0,0 @@ - diff --git a/builds/linux/ubuntu-server-18-04-lts/linux-ubuntu-server.auto.pkrvars.hcl b/builds/linux/ubuntu-server-18-04-lts/linux-ubuntu-server.auto.pkrvars.hcl index 7522c9268..c5fa98687 100644 --- a/builds/linux/ubuntu-server-18-04-lts/linux-ubuntu-server.auto.pkrvars.hcl +++ b/builds/linux/ubuntu-server-18-04-lts/linux-ubuntu-server.auto.pkrvars.hcl @@ -33,8 +33,8 @@ iso_file = "iso-linux-ubuntu-server-18-04-lts.iso" iso_checksum = "43738d7dfd3e2661e4d55d2e0f9d8150f0687f4335af9b4dac047bf45fafcb4a4831685281fd5a318c5747681c351375d1129094d3f1bf38d88ab4bb49b6c457" // Boot Settings -vm_boot_order = "disk,cdrom" -vm_boot_wait = "3s" +vm_boot_order = "disk,cdrom" +vm_boot_wait = "3s" // Communicator Settings communicator_port = 22 diff --git a/builds/linux/ubuntu-server-18-04-lts/linux-ubuntu-server.pkr.hcl b/builds/linux/ubuntu-server-18-04-lts/linux-ubuntu-server.pkr.hcl index fe441e0a5..c470b4627 100644 --- a/builds/linux/ubuntu-server-18-04-lts/linux-ubuntu-server.pkr.hcl +++ b/builds/linux/ubuntu-server-18-04-lts/linux-ubuntu-server.pkr.hcl @@ -20,7 +20,8 @@ packer { // Defines the local variables. locals { - buildtime = formatdate("YYYY-MM-DD hh:mm ZZZ", timestamp()) + buildtime = formatdate("YYYY-MM-DD hh:mm ZZZ", timestamp()) + path_manifest = "../../../manifests/" } // BLOCK: source @@ -69,13 +70,13 @@ source "vsphere-iso" "linux-ubuntu-server" { iso_checksum = "${var.common_iso_hash}:${var.iso_checksum}" // Boot and Provisioning Settings - http_port_min = var.common_http_port_min - http_port_max = var.common_http_port_max - http_content = { + http_port_min = var.common_http_port_min + http_port_max = var.common_http_port_max + http_content = { "/ks.cfg" = templatefile("${path.cwd}/data/ks.pkrtpl.hcl", { build_username = var.build_username, build_password_encrypted = var.build_password_encrypted, vm_guest_os_language = var.vm_guest_os_language, vm_guest_os_keyboard = var.vm_guest_os_keyboard, vm_guest_os_timezone = var.vm_guest_os_timezone }) } - boot_order = var.vm_boot_order - boot_wait = var.vm_boot_wait + boot_order = var.vm_boot_order + boot_wait = var.vm_boot_wait boot_command = ["", "", "", @@ -140,7 +141,7 @@ build { } post-processor "manifest" { - output = "${path.cwd}/output/${local.buildtime}-${var.vm_guest_os_family}-${var.vm_guest_os_vendor}-${var.vm_guest_os_member}.json" + output = "${local.path_manifest}${local.buildtime}-${var.vm_guest_os_family}-${var.vm_guest_os_vendor}-${var.vm_guest_os_member}.json" strip_path = false } } diff --git a/builds/linux/ubuntu-server-18-04-lts/output/.gitkeep b/builds/linux/ubuntu-server-18-04-lts/output/.gitkeep deleted file mode 100644 index d3f5a12fa..000000000 --- a/builds/linux/ubuntu-server-18-04-lts/output/.gitkeep +++ /dev/null @@ -1 +0,0 @@ - diff --git a/builds/linux/ubuntu-server-20-04-lts/linux-ubuntu-server.auto.pkrvars.hcl b/builds/linux/ubuntu-server-20-04-lts/linux-ubuntu-server.auto.pkrvars.hcl index 1dde6ac19..3e950606e 100644 --- a/builds/linux/ubuntu-server-20-04-lts/linux-ubuntu-server.auto.pkrvars.hcl +++ b/builds/linux/ubuntu-server-20-04-lts/linux-ubuntu-server.auto.pkrvars.hcl @@ -33,8 +33,8 @@ iso_file = "iso-linux-ubuntu-server-20-04-lts.iso" iso_checksum = "302c990c6d69575ff24c96566e5c7e26bf36908abb0cd546e22687c46fb07bf8dba595bf77a9d4fd9ab63e75c0437c133f35462fd41ea77f6f616140cd0e5e6a" // Boot Settings -vm_boot_order = "disk,cdrom" -vm_boot_wait = "5s" +vm_boot_order = "disk,cdrom" +vm_boot_wait = "5s" // Communicator Settings communicator_port = 22 diff --git a/builds/linux/ubuntu-server-20-04-lts/linux-ubuntu-server.pkr.hcl b/builds/linux/ubuntu-server-20-04-lts/linux-ubuntu-server.pkr.hcl index 347b95783..24d9ad7b9 100644 --- a/builds/linux/ubuntu-server-20-04-lts/linux-ubuntu-server.pkr.hcl +++ b/builds/linux/ubuntu-server-20-04-lts/linux-ubuntu-server.pkr.hcl @@ -20,7 +20,8 @@ packer { // Defines the local variables. locals { - buildtime = formatdate("YYYY-MM-DD hh:mm ZZZ", timestamp()) + buildtime = formatdate("YYYY-MM-DD hh:mm ZZZ", timestamp()) + path_manifest = "../../../manifests/" data_source_content = { "/meta-data" = file("${path.cwd}/data/meta-data") "/user-data" = templatefile("${path.cwd}/data/user-data.pkrtpl.hcl", { build_username = var.build_username, build_password_encrypted = var.build_password_encrypted, vm_guest_os_language = var.vm_guest_os_language, vm_guest_os_keyboard = var.vm_guest_os_keyboard, vm_guest_os_timezone = var.vm_guest_os_timezone }) @@ -134,7 +135,7 @@ build { } post-processor "manifest" { - output = "${path.cwd}/output/${local.buildtime}-${var.vm_guest_os_family}-${var.vm_guest_os_vendor}-${var.vm_guest_os_member}.json" + output = "${local.path_manifest}${local.buildtime}-${var.vm_guest_os_family}-${var.vm_guest_os_vendor}-${var.vm_guest_os_member}.json" strip_path = false } } diff --git a/builds/linux/ubuntu-server-20-04-lts/output/.gitkeep b/builds/linux/ubuntu-server-20-04-lts/output/.gitkeep deleted file mode 100644 index d3f5a12fa..000000000 --- a/builds/linux/ubuntu-server-20-04-lts/output/.gitkeep +++ /dev/null @@ -1 +0,0 @@ - diff --git a/builds/windows/windows-server-2016/data/autounattend.pkrtpl.hcl b/builds/windows/windows-server-2016/data/autounattend.pkrtpl.hcl new file mode 100644 index 000000000..bee394880 --- /dev/null +++ b/builds/windows/windows-server-2016/data/autounattend.pkrtpl.hcl @@ -0,0 +1,202 @@ + + + + + + ${vm_guest_os_language} + + ${vm_guest_os_keyboard} + e${vm_guest_os_language} + ${vm_guest_os_language} + ${vm_guest_os_language} + ${vm_guest_os_language} + + + + + E:\Program Files\VMware\VMware Tools\Drivers\pvscsi\Win8\amd64 + + + + + + + 0 + true + + + + 1 + Primary + 300 + + + + 2 + EFI + 100 + + + + 3 + MSR + 128 + + + + 4 + Primary + true + + + + + + 1 + 1 + + NTFS + DE94BBA4-06D1-4D40-A16A-BFD50179D6AC + + + + 2 + 2 + + FAT32 + + + + 3 + 3 + + + + 4 + 4 + + C + NTFS + + + + + + + + + /IMAGE/NAME + ${os_image} + + + + 0 + 4 + + + + + true + ${build_username} + ${build_username} + + ${kms_key} + OnError + + + false + + + + + false + + + + + 1 + + + + + + false + + win-server-2016 + ${vm_guest_os_timezone} + + + + true + + + true + + + true + + + + + + + ${build_password} + true</PlainText> + </Password> + <Enabled>true</Enabled> + <Username>${build_username}</Username> + </AutoLogon> + <OOBE> + <HideEULAPage>true</HideEULAPage> + <HideLocalAccountScreen>true</HideLocalAccountScreen> + <HideOEMRegistrationScreen>true</HideOEMRegistrationScreen> + <HideOnlineAccountScreens>true</HideOnlineAccountScreens> + <HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE> + <NetworkLocation>Work</NetworkLocation> + <ProtectYourPC>2</ProtectYourPC> + </OOBE> + <UserAccounts> + <AdministratorPassword> + <Value>${build_password}</Value> + <PlainText>true</PlainText> + </AdministratorPassword> + <LocalAccounts> + <LocalAccount wcm:action="add"> + <Password> + <Value>${build_password}</Value> + <PlainText>true</PlainText> + </Password> + <Group>administrators</Group> + <DisplayName>${build_username}</DisplayName> + <Name>${build_username}</Name> + <Description>Build Account</Description> + </LocalAccount> + </LocalAccounts> + </UserAccounts> + <FirstLogonCommands> + <SynchronousCommand wcm:action="add"> + <CommandLine>%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -Command "Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Force"</CommandLine> + <Description>Set Execution Policy 64-Bit</Description> + <Order>1</Order> + <RequiresUserInput>true</RequiresUserInput> + </SynchronousCommand> + <SynchronousCommand wcm:action="add"> + <CommandLine>%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -Command "Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Force"</CommandLine> + <Description>Set Execution Policy 32-Bit</Description> + <Order>2</Order> + <RequiresUserInput>true</RequiresUserInput> + </SynchronousCommand> + <SynchronousCommand wcm:action="add"> + <CommandLine>%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -File F:\windows-server-vmtools.ps1</CommandLine> + <Order>3</Order> + <Description>Install VMware Tools</Description> + </SynchronousCommand> + <SynchronousCommand wcm:action="add"> + <CommandLine>%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -File F:\windows-server-init.ps1</CommandLine> + <Order>4</Order> + <Description>Enable Windows Remote Management</Description> + </SynchronousCommand> + </FirstLogonCommands> + </component> + </settings> +</unattend> \ No newline at end of file diff --git a/builds/windows/windows-server-2016/output/.gitkeep b/builds/windows/windows-server-2016/output/.gitkeep deleted file mode 100644 index d3f5a12fa..000000000 --- a/builds/windows/windows-server-2016/output/.gitkeep +++ /dev/null @@ -1 +0,0 @@ - diff --git a/builds/windows/windows-server-2016/windows-server.pkr.hcl b/builds/windows/windows-server-2016/windows-server.pkr.hcl index cc1f1841a..908aae2f4 100644 --- a/builds/windows/windows-server-2016/windows-server.pkr.hcl +++ b/builds/windows/windows-server-2016/windows-server.pkr.hcl @@ -26,7 +26,8 @@ packer { // Defines the local variables. locals { - buildtime = formatdate("YYYY-MM-DD hh:mm ZZZ", timestamp()) + buildtime = formatdate("YYYY-MM-DD hh:mm ZZZ", timestamp()) + path_manifest = "../../../manifests/" } // BLOCK: source @@ -76,7 +77,7 @@ source "vsphere-iso" "windows-server-standard-core" { cd_files = [ "../../../scripts/${var.vm_guest_os_family}/", "../../../certificates/" - ] + ] cd_content = { "autounattend.xml" = templatefile("${path.cwd}/data/autounattend.pkrtpl.hcl", { os_image = "Windows Server 2016 SERVERSTANDARDCORE", kms_key = "WC2BQ-8NRM3-FDDYY-2BFGV-KHKQY", build_username = var.build_username, build_password = var.build_password, vm_guest_os_language = var.vm_guest_os_language, vm_guest_os_keyboard = var.vm_guest_os_keyboard, vm_guest_os_timezone = var.vm_guest_os_timezone }) } @@ -154,7 +155,7 @@ source "vsphere-iso" "windows-server-standard-dexp" { cd_files = [ "../../../scripts/${var.vm_guest_os_family}/", "../../../certificates/" - ] + ] cd_content = { "autounattend.xml" = templatefile("${path.cwd}/data/autounattend.pkrtpl.hcl", { os_image = "Windows Server 2016 SERVERSTANDARD", kms_key = "WC2BQ-8NRM3-FDDYY-2BFGV-KHKQY", build_username = var.build_username, build_password = var.build_password, vm_guest_os_language = var.vm_guest_os_language, vm_guest_os_keyboard = var.vm_guest_os_keyboard, vm_guest_os_timezone = var.vm_guest_os_timezone }) } @@ -233,7 +234,7 @@ source "vsphere-iso" "windows-server-datacenter-core" { cd_files = [ "../../../scripts/${var.vm_guest_os_family}/", "../../../certificates/" - ] + ] cd_content = { "autounattend.xml" = templatefile("${path.cwd}/data/autounattend.pkrtpl.hcl", { os_image = "Windows Server 2016 SERVERDATACENTERCORE", kms_key = "CB7KF-BWN84-R7R2Y-793K2-8XDDG", build_username = var.build_username, build_password = var.build_password, vm_guest_os_language = var.vm_guest_os_language, vm_guest_os_keyboard = var.vm_guest_os_keyboard, vm_guest_os_timezone = var.vm_guest_os_timezone }) } @@ -312,7 +313,7 @@ source "vsphere-iso" "windows-server-datacenter-dexp" { cd_files = [ "../../../scripts/${var.vm_guest_os_family}/", "../../../certificates/" - ] + ] cd_content = { "autounattend.xml" = templatefile("${path.cwd}/data/autounattend.pkrtpl.hcl", { os_image = "Windows Server 2016 SERVERDATACENTER", kms_key = "CB7KF-BWN84-R7R2Y-793K2-8XDDG", build_username = var.build_username, build_password = var.build_password, vm_guest_os_language = var.vm_guest_os_language, vm_guest_os_keyboard = var.vm_guest_os_keyboard, vm_guest_os_timezone = var.vm_guest_os_timezone }) } @@ -366,15 +367,15 @@ build { environment_vars = [ "BUILD_USERNAME=${var.build_username}" ] - elevated_user = var.build_username - elevated_password = var.build_password - scripts = var.scripts + elevated_user = var.build_username + elevated_password = var.build_password + scripts = var.scripts } provisioner "powershell" { - elevated_user = var.build_username - elevated_password = var.build_password - inline = var.inline + elevated_user = var.build_username + elevated_password = var.build_password + inline = var.inline } provisioner "windows-update" { @@ -391,7 +392,7 @@ build { } post-processor "manifest" { - output = "${path.cwd}/output/${local.buildtime}-${var.vm_guest_os_family}-${var.vm_guest_os_member}.json" + output = "${local.path_manifest}${local.buildtime}-${var.vm_guest_os_family}-${var.vm_guest_os_member}.json" strip_path = false } } \ No newline at end of file diff --git a/builds/windows/windows-server-2019/output/.gitkeep b/builds/windows/windows-server-2019/output/.gitkeep deleted file mode 100644 index d3f5a12fa..000000000 --- a/builds/windows/windows-server-2019/output/.gitkeep +++ /dev/null @@ -1 +0,0 @@ - diff --git a/builds/windows/windows-server-2019/windows-server.pkr.hcl b/builds/windows/windows-server-2019/windows-server.pkr.hcl index 9bc86fbd0..b0f1fa818 100644 --- a/builds/windows/windows-server-2019/windows-server.pkr.hcl +++ b/builds/windows/windows-server-2019/windows-server.pkr.hcl @@ -26,7 +26,8 @@ packer { // Defines the local variables. locals { - buildtime = formatdate("YYYY-MM-DD hh:mm ZZZ", timestamp()) + buildtime = formatdate("YYYY-MM-DD hh:mm ZZZ", timestamp()) + path_manifest = "../../../manifests/" } // BLOCK: source @@ -71,12 +72,12 @@ source "vsphere-iso" "windows-server-standard-core" { notes = "Built by HashiCorp Packer on ${local.buildtime}." // Removable Media Settings - iso_paths = ["[${var.common_iso_datastore}] ${var.common_iso_path}/${var.iso_file}", "[] /vmimages/tools-isoimages/${var.vm_guest_os_family}.iso"] - iso_checksum = "${var.common_iso_hash}:${var.iso_checksum}" + iso_paths = ["[${var.common_iso_datastore}] ${var.common_iso_path}/${var.iso_file}", "[] /vmimages/tools-isoimages/${var.vm_guest_os_family}.iso"] + iso_checksum = "${var.common_iso_hash}:${var.iso_checksum}" cd_files = [ "../../../scripts/${var.vm_guest_os_family}/", "../../../certificates/" - ] + ] cd_content = { "autounattend.xml" = templatefile("${path.cwd}/data/autounattend.pkrtpl.hcl", { os_image = "Windows Server 2019 SERVERSTANDARDCORE", kms_key = "N69G4-B89J2-4G8F4-WWYCC-J464C", build_username = var.build_username, build_password = var.build_password, vm_guest_os_language = var.vm_guest_os_language, vm_guest_os_keyboard = var.vm_guest_os_keyboard, vm_guest_os_timezone = var.vm_guest_os_timezone }) } @@ -150,12 +151,12 @@ source "vsphere-iso" "windows-server-standard-dexp" { notes = "Built by HashiCorp Packer on ${local.buildtime}." // Removable Media Settings - iso_paths = ["[${var.common_iso_datastore}] ${var.common_iso_path}/${var.iso_file}", "[] /vmimages/tools-isoimages/${var.vm_guest_os_family}.iso"] - iso_checksum = "${var.common_iso_hash}:${var.iso_checksum}" + iso_paths = ["[${var.common_iso_datastore}] ${var.common_iso_path}/${var.iso_file}", "[] /vmimages/tools-isoimages/${var.vm_guest_os_family}.iso"] + iso_checksum = "${var.common_iso_hash}:${var.iso_checksum}" cd_files = [ "../../../scripts/${var.vm_guest_os_family}/", "../../../certificates/" - ] + ] cd_content = { "autounattend.xml" = templatefile("${path.cwd}/data/autounattend.pkrtpl.hcl", { os_image = "Windows Server 2019 SERVERSTANDARD", kms_key = "N69G4-B89J2-4G8F4-WWYCC-J464C", build_username = var.build_username, build_password = var.build_password, vm_guest_os_language = var.vm_guest_os_language, vm_guest_os_keyboard = var.vm_guest_os_keyboard, vm_guest_os_timezone = var.vm_guest_os_timezone }) } @@ -229,12 +230,12 @@ source "vsphere-iso" "windows-server-datacenter-core" { notes = "Built by HashiCorp Packer on ${local.buildtime}." // Removable Media Settings - iso_paths = ["[${var.common_iso_datastore}] ${var.common_iso_path}/${var.iso_file}", "[] /vmimages/tools-isoimages/${var.vm_guest_os_family}.iso"] - iso_checksum = "${var.common_iso_hash}:${var.iso_checksum}" + iso_paths = ["[${var.common_iso_datastore}] ${var.common_iso_path}/${var.iso_file}", "[] /vmimages/tools-isoimages/${var.vm_guest_os_family}.iso"] + iso_checksum = "${var.common_iso_hash}:${var.iso_checksum}" cd_files = [ "../../../scripts/${var.vm_guest_os_family}/", "../../../certificates/" - ] + ] cd_content = { "autounattend.xml" = templatefile("${path.cwd}/data/autounattend.pkrtpl.hcl", { os_image = "Windows Server 2019 SERVERDATACENTERCORE", kms_key = "WMDGN-G9PQG-XVVXX-R3X43-63DFG", build_username = var.build_username, build_password = var.build_password, vm_guest_os_language = var.vm_guest_os_language, vm_guest_os_keyboard = var.vm_guest_os_keyboard, vm_guest_os_timezone = var.vm_guest_os_timezone }) } @@ -308,12 +309,12 @@ source "vsphere-iso" "windows-server-datacenter-dexp" { notes = "Built by HashiCorp Packer on ${local.buildtime}." // Removable Media Settings - iso_paths = ["[${var.common_iso_datastore}] ${var.common_iso_path}/${var.iso_file}", "[] /vmimages/tools-isoimages/${var.vm_guest_os_family}.iso"] - iso_checksum = "${var.common_iso_hash}:${var.iso_checksum}" + iso_paths = ["[${var.common_iso_datastore}] ${var.common_iso_path}/${var.iso_file}", "[] /vmimages/tools-isoimages/${var.vm_guest_os_family}.iso"] + iso_checksum = "${var.common_iso_hash}:${var.iso_checksum}" cd_files = [ "../../../scripts/${var.vm_guest_os_family}/", "../../../certificates/" - ] + ] cd_content = { "autounattend.xml" = templatefile("${path.cwd}/data/autounattend.pkrtpl.hcl", { os_image = "Windows Server 2019 SERVERDATACENTER", kms_key = "WMDGN-G9PQG-XVVXX-R3X43-63DFG", build_username = var.build_username, build_password = var.build_password, vm_guest_os_language = var.vm_guest_os_language, vm_guest_os_keyboard = var.vm_guest_os_keyboard, vm_guest_os_timezone = var.vm_guest_os_timezone }) } @@ -367,15 +368,15 @@ build { environment_vars = [ "BUILD_USERNAME=${var.build_username}" ] - elevated_user = var.build_username - elevated_password = var.build_password - scripts = var.scripts + elevated_user = var.build_username + elevated_password = var.build_password + scripts = var.scripts } provisioner "powershell" { - elevated_user = var.build_username - elevated_password = var.build_password - inline = var.inline + elevated_user = var.build_username + elevated_password = var.build_password + inline = var.inline } provisioner "windows-update" { @@ -392,7 +393,7 @@ build { } post-processor "manifest" { - output = "${path.cwd}/output/${local.buildtime}-${var.vm_guest_os_family}-${var.vm_guest_os_member}.json" + output = "${local.path_manifest}${local.buildtime}-${var.vm_guest_os_family}-${var.vm_guest_os_member}.json" strip_path = false } } \ No newline at end of file diff --git a/builds/windows/windows-server-2022/output/.gitkeep b/builds/windows/windows-server-2022/output/.gitkeep deleted file mode 100644 index d3f5a12fa..000000000 --- a/builds/windows/windows-server-2022/output/.gitkeep +++ /dev/null @@ -1 +0,0 @@ - diff --git a/builds/windows/windows-server-2022/windows-server.pkr.hcl b/builds/windows/windows-server-2022/windows-server.pkr.hcl index c3c004ad9..b9c370352 100644 --- a/builds/windows/windows-server-2022/windows-server.pkr.hcl +++ b/builds/windows/windows-server-2022/windows-server.pkr.hcl @@ -26,7 +26,8 @@ packer { // Defines the local variables. locals { - buildtime = formatdate("YYYY-MM-DD hh:mm ZZZ", timestamp()) + buildtime = formatdate("YYYY-MM-DD hh:mm ZZZ", timestamp()) + path_manifest = "../../../manifests/" } // BLOCK: source @@ -76,7 +77,7 @@ source "vsphere-iso" "windows-server-standard-core" { cd_files = [ "../../../scripts/${var.vm_guest_os_family}/", "../../../certificates/" - ] + ] cd_content = { "autounattend.xml" = templatefile("${path.cwd}/data/autounattend.pkrtpl.hcl", { os_image = "Windows Server 2022 SERVERSTANDARDCORE", kms_key = "VDYBN-27WPP-V4HQT-9VMD4-VMK7H", build_username = var.build_username, build_password = var.build_password, vm_guest_os_language = var.vm_guest_os_language, vm_guest_os_keyboard = var.vm_guest_os_keyboard, vm_guest_os_timezone = var.vm_guest_os_timezone }) } @@ -155,7 +156,7 @@ source "vsphere-iso" "windows-server-standard-dexp" { cd_files = [ "../../../scripts/${var.vm_guest_os_family}/", "../../../certificates/" - ] + ] cd_content = { "autounattend.xml" = templatefile("${path.cwd}/data/autounattend.pkrtpl.hcl", { os_image = "Windows Server 2022 SERVERSTANDARD", kms_key = "VDYBN-27WPP-V4HQT-9VMD4-VMK7H", build_username = var.build_username, build_password = var.build_password, vm_guest_os_language = var.vm_guest_os_language, vm_guest_os_keyboard = var.vm_guest_os_keyboard, vm_guest_os_timezone = var.vm_guest_os_timezone }) } @@ -234,7 +235,7 @@ source "vsphere-iso" "windows-server-datacenter-core" { cd_files = [ "../../../scripts/${var.vm_guest_os_family}/", "../../../certificates/" - ] + ] cd_content = { "autounattend.xml" = templatefile("${path.cwd}/data/autounattend.pkrtpl.hcl", { os_image = "Windows Server 2022 SERVERDATACENTERCORE", kms_key = "WX4NM-KYWYW-QJJR4-XV3QB-6VM33", build_username = var.build_username, build_password = var.build_password, vm_guest_os_language = var.vm_guest_os_language, vm_guest_os_keyboard = var.vm_guest_os_keyboard, vm_guest_os_timezone = var.vm_guest_os_timezone }) } @@ -313,7 +314,7 @@ source "vsphere-iso" "windows-server-datacenter-dexp" { cd_files = [ "../../../scripts/${var.vm_guest_os_family}/", "../../../certificates/" - ] + ] cd_content = { "autounattend.xml" = templatefile("${path.cwd}/data/autounattend.pkrtpl.hcl", { os_image = "Windows Server 2022 SERVERDATACENTER", kms_key = "WX4NM-KYWYW-QJJR4-XV3QB-6VM33", build_username = var.build_username, build_password = var.build_password, vm_guest_os_language = var.vm_guest_os_language, vm_guest_os_keyboard = var.vm_guest_os_keyboard, vm_guest_os_timezone = var.vm_guest_os_timezone }) } @@ -367,15 +368,15 @@ build { environment_vars = [ "BUILD_USERNAME=${var.build_username}" ] - elevated_user = var.build_username - elevated_password = var.build_password - scripts = var.scripts + elevated_user = var.build_username + elevated_password = var.build_password + scripts = var.scripts } provisioner "powershell" { - elevated_user = var.build_username - elevated_password = var.build_password - inline = var.inline + elevated_user = var.build_username + elevated_password = var.build_password + inline = var.inline } provisioner "windows-update" { @@ -392,7 +393,7 @@ build { } post-processor "manifest" { - output = "${path.cwd}/output/${local.buildtime}-${var.vm_guest_os_family}-${var.vm_guest_os_member}.json" + output = "${local.path_manifest}${local.buildtime}-${var.vm_guest_os_family}-${var.vm_guest_os_member}.json" strip_path = false } } \ No newline at end of file diff --git a/builds/linux/almalinux-8/output/.gitkeep b/manifests/.gitkeep similarity index 100% rename from builds/linux/almalinux-8/output/.gitkeep rename to manifests/.gitkeep