-
Notifications
You must be signed in to change notification settings - Fork 14
/
packer.pkr.hcl
101 lines (95 loc) · 6.26 KB
/
packer.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
source "parallels-iso" "freebsd" {
boot_command = ["<esc><wait>", "boot -s<enter>", "<wait15s>", "/bin/sh<enter><wait>", "mdmfs -s 100m md /tmp<enter><wait>", "dhclient -l /tmp/dhclient.lease.vtnet0 vtnet0<enter><wait5>", "fetch -o /tmp/installerconfig http://{{ .HTTPIP }}:{{ .HTTPPort }}/installerconfig<enter><wait5>", "FILESYSTEM=${var.filesystem}<enter>", "export FILESYSTEM<enter>", "ZFS_COMPRESSION=${var.zfs_compression}<enter>", "export ZFS_COMPRESSION<enter>", "RC_CONF_FILE=${var.rc_conf_file}<enter>", "export RC_CONF_FILE<enter>", "bsdinstall script /tmp/installerconfig<enter>"]
boot_wait = "10s"
cpus = "${var.cpus}"
disk_size = "${var.disk_size}"
parallels_tools_mode = "disable"
guest_os_type = "other"
hard_drive_interface = "sata"
http_directory = "http"
iso_checksum = "file:${var.mirror}/${var.directory}/ISO-IMAGES/${var.revision}/CHECKSUM.SHA256-FreeBSD-${var.revision}-${var.branch}-${var.arch}${var.build_date}${var.git_commit}"
iso_urls = ["iso/FreeBSD-${var.revision}-${var.branch}-${var.arch}${var.build_date}${var.git_commit}-disc1.iso", "${var.mirror}/${var.directory}/ISO-IMAGES/${var.revision}/FreeBSD-${var.revision}-${var.branch}-${var.arch}${var.build_date}${var.git_commit}-disc1.iso"]
memory = "${var.memory}"
shutdown_command = "poweroff"
ssh_password = "vagrant"
ssh_port = 22
ssh_timeout = "1000s"
ssh_username = "root"
vm_name = "box"
}
source "qemu" "freebsd" {
boot_command = ["<esc><wait>", "boot -s<enter>", "<wait15s>", "/bin/sh<enter><wait>", "mdmfs -s 100m md /tmp<enter><wait>", "dhclient -l /tmp/dhclient.lease.vtnet0 vtnet0<enter><wait5>", "fetch -o /tmp/installerconfig http://{{ .HTTPIP }}:{{ .HTTPPort }}/installerconfig<enter><wait5>", "FILESYSTEM=${var.filesystem}<enter>", "export FILESYSTEM<enter>", "ZFS_COMPRESSION=${var.zfs_compression}<enter>", "export ZFS_COMPRESSION<enter>", "RC_CONF_FILE=${var.rc_conf_file}<enter>", "export RC_CONF_FILE<enter>", "bsdinstall script /tmp/installerconfig<enter>"]
boot_wait = "5s"
cpus = "${var.cpus}"
disk_size = "${var.disk_size}"
headless = true
http_directory = "http"
iso_checksum = "file:${var.mirror}/${var.directory}/ISO-IMAGES/${var.revision}/CHECKSUM.SHA256-FreeBSD-${var.revision}-${var.branch}-${var.arch}${var.build_date}${var.git_commit}"
iso_urls = ["iso/FreeBSD-${var.revision}-${var.branch}-${var.arch}${var.build_date}${var.git_commit}-disc1.iso", "${var.mirror}/${var.directory}/ISO-IMAGES/${var.revision}/FreeBSD-${var.revision}-${var.branch}-${var.arch}${var.build_date}${var.git_commit}-disc1.iso"]
memory = "${var.memory}"
shutdown_command = "poweroff"
ssh_password = "vagrant"
ssh_port = 22
ssh_timeout = "1000s"
ssh_username = "root"
vm_name = "box"
}
source "virtualbox-iso" "freebsd" {
boot_command = ["<esc><wait>", "boot -s<enter>", "<wait15s>", "/bin/sh<enter><wait>", "mdmfs -s 100m md /tmp<enter><wait>", "dhclient -l /tmp/dhclient.lease.vtnet0 vtnet0<enter><wait5>", "fetch -o /tmp/installerconfig http://{{ .HTTPIP }}:{{ .HTTPPort }}/installerconfig<enter><wait5>", "FILESYSTEM=${var.filesystem}<enter>", "export FILESYSTEM<enter>", "ZFS_COMPRESSION=${var.zfs_compression}<enter>", "export ZFS_COMPRESSION<enter>", "RC_CONF_FILE=${var.rc_conf_file}<enter>", "export RC_CONF_FILE<enter>", "bsdinstall script /tmp/installerconfig<enter>"]
boot_wait = "10s"
cpus = "${var.cpus}"
disk_size = "${var.disk_size}"
export_opts = ["--manifest", "--vsys", "0", "--product", "FreeBSD-${var.revision}-${var.branch}-${var.arch}${var.build_date}", "--producturl", "https://www.freebsd.org", "--description", "FreeBSD is an operating system used to power modern servers, desktops, and embedded platforms.", "--version", "${var.revision}-${var.branch}"]
guest_additions_mode = "disable"
guest_os_type = "${var.guest_os_type}"
hard_drive_interface = "sata"
headless = true
http_directory = "http"
iso_checksum = "file:${var.mirror}/${var.directory}/ISO-IMAGES/${var.revision}/CHECKSUM.SHA256-FreeBSD-${var.revision}-${var.branch}-${var.arch}${var.build_date}${var.git_commit}"
iso_interface = "sata"
iso_urls = ["iso/FreeBSD-${var.revision}-${var.branch}-${var.arch}${var.build_date}${var.git_commit}-disc1.iso", "${var.mirror}/${var.directory}/ISO-IMAGES/${var.revision}/FreeBSD-${var.revision}-${var.branch}-${var.arch}${var.build_date}${var.git_commit}-disc1.iso"]
memory = "${var.memory}"
shutdown_command = "poweroff"
ssh_password = "vagrant"
ssh_port = 22
ssh_timeout = "1000s"
ssh_username = "root"
vboxmanage = [["modifyvm", "{{ .Name }}", "--graphicscontroller", "vmsvga", "--nictype1", "virtio"], ["storagectl", "{{ .Name }}", "--name", "IDE Controller", "--remove"]]
virtualbox_version_file = ".vbox_version"
vm_name = "box"
}
build {
sources = [
"source.parallels-iso.freebsd",
"source.qemu.freebsd",
"source.virtualbox-iso.freebsd"
]
provisioner "shell" {
execute_command = "chmod +x {{ .Path }}; env {{ .Vars }} {{ .Path }}"
scripts = ["scripts/update.sh", "scripts/vagrant.sh", "scripts/zeroconf.sh", "scripts/ansible.sh", "scripts/vmtools.sh", "scripts/cleanup.sh"]
}
post-processor "vagrant" {
output = "builds/FreeBSD-${var.revision}-${var.branch}-${var.arch}${var.build_date}${var.git_commit}.box"
vagrantfile_template = "vagrantfile.tpl"
}
}
packer {
required_plugins {
parallels = {
source = "github.com/parallels/parallels"
version = ">= 1.1.5"
}
qemu = {
source = "github.com/hashicorp/qemu"
version = "~> 1"
}
vagrant = {
source = "github.com/hashicorp/vagrant"
version = "~> 1"
}
virtualbox = {
source = "github.com/hashicorp/virtualbox"
version = "~> 1"
}
}
}