Skip to content

Commit

Permalink
Refactor manifest output location. (#66)
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
tenthirtyam committed Sep 29, 2021
1 parent 7d1e8f6 commit 7ad08cd
Show file tree
Hide file tree
Showing 32 changed files with 301 additions and 96 deletions.
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ crash.log
# Configurations
## Ignore custom configurations.
config/
## Ignore certificatess.
## Ignore certificates.
**/.crt
**/.p7b
**/.p7b
## Ignore manifests.
manifests/*.json
4 changes: 2 additions & 2 deletions builds/linux/almalinux-8/linux-almalinux.auto.pkrvars.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions builds/linux/almalinux-8/linux-almalinux.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -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 })
}
Expand Down Expand Up @@ -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
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions builds/linux/centos-linux-8/linux-centos-linux.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -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 })
}
Expand Down Expand Up @@ -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
}
}
1 change: 0 additions & 1 deletion builds/linux/centos-linux-8/output/.gitkeep

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions builds/linux/centos-stream-8/linux-centos-stream.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -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 })
}
Expand Down Expand Up @@ -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
}
}
1 change: 0 additions & 1 deletion builds/linux/centos-stream-8/output/.gitkeep

This file was deleted.

4 changes: 2 additions & 2 deletions builds/linux/photon-4/linux-photon.auto.pkrvars.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 6 additions & 5 deletions builds/linux/photon-4/linux-photon.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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")
}
Expand Down Expand Up @@ -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
}
}
1 change: 0 additions & 1 deletion builds/linux/photon-4/output/.gitkeep

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions builds/linux/redhat-linux-8/linux-redhat-linux.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -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 })
}
Expand Down Expand Up @@ -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
}
}
1 change: 0 additions & 1 deletion builds/linux/redhat-linux-8/output/.gitkeep

This file was deleted.

4 changes: 2 additions & 2 deletions builds/linux/rocky-linux-8/linux-rocky-linux.auto.pkrvars.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions builds/linux/rocky-linux-8/linux-rocky-linux.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -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 })
}
Expand Down Expand Up @@ -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
}
}
1 change: 0 additions & 1 deletion builds/linux/rocky-linux-8/output/.gitkeep

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 8 additions & 7 deletions builds/linux/ubuntu-server-18-04-lts/linux-ubuntu-server.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 = ["<enter><wait><f6><wait><esc><wait>",
"<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
"<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
Expand Down Expand Up @@ -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
}
}
1 change: 0 additions & 1 deletion builds/linux/ubuntu-server-18-04-lts/output/.gitkeep

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 })
Expand Down Expand Up @@ -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
}
}
1 change: 0 additions & 1 deletion builds/linux/ubuntu-server-20-04-lts/output/.gitkeep

This file was deleted.

Loading

0 comments on commit 7ad08cd

Please sign in to comment.