packer-plugin-xenserver/examples
2021-01-02 23:52:00 -08:00
..
http Add start of centos 8 and ubuntu 20.04 examples 2020-12-31 00:02:37 -08:00
centos8.json Update documentation with changes from upstream, fix shutdown command for examples 2021-01-02 23:52:00 -08:00
README.md Update documentation with changes from upstream, fix shutdown command for examples 2021-01-02 23:52:00 -08:00
ubuntu-2004.json Update documentation with changes from upstream, fix shutdown command for examples 2021-01-02 23:52:00 -08:00

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. 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 to configure the VM template. Please see the autoinstall docs 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 and meta-data for autoinstall must be present.

Centos

The centos example uses kickstart to configure the VM template. Please see the kickstart documentation 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 file must be present.