Initial Commit
This commit is contained in:
commit
22e47d9a0e
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
*.checksum
|
||||
cache/*
|
||||
output/*
|
0
files/consul.conf
Normal file
0
files/consul.conf
Normal file
0
files/nomad.conf
Normal file
0
files/nomad.conf
Normal file
94
leader.pkr.hcl
Normal file
94
leader.pkr.hcl
Normal file
@ -0,0 +1,94 @@
|
||||
// Leader image - Contains the tools required by the leaders
|
||||
|
||||
variable "cpus" {
|
||||
type = number
|
||||
default = 2
|
||||
}
|
||||
|
||||
variable "memory" {
|
||||
type = number
|
||||
default = 1024
|
||||
}
|
||||
|
||||
variable "disk_size" {
|
||||
type = string
|
||||
default = "4G"
|
||||
}
|
||||
|
||||
variable "iso_url" {
|
||||
type = string
|
||||
# This should be hosted by an artifact repo (or be lazy and python -m http.server)
|
||||
default = "http://localhost:8000/output/arch.img"
|
||||
}
|
||||
|
||||
variable "iso_checksum" {
|
||||
type = string
|
||||
default = "file:http://localhost:8000/packer_arch_qemu_sha256.checksum"
|
||||
}
|
||||
|
||||
variable "ssh_username" {
|
||||
type = string
|
||||
default = "deploy"
|
||||
}
|
||||
|
||||
variable "ssh_password" {
|
||||
type = string
|
||||
default = "deploy"
|
||||
}
|
||||
|
||||
source "qemu" "leader" {
|
||||
headless = true
|
||||
accelerator = "kvm"
|
||||
vm_name = "leader.img"
|
||||
http_directory = "http"
|
||||
output_directory = "output"
|
||||
|
||||
cpus = var.cpus
|
||||
memory = var.memory
|
||||
|
||||
disk_size = var.disk_size
|
||||
format = "raw"
|
||||
|
||||
disk_image = true
|
||||
iso_url = var.iso_url
|
||||
iso_checksum = var.iso_checksum
|
||||
iso_target_path = "cache/arch.img"
|
||||
|
||||
boot_wait = "2s"
|
||||
boot_key_interval = "25ms"
|
||||
boot_command = [
|
||||
"<enter>",
|
||||
"<wait30s>"
|
||||
]
|
||||
|
||||
ssh_username = var.ssh_username
|
||||
ssh_password = var.ssh_password
|
||||
|
||||
shutdown_command = "sudo -S shutdown -P now"
|
||||
}
|
||||
|
||||
build {
|
||||
sources = ["source.qemu.leader"]
|
||||
|
||||
provisioner "shell" {
|
||||
inline = [
|
||||
"sudo pacman -Sy --noconfirm",
|
||||
"sudo pacman -S --noconfirm consul",
|
||||
"sudo pacman -Scc --noconfirm",
|
||||
"sudo docker pull hashicorp/nomad-pack:0.0.1-techpreview.3"
|
||||
]
|
||||
}
|
||||
|
||||
// TODO: Add consul and nomad config files
|
||||
|
||||
post-processor "checksum" {
|
||||
checksum_types = ["sha256"]
|
||||
keep_input_artifact = true
|
||||
}
|
||||
|
||||
# Validate that the image is good
|
||||
// post-processor "shell-local" {
|
||||
// inline = ["qemu-system-x86_64 -drive file=output/arch.img -m 1024"]
|
||||
// }
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user