Spread build source defs more evenly

This commit is contained in:
Greg Hellings
2022-05-25 01:40:52 -05:00
parent e2e22cae6e
commit 5b40c9a79e
4 changed files with 100 additions and 102 deletions
+30
View File
@@ -0,0 +1,30 @@
build {
sources = ["source.qemu.x86_64"]
provisioner "ansible" {
playbook_file = "ansible/playbook.yml"
galaxy_file = "ansible/requirements.yml"
}
provisioner "shell" {
scripts = [
"scripts/minimize.sh"
]
}
post-processors {
post-processor "vagrant" {
keep_input_artifact = true
compression_level = 9
output = "${local.name}.box"
vagrantfile_template = "vagrant/${var.arch}.rb"
}
post-processor "vagrant-cloud" {
name = "upload"
box_tag = "greg-hellings/${local.name}"
version = local.build
version_description = local.description
}
}
}
+69
View File
@@ -0,0 +1,69 @@
variable "iso" {
type = map(string)
description = "A map containing the URL and checksum for the ISO file"
}
variable "distro" {
type = string
default = "unknown"
}
variable "arch" {
type = string
default = "x86_64"
}
variable "version" {
type = string
description = "The distro version being specified"
}
variable "boot_wait" {
type = string
default = "20s"
description = "Length of time to wait before entering boot commands"
}
variable "ssh" {
type = map(string)
default = {
username = "vagrant"
password = "vagrant"
}
}
variable "boot_command" {
type = list(string)
default = []
}
variable "ssh_handshake_attempts" {
type = number
default = 100
}
variable "shutdown_command" {
type = string
default = "sudo systemctl poweroff"
}
variable "disk_size" {
type = string
default = "20G"
}
variable "headless" {
type = bool
default = true
}
locals {
name = "${var.distro}-${var.version}-${var.arch}"
build = formatdate("YYYYMMDDhh", timestamp())
description = templatefile("../README.box.md", {
distro = var.distro
arch = var.arch
version = var.version
build = local.build
})
}
-101
View File
@@ -1,73 +1,3 @@
variable "iso" {
type = map(string)
description = "A map containing the URL and checksum for the ISO file"
}
variable "distro" {
type = string
default = "unknown"
}
variable "arch" {
type = string
default = "x86_64"
}
variable "version" {
type = string
description = "The distro version being specified"
}
variable "boot_wait" {
type = string
default = "20s"
description = "Length of time to wait before entering boot commands"
}
variable "ssh" {
type = map(string)
default = {
username = "vagrant"
password = "vagrant"
}
}
variable "boot_command" {
type = list(string)
default = []
}
variable "ssh_handshake_attempts" {
type = number
default = 100
}
variable "shutdown_command" {
type = string
default = "sudo systemctl poweroff"
}
variable "disk_size" {
type = string
default = "20G"
}
variable "headless" {
type = bool
default = true
}
locals {
name = "${var.distro}-${var.version}-${var.arch}"
build = formatdate("YYYYMMDDhh", timestamp())
description = templatefile("../README.box.md", {
distro = var.distro
arch = var.arch
version = var.version
build = local.build
})
}
source "qemu" "x86_64" {
iso_url = var.iso.url
iso_checksum = var.iso.checksum
@@ -88,34 +18,3 @@ source "qemu" "x86_64" {
qemuargs = [["-serial", "stdio"]]
shutdown_command = var.shutdown_command
}
build {
sources = ["source.qemu.x86_64"]
provisioner "ansible" {
playbook_file = "ansible/playbook.yml"
galaxy_file = "ansible/requirements.yml"
}
provisioner "shell" {
scripts = [
"scripts/minimize.sh"
]
}
post-processors {
post-processor "vagrant" {
keep_input_artifact = true
compression_level = 9
output = "${local.name}.box"
vagrantfile_template = "vagrant/${var.arch}.rb"
}
post-processor "vagrant-cloud" {
name = "upload"
box_tag = "greg-hellings/${local.name}"
version = local.build
version_description = local.description
}
}
}