|
|
|
|
@ -28,6 +28,40 @@ this example can be applied to other builders as well.
|
|
|
|
|
Here is an extremely basic virtualbox-iso template:
|
|
|
|
|
|
|
|
|
|
<Tabs>
|
|
|
|
|
<Tab heading="HCL2">
|
|
|
|
|
|
|
|
|
|
```hcl
|
|
|
|
|
source "virtualbox-iso" "step_1" {
|
|
|
|
|
boot_command = ["<esc><wait>", "<esc><wait>", "<enter><wait>",
|
|
|
|
|
"/install/vmlinuz<wait>", " initrd=/install/initrd.gz",
|
|
|
|
|
" auto-install/enable=true", " debconf/priority=critical",
|
|
|
|
|
" preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ubuntu_preseed.cfg<wait>",
|
|
|
|
|
" -- <wait>", "<enter><wait>"]
|
|
|
|
|
disk_size = "40960"
|
|
|
|
|
guest_os_type = "Ubuntu_64"
|
|
|
|
|
http_directory = "./http"
|
|
|
|
|
iso_checksum = "sha256:946a6077af6f5f95a51f82fdc44051c7aa19f9cfc5f737954845a6050543d7c2"
|
|
|
|
|
iso_url = "http://old-releases.ubuntu.com/releases/14.04.1/ubuntu-14.04-server-amd64.iso"
|
|
|
|
|
shutdown_command = "echo 'vagrant' | sudo -S shutdown -P now"
|
|
|
|
|
ssh_password = "vagrant"
|
|
|
|
|
ssh_port = 22
|
|
|
|
|
ssh_username = "vagrant"
|
|
|
|
|
vm_name = "vbox-example"
|
|
|
|
|
}
|
|
|
|
|
build {
|
|
|
|
|
sources = ["source.virtualbox-iso.step_1"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
provisioner "shell" {
|
|
|
|
|
inline = ["echo initial provisioning"]
|
|
|
|
|
}
|
|
|
|
|
post-processor "manifest" {
|
|
|
|
|
output = "stage-1-manifest.json"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
</Tab>
|
|
|
|
|
<Tab heading="JSON">
|
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
@ -77,40 +111,6 @@ Here is an extremely basic virtualbox-iso template:
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
</Tab>
|
|
|
|
|
<Tab heading="HCL2">
|
|
|
|
|
|
|
|
|
|
```hcl
|
|
|
|
|
source "virtualbox-iso" "step_1" {
|
|
|
|
|
boot_command = ["<esc><wait>", "<esc><wait>", "<enter><wait>",
|
|
|
|
|
"/install/vmlinuz<wait>", " initrd=/install/initrd.gz",
|
|
|
|
|
" auto-install/enable=true", " debconf/priority=critical",
|
|
|
|
|
" preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ubuntu_preseed.cfg<wait>",
|
|
|
|
|
" -- <wait>", "<enter><wait>"]
|
|
|
|
|
disk_size = "40960"
|
|
|
|
|
guest_os_type = "Ubuntu_64"
|
|
|
|
|
http_directory = "./http"
|
|
|
|
|
iso_checksum = "sha256:946a6077af6f5f95a51f82fdc44051c7aa19f9cfc5f737954845a6050543d7c2"
|
|
|
|
|
iso_url = "http://old-releases.ubuntu.com/releases/14.04.1/ubuntu-14.04-server-amd64.iso"
|
|
|
|
|
shutdown_command = "echo 'vagrant' | sudo -S shutdown -P now"
|
|
|
|
|
ssh_password = "vagrant"
|
|
|
|
|
ssh_port = 22
|
|
|
|
|
ssh_username = "vagrant"
|
|
|
|
|
vm_name = "vbox-example"
|
|
|
|
|
}
|
|
|
|
|
build {
|
|
|
|
|
sources = ["source.virtualbox-iso.step_1"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
provisioner "shell" {
|
|
|
|
|
inline = ["echo initial provisioning"]
|
|
|
|
|
}
|
|
|
|
|
post-processor "manifest" {
|
|
|
|
|
output = "stage-1-manifest.json"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
</Tab>
|
|
|
|
|
</Tabs>
|
|
|
|
|
|
|
|
|
|
@ -138,6 +138,29 @@ That output filename generated in the first stage can be used as the
|
|
|
|
|
for the virtualbox-ovf builder.
|
|
|
|
|
|
|
|
|
|
<Tabs>
|
|
|
|
|
<Tab heading="HCL2">
|
|
|
|
|
|
|
|
|
|
```hcl
|
|
|
|
|
source "virtualbox-ovf" "step_2" {
|
|
|
|
|
shutdown_command = "echo 'vagrant' | sudo -S shutdown -P now"
|
|
|
|
|
source_path = "output-virtualbox-iso/vbox-example.ovf"
|
|
|
|
|
ssh_password = "vagrant"
|
|
|
|
|
ssh_port = 22
|
|
|
|
|
ssh_username = "vagrant"
|
|
|
|
|
vm_name = "virtualbox-example-ovf"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
build {
|
|
|
|
|
sources = ["source.virtualbox-ovf.step_2"]
|
|
|
|
|
|
|
|
|
|
provisioner "shell" {
|
|
|
|
|
inline = ["echo secondary provisioning"]
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
</Tab>
|
|
|
|
|
<Tab heading="JSON">
|
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
@ -164,29 +187,6 @@ for the virtualbox-ovf builder.
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
</Tab>
|
|
|
|
|
<Tab heading="HCL2">
|
|
|
|
|
|
|
|
|
|
```hcl
|
|
|
|
|
source "virtualbox-ovf" "step_2" {
|
|
|
|
|
shutdown_command = "echo 'vagrant' | sudo -S shutdown -P now"
|
|
|
|
|
source_path = "output-virtualbox-iso/vbox-example.ovf"
|
|
|
|
|
ssh_password = "vagrant"
|
|
|
|
|
ssh_port = 22
|
|
|
|
|
ssh_username = "vagrant"
|
|
|
|
|
vm_name = "virtualbox-example-ovf"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
build {
|
|
|
|
|
sources = ["source.virtualbox-ovf.step_2"]
|
|
|
|
|
|
|
|
|
|
provisioner "shell" {
|
|
|
|
|
inline = ["echo secondary provisioning"]
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
</Tab>
|
|
|
|
|
</Tabs>
|
|
|
|
|
|
|
|
|
|
@ -203,6 +203,28 @@ being used with a null builder, and manually sets the artifact from our
|
|
|
|
|
stage-2 ovf build:
|
|
|
|
|
|
|
|
|
|
<Tabs>
|
|
|
|
|
<Tab heading="HCL2">
|
|
|
|
|
|
|
|
|
|
```hcl
|
|
|
|
|
source "null" "step_3" {
|
|
|
|
|
communicator = "none"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
build {
|
|
|
|
|
sources = ["source.null.step_3"]
|
|
|
|
|
|
|
|
|
|
post-processors {
|
|
|
|
|
post-processor "artifice" {
|
|
|
|
|
files = ["output-virtualbox-ovf/virtualbox-example-ovf.ovf", "output-virtualbox-ovf/virtualbox-example-ovf-disk001.vmdk"]
|
|
|
|
|
}
|
|
|
|
|
post-processor "vagrant" {
|
|
|
|
|
provider_override = "virtualbox"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
</Tab>
|
|
|
|
|
<Tab heading="JSON">
|
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
@ -231,28 +253,6 @@ stage-2 ovf build:
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
</Tab>
|
|
|
|
|
<Tab heading="HCL2">
|
|
|
|
|
|
|
|
|
|
```hcl
|
|
|
|
|
source "null" "step_3" {
|
|
|
|
|
communicator = "none"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
build {
|
|
|
|
|
sources = ["source.null.step_3"]
|
|
|
|
|
|
|
|
|
|
post-processors {
|
|
|
|
|
post-processor "artifice" {
|
|
|
|
|
files = ["output-virtualbox-ovf/virtualbox-example-ovf.ovf", "output-virtualbox-ovf/virtualbox-example-ovf-disk001.vmdk"]
|
|
|
|
|
}
|
|
|
|
|
post-processor "vagrant" {
|
|
|
|
|
provider_override = "virtualbox"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
</Tab>
|
|
|
|
|
</Tabs>
|
|
|
|
|
|
|
|
|
|
|