-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathubuntu.pkr.hcl
71 lines (62 loc) · 1.79 KB
/
ubuntu.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
packer {
required_plugins {
proxmox = {
version = " >= 1.0.1"
source = "github.com/hashicorp/proxmox"
}
}
}
source "proxmox-iso" "ubuntu" {
proxmox_url = "https://${var.proxmox_host}/api2/json"
node = var.proxmox_node
username = var.proxmox_user
password = var.proxmox_password
token = var.proxmox_token
iso_url = var.iso
iso_checksum = var.iso_checksum
iso_storage_pool = var.iso_storage_pool
unmount_iso = true
vm_id = var.vmid
vm_name = var.template_name
template_description = var.template_description
os = var.os
memory = var.memory
cores = var.cores
sockets = var.sockets
qemu_agent = true
cloud_init = var.enable_cloud_init
cloud_init_storage_pool = var.disk_pool
disks {
type = "scsi"
disk_size = var.disk_size
storage_pool = var.disk_pool
storage_pool_type = var.disk_pool_type
format = "raw"
}
network_adapters {
model = "virtio"
bridge = "vmbr0"
}
ssh_username = var.ssh_user
ssh_password = var.ssh_password
ssh_timeout = "30m"
http_directory = "${path.root}/http"
insecure_skip_tls_verify = true
boot_wait = var.boot_wait
boot_command = var.boot_command
}
build {
sources = ["source.proxmox-iso.ubuntu"]
provisioner "ansible" {
playbook_file = "${path.root}/ansible/cleanup.yml"
inventory_directory = pathexpand("~/.ansible/inventory")
ansible_env_vars = [
"ANSIBLE_REMOTE_TMP=/tmp/ansible",
]
extra_arguments = [
"--vault-password-file=~/.vault-key",
"--extra-vars",
"ansible_become_pass=${var.ssh_password}",
]
}
}