diff --git a/docs/builders/qemu.mdx b/docs/builders/qemu.mdx index 85a758c..e7d0333 100644 --- a/docs/builders/qemu.mdx +++ b/docs/builders/qemu.mdx @@ -26,7 +26,8 @@ necessary to run the virtual machine on KVM. Here is a basic example. This example is functional so long as you fixup paths to files, URLS for ISOs and checksums. -**HCL2** + + ```hcl source "qemu" "example" { @@ -53,7 +54,8 @@ build { } ``` -**JSON** + + ```json { @@ -83,6 +85,9 @@ build { } ``` + + + This is an example only, and will time out waiting for SSH because we have not provided a kickstart file. You must add a valid kickstart file to the "http_directory" and then provide the file in the "boot_command" in order for @@ -107,7 +112,7 @@ references for [ISO](#iso-configuration), configuration references, which are necessary for this build to succeed and can be found further down the page. -### Optional: +Optional fields: @include 'builder/qemu/Config-not-required.mdx' @@ -115,11 +120,11 @@ necessary for this build to succeed and can be found further down the page. @include 'packer-plugin-sdk/multistep/commonsteps/ISOConfig.mdx' -### Required: +Required fields: @include 'packer-plugin-sdk/multistep/commonsteps/ISOConfig-required.mdx' -### Optional: +Optional fields: @include 'packer-plugin-sdk/multistep/commonsteps/ISOConfig-not-required.mdx' @@ -127,7 +132,7 @@ necessary for this build to succeed and can be found further down the page. @include 'packer-plugin-sdk/multistep/commonsteps/HTTPConfig.mdx' -### Optional: +Optional fields: @include 'packer-plugin-sdk/multistep/commonsteps/HTTPConfig-not-required.mdx' @@ -135,33 +140,33 @@ necessary for this build to succeed and can be found further down the page. @include 'packer-plugin-sdk/multistep/commonsteps/FloppyConfig.mdx' -### Optional: +Optional fields: @include 'packer-plugin-sdk/multistep/commonsteps/FloppyConfig-not-required.mdx' -### CD configuration +## CD configuration @include 'packer-plugin-sdk/multistep/commonsteps/CDConfig.mdx' -#### Optional: +Optional fields: @include 'packer-plugin-sdk/multistep/commonsteps/CDConfig-not-required.mdx' ## Shutdown configuration -### Optional: +Optional fields: @include 'packer-plugin-sdk/shutdowncommand/ShutdownConfig-not-required.mdx' ## Communicator configuration -### Optional common fields: +Optional fields: @include 'packer-plugin-sdk/communicator/Config-not-required.mdx' @include 'builder/qemu/CommConfig-not-required.mdx' -### Optional SSH fields: +### SSH Communicator fields: @include 'packer-plugin-sdk/communicator/SSH-not-required.mdx' @@ -169,44 +174,10 @@ necessary for this build to succeed and can be found further down the page. @include 'packer-plugin-sdk/communicator/SSHTemporaryKeyPair-not-required.mdx' -### Optional WinRM fields: +### WinRM Communicator fields: @include 'packer-plugin-sdk/communicator/WinRM-not-required.mdx' -## Boot Configuration - -@include 'packer-plugin-sdk/bootcommand/VNCConfig.mdx' - -@include 'packer-plugin-sdk/bootcommand/BootConfig.mdx' - -### Optional: - -@include 'packer-plugin-sdk/bootcommand/VNCConfig-not-required.mdx' - -@include 'packer-plugin-sdk/bootcommand/BootConfig-not-required.mdx' - -## EFI Boot Configuration - -@include 'builder/qemu/QemuEFIBootConfig.mdx' - -### Optional - -@include 'builder/qemu/QemuEFIBootConfig-not-required.mdx' - -## SMP Configuration - -@include 'builder/qemu/QemuSMPConfig.mdx' - -### Optional - -@include 'builder/qemu/QemuSMPConfig-not-required.mdx' - -### Communicator Configuration - -#### Optional: - -@include 'packer-plugin-sdk/communicator/Config-not-required.mdx' - ### SSH key pair automation The QEMU builder can inject the current SSH key pair's public key into @@ -225,22 +196,27 @@ be accessed using the template engine. For example, the public key can be provided in the boot command as a URL encoded string by appending `| urlquery` to the variable: -In JSON: + + -```json -"boot_command": [ +```hcl +boot_command = [ " text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ks.cfg PACKER_USER={{ user `username` }} PACKER_AUTHORIZED_KEY={{ .SSHPublicKey | urlquery }}" ] ``` -In HCL2: + + -```hcl -boot_command = [ +```json +"boot_command": [ " text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ks.cfg PACKER_USER={{ user `username` }} PACKER_AUTHORIZED_KEY={{ .SSHPublicKey | urlquery }}" ] ``` + + + A kickstart could then leverage those fields from the kernel command line by decoding the URL-encoded public key: @@ -278,7 +254,35 @@ fi %end ``` -### Troubleshooting +## Boot Configuration + +@include 'packer-plugin-sdk/bootcommand/VNCConfig.mdx' + +@include 'packer-plugin-sdk/bootcommand/BootConfig.mdx' + +Optional fields: + +@include 'packer-plugin-sdk/bootcommand/VNCConfig-not-required.mdx' + +@include 'packer-plugin-sdk/bootcommand/BootConfig-not-required.mdx' + +## EFI Boot Configuration + +@include 'builder/qemu/QemuEFIBootConfig.mdx' + +Optional fields: + +@include 'builder/qemu/QemuEFIBootConfig-not-required.mdx' + +## SMP Configuration + +@include 'builder/qemu/QemuSMPConfig.mdx' + +Optional fields: + +@include 'builder/qemu/QemuSMPConfig-not-required.mdx' + +## Troubleshooting #### Invalid Keymaps