diff --git a/website/pages/docs/builders/virtualbox/iso.mdx b/website/pages/docs/builders/virtualbox/iso.mdx index 941fd0297..9e27f169e 100644 --- a/website/pages/docs/builders/virtualbox/iso.mdx +++ b/website/pages/docs/builders/virtualbox/iso.mdx @@ -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: + + + ```json { "type": "virtualbox-iso", @@ -41,6 +44,29 @@ self-install. Still, the example serves to show the basic configuration: } ``` + + + +```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"] +} +``` + + + + 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. diff --git a/website/pages/docs/builders/virtualbox/ovf.mdx b/website/pages/docs/builders/virtualbox/ovf.mdx index 3f556c12e..ba0d8a353 100644 --- a/website/pages/docs/builders/virtualbox/ovf.mdx +++ b/website/pages/docs/builders/virtualbox/ovf.mdx @@ -40,6 +40,9 @@ build. Here is a basic example. This example is functional if you have an OVF matching the settings here. + + + ```json { "type": "virtualbox-ovf", @@ -50,6 +53,25 @@ the settings here. } ``` + + + +```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"] +} +``` + + + + 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. diff --git a/website/pages/docs/builders/virtualbox/vm.mdx b/website/pages/docs/builders/virtualbox/vm.mdx index 90a3bc151..12ac15401 100644 --- a/website/pages/docs/builders/virtualbox/vm.mdx +++ b/website/pages/docs/builders/virtualbox/vm.mdx @@ -29,6 +29,9 @@ from the applied provisioners. Here is a basic example. which serves to show the basic configuration: + + + ```json { "type": "virtualbox-vm", @@ -49,6 +52,35 @@ Here is a basic example. which serves to show the basic configuration: } ``` + + + +```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"] +} +``` + + + + 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.