-
Notifications
You must be signed in to change notification settings - Fork 6
/
foundry-appliance.pkr.hcl
125 lines (117 loc) · 3.9 KB
/
foundry-appliance.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
118
119
120
121
122
123
124
125
packer {
required_plugins {
vmware = {
version = "~> 1"
source = "github.com/hashicorp/vmware"
}
vsphere = {
version = "~> 1"
source = "github.com/hashicorp/vsphere"
}
virtualbox = {
version = "~> 1"
source = "github.com/hashicorp/virtualbox"
}
}
}
source "virtualbox-iso" "foundry-appliance" {
boot_command = "${local.boot_command}"
boot_wait = "5s"
cpus = "${local.cpus}"
disk_size = "${local.disk_size}"
gfx_controller = "vmsvga"
guest_os_type = "Ubuntu_64"
hard_drive_interface = "scsi"
http_directory = "http"
iso_checksum = "${local.iso_checksum}"
iso_url = "${local.iso_url}"
memory = "${local.memory}"
output_directory = "output-virtualbox"
rtc_time_base = "UTC"
shutdown_command = "${local.shutdown_command}"
ssh_password = "${var.ssh_password}"
ssh_timeout = "60m"
ssh_username = "${var.ssh_username}"
vboxmanage = [
["modifyvm", "{{.Name}}", "--vram", "${local.video_memory}"],
["modifyvm", "{{.Name}}", "--nat-localhostreachable1", "on"],
]
vm_name = "foundry-appliance-${var.appliance_version}"
}
source "vmware-iso" "foundry-appliance" {
boot_command = "${local.boot_command}"
boot_wait = "5s"
cpus = "${local.cpus}"
disk_size = "${local.disk_size}"
guest_os_type = "ubuntu-64"
http_directory = "http"
iso_checksum = "${local.iso_checksum}"
iso_url = "${local.iso_url}"
memory = "${local.memory}"
network = "nat"
network_adapter_type = "vmxnet3"
output_directory = "output-vmware"
shutdown_command = "${local.shutdown_command}"
ssh_password = "${var.ssh_password}"
ssh_timeout = "60m"
ssh_username = "${var.ssh_username}"
version = "14"
vm_name = "foundry-appliance-${var.appliance_version}"
}
source "vsphere-iso" "foundry-appliance" {
boot_command = "${local.boot_command}"
boot_wait = "5s"
cluster = "${var.vsphere_cluster}"
CPUs = "${local.cpus}"
datastore = "${var.vsphere_datastore}"
guest_os_type = "ubuntu64Guest"
http_directory = "http"
insecure_connection = true
iso_checksum = "${local.iso_checksum}"
iso_url = "${local.iso_url}"
network_adapters {
network = "${var.vsphere_network}"
network_card = "vmxnet3"
}
password = "${var.vsphere_password}"
RAM = "${local.memory}"
shutdown_command = "${local.shutdown_command}"
ssh_password = "${var.ssh_password}"
ssh_timeout = "60m"
ssh_username = "${var.ssh_username}"
storage {
disk_size = "${local.disk_size}"
disk_thin_provisioned = true
}
username = "${var.vsphere_username}"
vcenter_server = "${var.vcenter_server}"
video_ram = "${local.video_memory}"
vm_name = "foundry-appliance-${var.appliance_version}"
}
build {
sources = [
"source.virtualbox-iso.foundry-appliance",
"source.vmware-iso.foundry-appliance",
"source.vsphere-iso.foundry-appliance"
]
provisioner "file" {
destination = "/home/${var.ssh_username}"
source = "./foundry"
}
provisioner "file" {
destination = "/home/${var.ssh_username}"
source = "./mkdocs"
}
provisioner "shell" {
execute_command = "echo '${var.ssh_password}' | {{ .Vars }} sudo -E -S bash '{{ .Path }}'"
environment_vars = [
"DEBIAN_FRONTEND=noninteractive",
"APPLIANCE_VERSION=${var.appliance_version}",
"SSH_USERNAME=${var.ssh_username}",
]
script = "setup-appliance"
}
provisioner "shell" {
inline = ["~/foundry/install.sh"]
}
}