0
votes

I'm working with Packer and trying to see how I can create OpenStack Machine Images by writing a JSON file. I have installed packer on one of the OpenStack ubuntu instances and created a JSON file as below for creating a custom image.

{
  "builders": [{
  "type": "openstack",
  "identity_endpoint": "http://192.168.8.25:5000/v3/",
  "tenant_name": "admin",
  "domain_name": "Default",
  "username": "admin",
  "password": "adminpass",
  "region": "RegionOne",
  "ssh_username": "root",
  "image_name": "Test image",
  "source_image": "f4dcbbde-b702-4f3c-b5f1-0230ebdf0ed4",
  "flavor": "m1.medium",
  "insecure": "true"
  }]
}

While running a "packer build" commond I'm getting the below error

openstack: Error loading extensions: Get http://controller:8774/v2.1/079923bd0ea04700b1b6d7e047139b45/extensions: dial tcp: lookup controller on 8.8.8.8:53: no such host. Builds finished but no artifacts were created.

So can anyone, please look into the error and help me out please..

3

3 Answers

1
votes

Most likely your OpenStack system is misconfigured or your workstation/laptop.

Packer is trying to query the OpenStack for which extensions it supports and somehow it asks the public Google DNS (8.8.8.8:53) how to resolve controller which obviously is not a correct (public) DNS name.

Check the response from openstack extensions list -f yaml and check your DNS settings. If you can't find any issue raise an issue with the support of your OpenStack system.

0
votes

Code for creating ubuntu image with JAVA(OpenJDK), Tomcat using packer..

{

"builders": [{

"type": "openstack",

"identity_endpoint": "http://192.168.8.25:5000/v3/",

"tenant_name": "admin",

"domain_name": "default",

"username": "admin",

"password": "MiracleIT",

"region": "RegionOne",

"ssh_username": "ubuntu",

"image_name": "UBUNTU 14.04 JAVA TOMCAT Server PACKER",

"source_image": "913ef163-e2aa-4161-85d4-16a9924abfa1",

"flavor": "m1.small",

"networks": ["6e4c7854-a817-4022-b5c5-20d72373f469"],

"insecure": "true"

}],

"provisioners": [{ "type": "shell", "inline": [ "sleep 30",

"sudo apt-get update",

"sudo apt-get install -y openjdk-7-jre", "sudo apt-get install -y tomcat7" ] }]

}

0
votes

Here is the JSON code which worked for me in creating centos images for the OpenStack using Packer.

{

"builders": [{

"type": "openstack",

"identity_endpoint": "http://192.168.8.25:5000/v3/",

"tenant_name": "admin",

"domain_name": "default",

"username": "admin",

"password": "MiracleIT",

"region": "RegionOne",

"ssh_username": "centos",

"image_name": "CentOS 7 Server Cloud-Init",

"source_image": "8cbff151-05bc-4ae5-babc-6be5acb7fee4",

"flavor": "m1.medium",

"networks": ["6e4c7854-a817-4022-b5c5-20d72373f469"],

"insecure": "true"

}]

}