Packer: Sample file for Openstack

1.9k views Asked by At

Can someone please provide me with a sample file for Packer creating OS image? I have this one:

{
  "builders": [{
    "type": "openstack",
    "ssh_username": "ubuntu",
    "tenant_name": "mytenant",
    "flavor": "m1.tiny",
    "identity_endpoint": "http://1.2.3.4:5000/",
    "availability_zone": "az1",
    "source_image": "Ubuntu 16.04 With Proxy",
    "image_name": "Ubuntu 16.04 With Proxy and Python"
  }],

  "provisioners": [
    {
      "type": "shell",
      "script": "python.sh"
    }
  ]

}

but OS always returns:

==> openstack: Error launching source server: Invalid request due to incorrect syntax or missing required parameters.

I have no idea what I am missing.

Of course i have correct OS_ env values preset for my Nova API.

1

There are 1 answers

3
Rickard von Essen On

You have to use source_image_name or use the ID to reference the image

From the docs:

  • source_image (string) - The ID or full URL to the base image to use. This is the image that will be used to launch a new server and provision it. Unless you specify completely custom SSH settings, the source image must have cloud-init installed so that the keypair gets assigned properly.

  • source_image_name (string) - The name of the base image to use. This is an alternative way of providing source_image and only either of them can be specified.

See source_image