diff --git a/docs/builders/xenserver-iso.html.markdown b/docs/builders/xenserver-iso.html.markdown
index 0108a14..687ad5f 100644
--- a/docs/builders/xenserver-iso.html.markdown
+++ b/docs/builders/xenserver-iso.html.markdown
@@ -2,7 +2,7 @@
layout: "docs"
page_title: "XenServer Builder (from an ISO)"
description: |-
- The XenServer Packer builder is able to create XenServer virtual machines and export them either as an XVA or a VDI, starting from an ISO image.
+ The XenServer Packer builder is able to create XenServer virtual machines and export them either as an XVA or a VDI and create VM templates starting from an ISO image.
---
# XenServer Builder (from an ISO)
@@ -18,32 +18,6 @@ the OS, then shutting it down. The result of the XenServer builder is a
directory containing all the files necessary to run the virtual machine
portably.
-## Basic Example
-
-Here is a basic example. This example is not functional. Even when the
-`remote_*` fields have been completed, 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:
-
-```javascript
-{
- "type": "xenserver-iso",
- "remote_host": "your-server.example.com",
- "remote_username": "root",
- "remote_password": "password",
- "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",
- "ssh_wait_timeout": "30s",
- "shutdown_command": "echo 'packer' | sudo -S shutdown -P now"
-}
-```
-
-It is important to add a `shutdown_command`. By default Packer forcibly halts the
-virtual machine and the file system may not be sync'd. Thus, changes made in a
-provisioner might not be saved.
## Configuration Reference
@@ -69,7 +43,7 @@ each category, the available options are alphabetized and described.
If this is an HTTP URL, Packer will download it and cache it between
runs.
-* `remote_host` (string) - The host of the remote machine.
+* `remote_host` (string) - The host of the Xenserver / XCP-ng pool primary. Typically these will be specified through environment variables as seen in the [examples](examples/centos8.json).
* `remote_username` (string) - The XenServer username used to access the remote machine.
@@ -85,7 +59,7 @@ each category, the available options are alphabetized and described.
be to type just enough to initialize the operating system installer. Special
keys can be typed as well, and are covered in the section below on the boot
command. If this is not specified, it is assumed the installer will start
- itself.
+ itself. See the [Ubuntu](examples/ubuntu-2004.json) and [centos](examples/centos8.json) examples to see how these are used to launch autoinstall and kickstart respectively.
* `boot_wait` (string) - The time to wait after booting the initial virtual
machine before typing the `boot_command`. The value of this should be
@@ -278,19 +252,4 @@ The available variables are:
configuration parameter. If `http_directory` isn't specified, these will be
blank!
-Example boot command. This is actually a working boot command used to start
-an Ubuntu 12.04 installer:
-
-```javascript
-[
- "<esc><esc><enter><wait>",
- "/install/vmlinuz noapic ",
- "preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg ",
- "debian-installer=en_US auto locale=en_US kbd-chooser/method=us ",
- "hostname={{ .Name }} ",
- "fb=false debconf/frontend=noninteractive ",
- "keyboard-configuration/modelcode=SKIP keyboard-configuration/layout=USA ",
- "keyboard-configuration/variant=USA console-setup/ask_detect=false ",
- "initrd=/install/initrd.gz -- <enter>"
-]
-```
+See the [examples](examples/) for working boot commands.
diff --git a/examples/README.md b/examples/README.md
index e69de29..b0d3b61 100644
--- a/examples/README.md
+++ b/examples/README.md
@@ -0,0 +1,33 @@
+## Examples
+
+In order for new users to get up and running with the packer builder, a few examples of building a machine image with popular distros have been created. At the time of this writing there are examples for the latest Ubuntu (20.04) and Centos (8.3) releases. Please open an issue if you'd like to see an example for another distro.
+
+In order to see an exhaustive list of configuration options for the packer builder please see the [following documentation](docs/builders/xenserver-iso.html.markdown). This doc will focus on the details relevant to the particular distro.
+
+### Running the examples
+
+In order to run this example you will need to perform the following steps:
+1. Ensure that you are running packer from a machine on the same subnet as the VM packer will be launching. This can be overriden with the `network_names` builder configuration if needed.
+2. Export the `XAPI_HOST`, `XAPI_USERNAME` and `XAPI_PASSWORD` environment variables to the current shell. Note: The `XAPI_HOST` must be the resource pool primary.
+3. Run the `packer build` command specifying the storage repositories to use for the ISO upload and for the VM created during the build.
+
+```
+# Replace sr_name and sr_iso_name with your storage repositories names
+packer build -debug --var sr_name='Local storage' --var sr_iso_name=LocalISO examples/centos8.json
+
+# Do the same variable replacement for the ubuntu example as well.
+packer build -debug --var sr_name='Local storage' --var sr_iso_name=LocalISO examples/ubuntu-2004.json
+```
+
+### Ubuntu
+
+The Ubuntu example uses the [autoinstall tool](https://ubuntu.com/server/docs/install/autoinstallhttps://ubuntu.com/server/docs/install/autoinstall) to configure the VM template. Please see the [autoinstall docs](https://ubuntu.com/server/docs/install/autoinstall-reference) for an exhaustive list of what is supported.
+
+Packer will create a http server to serve the files as specified from the `http_directory` specified in the builder configuration. This is where the [user-data](examples/http/ubuntu-2004/user-data) and [meta-data](examples/http/ubuntu-2004/meta-data) for autoinstall must be present.
+
+
+### Centos
+
+The centos example uses kickstart to configure the VM template. Please see the [kickstart documentation](https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/installation_guide/sect-kickstart-syntax) for the options that are supported.
+
+Packer will create a http server to serve the files as specified from the `http_directory` specified in the builder configuration. This is where the [kickstart config](examples/http/centos8/ks-centos8.cfg) file must be present.
diff --git a/examples/centos8.json b/examples/centos8.json
index b4c3b6b..c0c778b 100644
--- a/examples/centos8.json
+++ b/examples/centos8.json
@@ -30,7 +30,7 @@
"conversionvm":"true"
},
"output_directory": "packer-centos-8.3-x86_64-xenserver",
- "shutdown_command": "/sbin/halt",
+ "shutdown_command": "/sbin/shutdown",
"ssh_username": "vagrant",
"ssh_password": "vagrant",
"ssh_wait_timeout": "10000s",
diff --git a/examples/ubuntu-2004.json b/examples/ubuntu-2004.json
index 1d23836..b06b3b3 100644
--- a/examples/ubuntu-2004.json
+++ b/examples/ubuntu-2004.json
@@ -29,12 +29,8 @@
"vm_other_config": {
"conversionvm":"true"
},
- "network_names": [
- "Host internal management network",
- "Pool-wide network associated with eth0"
- ],
"output_directory": "packer-ubuntu-2004-x86_64-xenserver",
- "shutdown_command": "/sbin/halt",
+ "shutdown_command": "/sbin/shutdown",
"ssh_username": "testuser",
"ssh_password": "ubuntu",
"ssh_wait_timeout": "60000s",