Packer Builder Plugin

This builder plugin extends to support building images at IONOS.

Packer is generally used in conjunction with an additional configuration management solution, such as Puppet, to create customized images.

The image properties are defined in a JSON configuration file. Packer will create a temporary Virtual Data Center and related resources at IONOS using the specified parameters. A snapshot will be taken when the build is complete, and then the temporary Virtual Data Center and associated resources will be removed. The snapshot will then be available for use.


  • Packer >= v0.10.1

If compiling the builder plugin:

  • Go (tested with 1.6)
  • Godep >= v62

Install Packer

Please visit the Packer download page and download the appropriate file for your target operating system and architecture.

Packer is distributed in a zip file, so use an unzip tool on your system to unpack the archive. It will contain a single binary named packer. The executable for Microsoft Windows will be named packer.exe. This file needs to be placed somewhere on your system, ideally in a location included in the $PATH environment variable. (/usr/local/bin/)

Please Note: There may be another binary named packer present on your system. We have noticed that on CentOS 7 there is a program /usr/sbin/packer, which could be executed inadvertently unless you specify the full path to the packer binary that you wish to invoke.

You can quickly verify that packer is working by running it and passing the version parameter:

$ packer version

Packer v0.10.1

The installation instructions for Packer may be helpful if something doesn't seem to be working properly.

Download the Plugin

You can download prebuilt binaries for various operating systems from ProfitBricks Packer Builder Project Releases. The binary is distributed in a .tar.gz archive for Linux/Mac. You'll need to extract it by running tar -xzvf <filename> when using Linux. On a Mac, it may be automatically unzipped when downloaded, in which case tar -xvf <filename> will extract the binary from the uncompressed tarball. The Windows binary is contained in a .zip archive which can be opened in Windows Explorer, or using other tools such as 7-zip.

After you have downloaded the binary for your operating system:

  • For Linux/Mac: Place packer-builder-profitbricks in the ~/.packer.d/plugins directory.
  • For Windows: Place packer-builder-profitbricks.exe in the %APPDATA%/packer.d/plugins directory.

Compile the Plugin

If a prebuilt binary is not available for your desired operating system and architecture, you have the option to compile the plugin yourself.

Install Go

The Go programming language needs to be installed on your system to compile the plugin. If it is not already present you may wish to consult the official instructions to install Go.

Various Linux distributions have golang available for installation from a package repository. The version available may be out-of-date. For instance, recent releases of Ubuntu and CentOS will install Go 1.4 if you run apt-get install golang or yum install golang respectively. If you would like to have a newer version, you could add an additional repository that contains newer versions of the golang packages. When working on Ubuntu, you can follow the suggestions available in the Go wiki on GitHub.

It is important to have the Go environment variables ($GOPATH, $GOBIN, etc.) properly configured. You can see the current values by running go env at the command prompt or shell. $GOPATH is generally set to something like: /home/your_username/work That results in the creation of bin/, pkg/, and src/ directories under /home/your_username/work/ which will hold your Go projects.

Install Godep

If Go is installed and configured, it should be possible to install godep by running:

go get

The go get operation may require that git be installed if it is unable to locate it on your system.

When installed, the source code will be located in $GOPATH/src/ and a new binary, godep will be in $GOPATH/bin/.


Now that the dependencies are met, we can continue with compiling the builder plugin.

First we use go get to grab the source from

go get

Change into the project directory:

cd $GOPATH/src/

Compile by running:

make install

When the build completes the resulting binary will be placed in:

  • Linux/Mac: the ~/.packer.d/plugins directory.
  • Windows: the %APPDATA%/packer.d/plugins directory.

Please confirm that the binary is in the right location before continuing.


Now that we have packer and packer-builder-profitbricks in place we can go through an example.

If you compiled the plugin, lets change into the project directory:

cd $GOPATH/src/

There you will find a sample config.json

  "builders": [
      "snapshot_name" : "builder_doc_test",
      "username": "pb_username",
      "password": "pb_password",
      "cores": "1",
      "ram": "2048",
      "disk_type": "HDD",
      "disk_size": "10",
      "timeout": "50"
  "provisioners": [
      "inline": [
        "echo foo"
      "type": "shell"

Edit the file and replace the "pb_username" and "pb_password" with your ProfitBricks credentials. You also have the option of storing your ProfitBricks credentials in local environment variables like this:

export PROFITBRICKS_USERNAME="pb_username"
export PROFITBRICKS_PASSWORD="pb_password"

and then the lines:

"username": "pb_username",
"password": "pb_password",

can be excluded from config.json.

If you are using the prebuilt packer builder binary, then create a config.json file based on the example above.

Once we have customized our config.json we can use packer to validate it:

packer validate config.json

which should respond with:

Template validated successfully.

If you get other output, it should provide some guidance as to what may need to be corrected:

Template validation failed. Errors are shown below.

Errors validating build 'profitbricks'. 1 error(s) occurred:

* unknown configuration key: "passwd"

The output provides a clue that we need to look at the configuration key "passwd". It should be "password".

To build an image run:

$ packer build config.json
profitbricks output will be in this color.

==> profitbricks: Creating temporary SSH key for instance...
    profitbricks: Saving key to: pb_builder_doc_test
==> profitbricks: Creating Virtual Data Center...
==> profitbricks: Waiting for SSH to become available...
==> profitbricks: Connected to SSH!
==> profitbricks: Provisioning with shell script: /tmp/packer-shell631340488
    profitbricks: foo
==> profitbricks: Creating ProfitBricks snapshot...
==> profitbricks: Removing Virtual Data Center...

Build 'profitbricks' finished.

==> Builds finished. The artifacts of successful builds are:
--> profitbricks: A snapshot was created: 'builder_doc_test'

As the output indicates, there is now a snapshot named "builder_doc_test" available in your ProfitBricks account. You can see snapshots in the Data Center Designer (DCD) on the Snapshots tab of the Image Manager.

The output could contain other helpful information or warnings such as:

    ==> profitbricks: Error deleting Virtual Data Center. Please destroy it manually: [VDC-5-627] An invalid plan has been generated, error message Virtual Storage f3150c97-2e0b-4fad-b1e3-d0b89745991a is locked for create snapshot

That indicates that the packer build wasn't able to clean up after itself and remove the temporary data center and resources because the snapshot creation operation was taking longer than the value of the default "timeout" parameter allowed for.

Config Parameters

This table summarizes the parameters that can be set inside the config.json file.

Parameter Name Required Description Default Value
type Yes Builder type. This should be set to "profitbricks".
username Yes* ProfitBricks username, generally an e-mail address.
password Yes* ProfitBricks password.
snapshot_name No The name given to the snapshot created during the packer build process. You probably want to set this to something descriptive in order to keep your snapshots organized. Generated based on the current timestamp.
snapshot_password No A password associated with the resulting snapshot. The password must contain 8-50 characters. Only these characters are allowed: [abcdefghjkmnpqrstuvxABCDEFGHJKLMNPQRSTUVX23456789]
ssh_key_path No Path to a private SSH key. Supplying a SSH key allows you to easily access servers created from the snapshot. Generated based on the current timestamp.
image No A ProfitBricks image name. Partial matches are permitted. Ubuntu-16.04
location No The ProfitBricks data center location. This is relevant because snapshots are only available in the location in which they were created. Options are "de/fra", "de/fkb", or "us/las". us/las
disk_size No The amount of disk space in GB. 50
disk_type No The disk type, either SSD or HDD. This is for the temporary disk created while generating the snapshot. You have the option to use either disk type later when provisioning with the resulting snapshot. HDD
cores No The number of processor cores. 4
ram No The amount of RAM in MB. 2048
timeout No An approximate limit on how long packer will continue making status requests while waiting for the build to complete. Set this to an integer where 1 equals 10 seconds. 50 (~500 seconds)
url No The ProfitBricks Cloud API URL.
  • The environment variables PROFITBRICKS_USERNAME and PROFITBRICKS_PASSWORD can be set instead of providing these values in config.json.


You are welcome to contact us with questions or comments using the Community section of IONOS DevOps Central. Please report any issues with the builder plugin itself via GitHub's issue tracker.