add basic docs for virtualbox

This commit is contained in:
Adrien Delorme 2020-06-16 16:56:07 +02:00
parent 8930c4b913
commit 831c16836a
3 changed files with 80 additions and 0 deletions

View File

@ -28,6 +28,9 @@ Here is a basic example. This example is not functional. It will start the OS
installer but then fail because we don't provide the preseed file for Ubuntu to
self-install. Still, the example serves to show the basic configuration:
<Tabs>
<Tab heading="JSON">
```json
{
"type": "virtualbox-iso",
@ -41,6 +44,29 @@ self-install. Still, the example serves to show the basic configuration:
}
```
</Tab>
<Tab heading="HCL2">
```hcl
source "virtualbox-iso" "basic-example" {
guest_os_type = "Ubuntu_64"
iso_url = "http://releases.ubuntu.com/12.04/ubuntu-12.04.5-server-amd64.iso"
iso_checksum = "769474248a3897f4865817446f9a4a53"
iso_checksum_type = "md5"
ssh_username = "packer"
ssh_password = "packer"
shutdown_command = "echo 'packer' | sudo -S shutdown -P now"
}
build {
sources = ["sources.virtualbox-iso.basic-example"]
}
```
</Tab>
</Tabs>
It is important to add a `shutdown_command`. By default Packer halts the virtual
machine and the file system may not be sync'd. Thus, changes made in a
provisioner might not be saved.

View File

@ -40,6 +40,9 @@ build.
Here is a basic example. This example is functional if you have an OVF matching
the settings here.
<Tabs>
<Tab heading="JSON">
```json
{
"type": "virtualbox-ovf",
@ -50,6 +53,25 @@ the settings here.
}
```
</Tab>
<Tab heading="HCL2">
```hcl
source "virtualbox-ovf" "basic-example" {
source_path = "source.ovf"
ssh_username = "packer"
ssh_password = "packer"
shutdown_command = "echo 'packer' | sudo -S shutdown -P now"
}
build {
sources = ["sources.virtualbox-ovf.basic-example"]
}
```
</Tab>
</Tabs>
It is important to add a `shutdown_command`. By default Packer halts the virtual
machine and the file system may not be sync'd. Thus, changes made in a
provisioner might not be saved.

View File

@ -29,6 +29,9 @@ from the applied provisioners.
Here is a basic example. which serves to show the basic configuration:
<Tabs>
<Tab heading="JSON">
```json
{
"type": "virtualbox-vm",
@ -49,6 +52,35 @@ Here is a basic example. which serves to show the basic configuration:
}
```
</Tab>
<Tab heading="HCL2">
```hcl
source "virtualbox-vm" "basic-example" {
communicator = "winrm"
headless = "{{user `headless`}}"
winrm_username = "vagrant"
winrm_password = "vagrant"
winrm_timeout = "2h"
shutdown_command = "shutdown /s /t 10 /f /d p:4:1 /c \"Packer Shutdown\""
guest_additions_mode = "disable"
output_directory = "./builds-vm"
vm_name = "target-vm"
attach_snapshot = "Snapshot"
target_snapshot = "Target-Snapshot"
force_delete_snapshot = true
keep_registered = false
skip_export = false
}
build {
sources = ["sources.virtualbox-vm.basic-example"]
}
```
</Tab>
</Tabs>
It is important to add a `shutdown_command`. By default Packer halts the virtual
machine and the file system may not be sync'd. Thus, changes made in a
provisioner might not be saved.