-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-proxmox.archlinux.pkr.hcl
117 lines (96 loc) · 2.42 KB
/
build-proxmox.archlinux.pkr.hcl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
locals {
image_full_name = "${var.image_name}-${formatdate("YYMMDD", timestamp())}"
}
variable "image_name" {
type = string
default = "archlinux"
}
variable "cpus" {
type = number
default = 2
}
variable "memory" {
type = number
default = 1024
}
variable "disk_size" {
type = string
default = "30G"
}
variable "iso_checksum" {
type = string
}
variable "iso_url" {
type = string
}
variable "proxmox_node" {
type = string
}
variable "proxmox_url" {
type = string
}
variable "proxmox_username" {
type = string
}
variable "proxmox_password" {
type = string
}
source "proxmox-iso" "archlinux" {
iso_checksum = "${var.iso_checksum}"
iso_url = "${var.iso_url}"
iso_storage_pool = "local"
unmount_iso = true
proxmox_url = "${var.proxmox_url}"
insecure_skip_tls_verify = true
username = "${var.proxmox_username}"
password = "${var.proxmox_password}"
node = "${var.proxmox_node}"
tags = "packer,${var.image_name}"
cores = "${var.cpus}"
memory = "${var.memory}"
os = "l26"
machine = "q35"
disks {
disk_size = "${var.disk_size}"
storage_pool = "local-lvm"
type = "virtio"
}
network_adapters {
bridge = "vmbr0"
model = "virtio"
}
ssh_timeout = "3600s"
ssh_username = "root"
ssh_password = "secret"
vm_id = "1000"
template_description = "${local.image_full_name}, generated on ${timestamp()}"
template_name = "${local.image_full_name}"
boot_command = [
"<wait10><enter>",
"<wait10><wait10><wait10><wait10><wait10><wait10>",
"<enter><wait>",
"curl -sfSLO http://{{ .HTTPIP }}:{{ .HTTPPort }}/install.sh<enter><wait>",
"curl -sfSLO http://{{ .HTTPIP }}:{{ .HTTPPort }}/partition.sh<enter><wait>",
"curl -sfSLO http://{{ .HTTPIP }}:{{ .HTTPPort }}/install-chroot.sh<enter><wait>",
"curl -sfSLO http://{{ .HTTPIP }}:{{ .HTTPPort }}/packer.sh<enter><wait>",
"chmod +x *.sh<enter>",
"./install.sh<enter>"
]
boot_wait = "10s"
http_directory = "./http"
bios = "ovmf"
efi_config {
efi_storage_pool = "local-lvm"
pre_enrolled_keys = false
efi_type = "4m"
}
}
build {
sources = [
"source.proxmox-iso.archlinux"
]
provisioner "ansible" {
playbook_file = "provisioning/playbook.yml"
extra_arguments = ["--scp-extra-args", "'-O'", "--skip-tags", "ansible_skip_handlers"]
}
}