mirror of
https://github.com/Maks1mS/alt-linux-vagrant-boxes.git
synced 2024-12-23 19:52:58 +03:00
89 lines
1.7 KiB
HCL
89 lines
1.7 KiB
HCL
packer {
|
|
required_plugins {
|
|
qemu = {
|
|
source = "github.com/hashicorp/qemu"
|
|
version = "~> 1"
|
|
}
|
|
vagrant = {
|
|
source = "github.com/hashicorp/vagrant"
|
|
version = "~> 1"
|
|
}
|
|
ansible = {
|
|
source = "github.com/hashicorp/ansible"
|
|
version = "~> 1"
|
|
}
|
|
}
|
|
}
|
|
|
|
variable "headless" {
|
|
type = bool
|
|
default = true
|
|
}
|
|
variable "iso_url" {
|
|
type = string
|
|
}
|
|
variable "iso_checksum" {
|
|
type = string
|
|
}
|
|
variable "http_dir" {
|
|
type = string
|
|
}
|
|
variable "vm_name" {
|
|
type = string
|
|
}
|
|
variable "boot_command" {
|
|
type = list(string)
|
|
}
|
|
variable "setup_script" {
|
|
type = string
|
|
}
|
|
|
|
source "qemu" "alt-linux" {
|
|
headless = "${var.headless}"
|
|
|
|
# Путь и контрольная сумма исходного ISO-образа
|
|
iso_url = "${var.iso_url}"
|
|
iso_checksum = "${var.iso_checksum}"
|
|
|
|
http_directory = "${var.http_dir}"
|
|
|
|
vm_name = "${var.vm_name}"
|
|
|
|
boot_wait = "15s"
|
|
boot_command = "${var.boot_command}"
|
|
|
|
accelerator = "kvm"
|
|
disk_size = 4096
|
|
format = "qcow2"
|
|
net_device = "virtio-net"
|
|
output_directory = "output-vagrant"
|
|
qemuargs = [
|
|
[ "-m", "1024" ],
|
|
[ "-smp", "1" ]
|
|
]
|
|
ssh_username = "vagrant"
|
|
ssh_password = "vagrant"
|
|
ssh_port = 22
|
|
ssh_wait_timeout = "10000s"
|
|
ssh_pty = true
|
|
}
|
|
|
|
build {
|
|
sources = [
|
|
"source.qemu.alt-linux"
|
|
]
|
|
|
|
# provisioner "ansible" {
|
|
# playbook_file = "${var.setup_playbook}"
|
|
# }
|
|
#provisioner "shell" {
|
|
#script = "${var.setup_script}"
|
|
#execute_command = "python -c 'import pty; pty.spawn(\"/bin/bash\")'; echo 'vagrant' | su -c sh -c '{{ .Vars }} {{ .Path }}'"
|
|
#}
|
|
|
|
post-processor "vagrant" {
|
|
keep_input_artifact = false
|
|
output = "package.box"
|
|
}
|
|
}
|