openstack: document using partials from struct conf
This commit is contained in:
parent
4a61dc3670
commit
67d96d5103
|
@ -18,75 +18,72 @@ import (
|
||||||
|
|
||||||
// AccessConfig is for common configuration related to openstack access
|
// AccessConfig is for common configuration related to openstack access
|
||||||
type AccessConfig struct {
|
type AccessConfig struct {
|
||||||
// The username or id used to connect to
|
// The username or id used to connect to the OpenStack service. If not
|
||||||
// the OpenStack service. If not specified, Packer will use the environment
|
// specified, Packer will use the environment variable OS_USERNAME or
|
||||||
// variable OS_USERNAME or OS_USERID, if set. This is not required if
|
// OS_USERID, if set. This is not required if using access token or
|
||||||
// using access token or application credential instead of password, or if using
|
|
||||||
// cloud.yaml.
|
|
||||||
Username string `mapstructure:"username" required:"true"`
|
|
||||||
UserID string `mapstructure:"user_id"`
|
|
||||||
// The password used to connect to the OpenStack
|
|
||||||
// service. If not specified, Packer will use the environment variables
|
|
||||||
// OS_PASSWORD, if set. This is not required if using access token or
|
|
||||||
// application credential instead of password, or if using cloud.yaml.
|
// application credential instead of password, or if using cloud.yaml.
|
||||||
|
Username string `mapstructure:"username" required:"true"`
|
||||||
|
// Sets username
|
||||||
|
UserID string `mapstructure:"user_id"`
|
||||||
|
// The password used to connect to the OpenStack service. If not specified,
|
||||||
|
// Packer will use the environment variables OS_PASSWORD, if set. This is
|
||||||
|
// not required if using access token or application credential instead of
|
||||||
|
// password, or if using cloud.yaml.
|
||||||
Password string `mapstructure:"password" required:"true"`
|
Password string `mapstructure:"password" required:"true"`
|
||||||
// The URL to the OpenStack Identity service.
|
// The URL to the OpenStack Identity service. If not specified, Packer will
|
||||||
// If not specified, Packer will use the environment variables OS_AUTH_URL,
|
// use the environment variables OS_AUTH_URL, if set. This is not required
|
||||||
// if set. This is not required if using cloud.yaml.
|
// if using cloud.yaml.
|
||||||
IdentityEndpoint string `mapstructure:"identity_endpoint" required:"true"`
|
IdentityEndpoint string `mapstructure:"identity_endpoint" required:"true"`
|
||||||
// The tenant ID or name to boot the
|
// The tenant ID or name to boot the instance into. Some OpenStack
|
||||||
// instance into. Some OpenStack installations require this. If not specified,
|
// installations require this. If not specified, Packer will use the
|
||||||
// Packer will use the environment variable OS_TENANT_NAME or
|
// environment variable OS_TENANT_NAME or OS_TENANT_ID, if set. Tenant is
|
||||||
// OS_TENANT_ID, if set. Tenant is also called Project in later versions of
|
// also called Project in later versions of OpenStack.
|
||||||
// OpenStack.
|
|
||||||
TenantID string `mapstructure:"tenant_id" required:"false"`
|
TenantID string `mapstructure:"tenant_id" required:"false"`
|
||||||
TenantName string `mapstructure:"tenant_name"`
|
TenantName string `mapstructure:"tenant_name"`
|
||||||
DomainID string `mapstructure:"domain_id"`
|
DomainID string `mapstructure:"domain_id"`
|
||||||
// The Domain name or ID you are
|
// The Domain name or ID you are authenticating with. OpenStack
|
||||||
// authenticating with. OpenStack installations require this if identity v3 is
|
// installations require this if identity v3 is used. Packer will use the
|
||||||
// used. Packer will use the environment variable OS_DOMAIN_NAME or
|
// environment variable OS_DOMAIN_NAME or OS_DOMAIN_ID, if set.
|
||||||
// OS_DOMAIN_ID, if set.
|
|
||||||
DomainName string `mapstructure:"domain_name" required:"false"`
|
DomainName string `mapstructure:"domain_name" required:"false"`
|
||||||
// Whether or not the connection to OpenStack can be
|
// Whether or not the connection to OpenStack can be done over an insecure
|
||||||
// done over an insecure connection. By default this is false.
|
// connection. By default this is false.
|
||||||
Insecure bool `mapstructure:"insecure" required:"false"`
|
Insecure bool `mapstructure:"insecure" required:"false"`
|
||||||
// The name of the region, such as "DFW", in which to
|
// The name of the region, such as "DFW", in which to launch the server to
|
||||||
// launch the server to create the image. If not specified, Packer will use
|
// create the image. If not specified, Packer will use the environment
|
||||||
// the environment variable OS_REGION_NAME, if set.
|
// variable OS_REGION_NAME, if set.
|
||||||
Region string `mapstructure:"region" required:"false"`
|
Region string `mapstructure:"region" required:"false"`
|
||||||
// The endpoint type to use. Can be any of
|
// The endpoint type to use. Can be any of "internal", "internalURL",
|
||||||
// "internal", "internalURL", "admin", "adminURL", "public", and "publicURL".
|
// "admin", "adminURL", "public", and "publicURL". By default this is
|
||||||
// By default this is "public".
|
// "public".
|
||||||
EndpointType string `mapstructure:"endpoint_type" required:"false"`
|
EndpointType string `mapstructure:"endpoint_type" required:"false"`
|
||||||
// Custom CA certificate file path. If omitted the
|
// Custom CA certificate file path. If omitted the OS_CACERT environment
|
||||||
// OS_CACERT environment variable can be used.
|
// variable can be used.
|
||||||
CACertFile string `mapstructure:"cacert" required:"false"`
|
CACertFile string `mapstructure:"cacert" required:"false"`
|
||||||
// Client certificate file path for SSL client
|
// Client certificate file path for SSL client authentication. If omitted
|
||||||
// authentication. If omitted the OS_CERT environment variable can be used.
|
// the OS_CERT environment variable can be used.
|
||||||
ClientCertFile string `mapstructure:"cert" required:"false"`
|
ClientCertFile string `mapstructure:"cert" required:"false"`
|
||||||
// Client private key file path for SSL client
|
// Client private key file path for SSL client authentication. If omitted
|
||||||
// authentication. If omitted the OS_KEY environment variable can be used.
|
// the OS_KEY environment variable can be used.
|
||||||
ClientKeyFile string `mapstructure:"key" required:"false"`
|
ClientKeyFile string `mapstructure:"key" required:"false"`
|
||||||
// the token (id) to use with token based authorization.
|
// the token (id) to use with token based authorization. Packer will use
|
||||||
// Packer will use the environment variable OS_TOKEN, if set.
|
// the environment variable OS_TOKEN, if set.
|
||||||
Token string `mapstructure:"token" required:"false"`
|
Token string `mapstructure:"token" required:"false"`
|
||||||
// The application credential name to
|
// The application credential name to use with application credential based
|
||||||
// use with application credential based authorization. Packer will use the
|
// authorization. Packer will use the environment variable
|
||||||
// environment variable OS_APPLICATION_CREDENTIAL_NAME, if set.
|
// OS_APPLICATION_CREDENTIAL_NAME, if set.
|
||||||
ApplicationCredentialName string `mapstructure:"application_credential_name" required:"false"`
|
ApplicationCredentialName string `mapstructure:"application_credential_name" required:"false"`
|
||||||
// The application credential id to
|
// The application credential id to use with application credential based
|
||||||
// use with application credential based authorization. Packer will use the
|
// authorization. Packer will use the environment variable
|
||||||
// environment variable OS_APPLICATION_CREDENTIAL_ID, if set.
|
// OS_APPLICATION_CREDENTIAL_ID, if set.
|
||||||
ApplicationCredentialID string `mapstructure:"application_credential_id" required:"false"`
|
ApplicationCredentialID string `mapstructure:"application_credential_id" required:"false"`
|
||||||
// The application credential secret
|
// The application credential secret to use with application credential
|
||||||
// to use with application credential based authorization. Packer will use the
|
// based authorization. Packer will use the environment variable
|
||||||
// environment variable OS_APPLICATION_CREDENTIAL_SECRET, if set.
|
// OS_APPLICATION_CREDENTIAL_SECRET, if set.
|
||||||
ApplicationCredentialSecret string `mapstructure:"application_credential_secret" required:"false"`
|
ApplicationCredentialSecret string `mapstructure:"application_credential_secret" required:"false"`
|
||||||
// An entry in a clouds.yaml file. See the OpenStack
|
// An entry in a `clouds.yaml` file. See the OpenStack os-client-config
|
||||||
// os-client-config
|
// [documentation](https://docs.openstack.org/os-client-config/latest/user/configuration.html)
|
||||||
// documentation
|
// for more information about `clouds.yaml` files. If omitted, the
|
||||||
// for more information about clouds.yaml files. If omitted, the OS_CLOUD
|
// `OS_CLOUD` environment variable is used.
|
||||||
// environment variable is used.
|
|
||||||
Cloud string `mapstructure:"cloud" required:"false"`
|
Cloud string `mapstructure:"cloud" required:"false"`
|
||||||
|
|
||||||
osClient *gophercloud.ProviderClient
|
osClient *gophercloud.ProviderClient
|
||||||
|
@ -210,8 +207,8 @@ func (c *AccessConfig) Prepare(ctx *interpolate.Context) []error {
|
||||||
tls_config.RootCAs = caCertPool
|
tls_config.RootCAs = caCertPool
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we have insecure set, then create a custom HTTP client that
|
// If we have insecure set, then create a custom HTTP client that ignores
|
||||||
// ignores SSL errors.
|
// SSL errors.
|
||||||
if c.Insecure {
|
if c.Insecure {
|
||||||
tls_config.InsecureSkipVerify = true
|
tls_config.InsecureSkipVerify = true
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,21 +14,18 @@ import (
|
||||||
type ImageConfig struct {
|
type ImageConfig struct {
|
||||||
// The name of the resulting image.
|
// The name of the resulting image.
|
||||||
ImageName string `mapstructure:"image_name" required:"true"`
|
ImageName string `mapstructure:"image_name" required:"true"`
|
||||||
// Glance metadata that will be
|
// Glance metadata that will be applied to the image.
|
||||||
// applied to the image.
|
|
||||||
ImageMetadata map[string]string `mapstructure:"metadata" required:"false"`
|
ImageMetadata map[string]string `mapstructure:"metadata" required:"false"`
|
||||||
// One of "public", "private", "shared", or
|
// One of "public", "private", "shared", or "community".
|
||||||
// "community".
|
|
||||||
ImageVisibility imageservice.ImageVisibility `mapstructure:"image_visibility" required:"false"`
|
ImageVisibility imageservice.ImageVisibility `mapstructure:"image_visibility" required:"false"`
|
||||||
// List of members to add to the image
|
// List of members to add to the image after creation. An image member is
|
||||||
// after creation. An image member is usually a project (also called the
|
// usually a project (also called the "tenant") with whom the image is
|
||||||
// "tenant") with whom the image is shared.
|
// shared.
|
||||||
ImageMembers []string `mapstructure:"image_members" required:"false"`
|
ImageMembers []string `mapstructure:"image_members" required:"false"`
|
||||||
// Disk format of the resulting image. This
|
// Disk format of the resulting image. This option works if
|
||||||
// option works if use_blockstorage_volume is true.
|
// use_blockstorage_volume is true.
|
||||||
ImageDiskFormat string `mapstructure:"image_disk_format" required:"false"`
|
ImageDiskFormat string `mapstructure:"image_disk_format" required:"false"`
|
||||||
// List of tags to add to the image after
|
// List of tags to add to the image after creation.
|
||||||
// creation.
|
|
||||||
ImageTags []string `mapstructure:"image_tags" required:"false"`
|
ImageTags []string `mapstructure:"image_tags" required:"false"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,9 +37,9 @@ func (c *ImageConfig) Prepare(ctx *interpolate.Context) []error {
|
||||||
|
|
||||||
// By default, OpenStack seems to create the image with an image_type of
|
// By default, OpenStack seems to create the image with an image_type of
|
||||||
// "snapshot", since it came from snapshotting a VM. A "snapshot" looks
|
// "snapshot", since it came from snapshotting a VM. A "snapshot" looks
|
||||||
// slightly different in the OpenStack UI and OpenStack won't show "snapshot"
|
// slightly different in the OpenStack UI and OpenStack won't show
|
||||||
// images as a choice in the list of images to boot from for a new instance.
|
// "snapshot" images as a choice in the list of images to boot from for a
|
||||||
// See https://github.com/hashicorp/packer/issues/3038
|
// new instance. See https://github.com/hashicorp/packer/issues/3038
|
||||||
if c.ImageMetadata == nil {
|
if c.ImageMetadata == nil {
|
||||||
c.ImageMetadata = map[string]string{"image_type": "image"}
|
c.ImageMetadata = map[string]string{"image_type": "image"}
|
||||||
} else if c.ImageMetadata["image_type"] == "" {
|
} else if c.ImageMetadata["image_type"] == "" {
|
||||||
|
|
|
@ -12,124 +12,154 @@ import (
|
||||||
"github.com/hashicorp/packer/template/interpolate"
|
"github.com/hashicorp/packer/template/interpolate"
|
||||||
)
|
)
|
||||||
|
|
||||||
// RunConfig contains configuration for running an instance from a source
|
// RunConfig contains configuration for running an instance from a source image
|
||||||
// image and details on how to access that launched image.
|
// and details on how to access that launched image.
|
||||||
type RunConfig struct {
|
type RunConfig struct {
|
||||||
Comm communicator.Config `mapstructure:",squash"`
|
Comm communicator.Config `mapstructure:",squash"`
|
||||||
// The ID or full URL to the base image to use. This
|
// The ID or full URL to the base image to use. This is the image that will
|
||||||
// is the image that will be used to launch a new server and provision it.
|
// be used to launch a new server and provision it. Unless you specify
|
||||||
// Unless you specify completely custom SSH settings, the source image must
|
// completely custom SSH settings, the source image must have cloud-init
|
||||||
// have cloud-init installed so that the keypair gets assigned properly.
|
// installed so that the keypair gets assigned properly.
|
||||||
SourceImage string `mapstructure:"source_image" required:"true"`
|
SourceImage string `mapstructure:"source_image" required:"true"`
|
||||||
// The name of the base image to use. This is
|
// The name of the base image to use. This is an alternative way of
|
||||||
// an alternative way of providing source_image and only either of them can
|
// providing source_image and only either of them can be specified.
|
||||||
// be specified.
|
|
||||||
SourceImageName string `mapstructure:"source_image_name" required:"true"`
|
SourceImageName string `mapstructure:"source_image_name" required:"true"`
|
||||||
// The search filters for determining the base
|
// Filters used to populate filter options. Example:
|
||||||
// image to use. This is an alternative way of providing source_image and
|
//
|
||||||
// only one of these methods can be used. source_image will override the
|
// ``` json {
|
||||||
// filters.
|
// "source_image_filter": {
|
||||||
|
// "filters": {
|
||||||
|
// "name": "ubuntu-16.04",
|
||||||
|
// "visibility": "protected",
|
||||||
|
// "owner": "d1a588cf4b0743344508dc145649372d1",
|
||||||
|
// "tags": ["prod", "ready"],
|
||||||
|
// "properties": {
|
||||||
|
// "os_distro": "ubuntu"
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// "most_recent": true
|
||||||
|
// }
|
||||||
|
// } ```
|
||||||
|
//
|
||||||
|
// This selects the most recent production Ubuntu 16.04 shared to you by
|
||||||
|
// the given owner. NOTE: This will fail unless *exactly* one image is
|
||||||
|
// returned, or `most_recent` is set to true. In the example of multiple
|
||||||
|
// returned images, `most_recent` will cause this to succeed by selecting
|
||||||
|
// the newest image of the returned images.
|
||||||
|
//
|
||||||
|
// - `filters` (map of strings) - filters used to select a
|
||||||
|
// `source_image`.
|
||||||
|
// NOTE: This will fail unless *exactly* one image is returned, or
|
||||||
|
// `most_recent` is set to true. Of the filters described in
|
||||||
|
// [ImageService](https://developer.openstack.org/api-ref/image/v2/), the
|
||||||
|
// following are valid:
|
||||||
|
//
|
||||||
|
// - name (string)
|
||||||
|
//
|
||||||
|
// - owner (string)
|
||||||
|
//
|
||||||
|
// - tags (array of strings)
|
||||||
|
//
|
||||||
|
// - visibility (string)
|
||||||
|
//
|
||||||
|
// - properties (map of strings to strings) (fields that can be set
|
||||||
|
// with `openstack image set --property key=value`)
|
||||||
|
//
|
||||||
|
// - `most_recent` (boolean) - Selects the newest created image when
|
||||||
|
// true.
|
||||||
|
// This is most useful for selecting a daily distro build.
|
||||||
|
//
|
||||||
|
// You may set use this in place of `source_image` If `source_image_filter`
|
||||||
|
// is provided alongside `source_image`, the `source_image` will override
|
||||||
|
// the filter. The filter will not be used in this case.
|
||||||
SourceImageFilters ImageFilter `mapstructure:"source_image_filter" required:"true"`
|
SourceImageFilters ImageFilter `mapstructure:"source_image_filter" required:"true"`
|
||||||
// The ID, name, or full URL for the desired flavor for
|
// The ID, name, or full URL for the desired flavor for the server to be
|
||||||
// the server to be created.
|
// created.
|
||||||
Flavor string `mapstructure:"flavor" required:"true"`
|
Flavor string `mapstructure:"flavor" required:"true"`
|
||||||
// The availability zone to launch the server
|
// The availability zone to launch the server in. If this isn't specified,
|
||||||
// in. If this isn't specified, the default enforced by your OpenStack cluster
|
// the default enforced by your OpenStack cluster will be used. This may be
|
||||||
// will be used. This may be required for some OpenStack clusters.
|
// required for some OpenStack clusters.
|
||||||
AvailabilityZone string `mapstructure:"availability_zone" required:"false"`
|
AvailabilityZone string `mapstructure:"availability_zone" required:"false"`
|
||||||
// For rackspace, whether or not to wait for
|
// For rackspace, whether or not to wait for Rackconnect to assign the
|
||||||
// Rackconnect to assign the machine an IP address before connecting via SSH.
|
// machine an IP address before connecting via SSH. Defaults to false.
|
||||||
// Defaults to false.
|
|
||||||
RackconnectWait bool `mapstructure:"rackconnect_wait" required:"false"`
|
RackconnectWait bool `mapstructure:"rackconnect_wait" required:"false"`
|
||||||
// The ID or name of an external network that
|
// The ID or name of an external network that can be used for creation of a
|
||||||
// can be used for creation of a new floating IP.
|
// new floating IP.
|
||||||
FloatingIPNetwork string `mapstructure:"floating_ip_network" required:"false"`
|
FloatingIPNetwork string `mapstructure:"floating_ip_network" required:"false"`
|
||||||
// A specific floating IP to assign to this instance.
|
// A specific floating IP to assign to this instance.
|
||||||
FloatingIP string `mapstructure:"floating_ip" required:"false"`
|
FloatingIP string `mapstructure:"floating_ip" required:"false"`
|
||||||
// Whether or not to attempt to reuse existing
|
// Whether or not to attempt to reuse existing unassigned floating ips in
|
||||||
// unassigned floating ips in the project before allocating a new one. Note
|
// the project before allocating a new one. Note that it is not possible to
|
||||||
// that it is not possible to safely do this concurrently, so if you are
|
// safely do this concurrently, so if you are running multiple openstack
|
||||||
// running multiple openstack builds concurrently, or if other processes are
|
// builds concurrently, or if other processes are assigning and using
|
||||||
// assigning and using floating IPs in the same openstack project while packer
|
// floating IPs in the same openstack project while packer is running, you
|
||||||
// is running, you should not set this to true. Defaults to false.
|
// should not set this to true. Defaults to false.
|
||||||
ReuseIPs bool `mapstructure:"reuse_ips" required:"false"`
|
ReuseIPs bool `mapstructure:"reuse_ips" required:"false"`
|
||||||
// A list of security groups by name to
|
// A list of security groups by name to add to this instance.
|
||||||
// add to this instance.
|
|
||||||
SecurityGroups []string `mapstructure:"security_groups" required:"false"`
|
SecurityGroups []string `mapstructure:"security_groups" required:"false"`
|
||||||
// A list of networks by UUID to attach to
|
// A list of networks by UUID to attach to this instance.
|
||||||
// this instance.
|
|
||||||
Networks []string `mapstructure:"networks" required:"false"`
|
Networks []string `mapstructure:"networks" required:"false"`
|
||||||
// A list of ports by UUID to attach to this
|
// A list of ports by UUID to attach to this instance.
|
||||||
// instance.
|
|
||||||
Ports []string `mapstructure:"ports" required:"false"`
|
Ports []string `mapstructure:"ports" required:"false"`
|
||||||
// User data to apply when launching the instance. Note
|
// User data to apply when launching the instance. Note that you need to be
|
||||||
// that you need to be careful about escaping characters due to the templates
|
// careful about escaping characters due to the templates being JSON. It is
|
||||||
// being JSON. It is often more convenient to use user_data_file, instead.
|
// often more convenient to use user_data_file, instead. Packer will not
|
||||||
// Packer will not automatically wait for a user script to finish before
|
// automatically wait for a user script to finish before shutting down the
|
||||||
// shutting down the instance this must be handled in a provisioner.
|
// instance this must be handled in a provisioner.
|
||||||
UserData string `mapstructure:"user_data" required:"false"`
|
UserData string `mapstructure:"user_data" required:"false"`
|
||||||
// Path to a file that will be used for the user
|
// Path to a file that will be used for the user data when launching the
|
||||||
// data when launching the instance.
|
// instance.
|
||||||
UserDataFile string `mapstructure:"user_data_file" required:"false"`
|
UserDataFile string `mapstructure:"user_data_file" required:"false"`
|
||||||
// Name that is applied to the server instance
|
// Name that is applied to the server instance created by Packer. If this
|
||||||
// created by Packer. If this isn't specified, the default is same as
|
// isn't specified, the default is same as image_name.
|
||||||
// image_name.
|
|
||||||
InstanceName string `mapstructure:"instance_name" required:"false"`
|
InstanceName string `mapstructure:"instance_name" required:"false"`
|
||||||
// Metadata that is
|
// Metadata that is applied to the server instance created by Packer. Also
|
||||||
// applied to the server instance created by Packer. Also called server
|
// called server properties in some documentation. The strings have a max
|
||||||
// properties in some documentation. The strings have a max size of 255 bytes
|
// size of 255 bytes each.
|
||||||
// each.
|
|
||||||
InstanceMetadata map[string]string `mapstructure:"instance_metadata" required:"false"`
|
InstanceMetadata map[string]string `mapstructure:"instance_metadata" required:"false"`
|
||||||
// Whether to force the OpenStack instance to be
|
// Whether to force the OpenStack instance to be forcefully deleted. This
|
||||||
// forcefully deleted. This is useful for environments that have
|
// is useful for environments that have reclaim / soft deletion enabled. By
|
||||||
// reclaim / soft deletion enabled. By default this is false.
|
// default this is false.
|
||||||
ForceDelete bool `mapstructure:"force_delete" required:"false"`
|
ForceDelete bool `mapstructure:"force_delete" required:"false"`
|
||||||
// Whether or not nova should use ConfigDrive for
|
// Whether or not nova should use ConfigDrive for cloud-init metadata.
|
||||||
// cloud-init metadata.
|
|
||||||
ConfigDrive bool `mapstructure:"config_drive" required:"false"`
|
ConfigDrive bool `mapstructure:"config_drive" required:"false"`
|
||||||
// Deprecated use floating_ip_network
|
// Deprecated use floating_ip_network instead.
|
||||||
// instead.
|
|
||||||
FloatingIPPool string `mapstructure:"floating_ip_pool" required:"false"`
|
FloatingIPPool string `mapstructure:"floating_ip_pool" required:"false"`
|
||||||
// Use Block Storage service volume for
|
// Use Block Storage service volume for the instance root volume instead of
|
||||||
// the instance root volume instead of Compute service local volume (default).
|
// Compute service local volume (default).
|
||||||
UseBlockStorageVolume bool `mapstructure:"use_blockstorage_volume" required:"false"`
|
UseBlockStorageVolume bool `mapstructure:"use_blockstorage_volume" required:"false"`
|
||||||
// Name of the Block Storage service volume. If this
|
// Name of the Block Storage service volume. If this isn't specified,
|
||||||
// isn't specified, random string will be used.
|
// random string will be used.
|
||||||
VolumeName string `mapstructure:"volume_name" required:"false"`
|
VolumeName string `mapstructure:"volume_name" required:"false"`
|
||||||
// Type of the Block Storage service volume. If this
|
// Type of the Block Storage service volume. If this isn't specified, the
|
||||||
// isn't specified, the default enforced by your OpenStack cluster will be
|
// default enforced by your OpenStack cluster will be used.
|
||||||
// used.
|
|
||||||
VolumeType string `mapstructure:"volume_type" required:"false"`
|
VolumeType string `mapstructure:"volume_type" required:"false"`
|
||||||
// Size of the Block Storage service volume in GB. If
|
// Size of the Block Storage service volume in GB. If this isn't specified,
|
||||||
// this isn't specified, it is set to source image min disk value (if set) or
|
// it is set to source image min disk value (if set) or calculated from the
|
||||||
// calculated from the source image bytes size. Note that in some cases this
|
// source image bytes size. Note that in some cases this needs to be
|
||||||
// needs to be specified, if use_blockstorage_volume is true.
|
// specified, if use_blockstorage_volume is true.
|
||||||
VolumeSize int `mapstructure:"volume_size" required:"false"`
|
VolumeSize int `mapstructure:"volume_size" required:"false"`
|
||||||
// Availability zone of the Block
|
// Availability zone of the Block Storage service volume. If omitted,
|
||||||
// Storage service volume. If omitted, Compute instance availability zone will
|
// Compute instance availability zone will be used. If both of Compute
|
||||||
// be used. If both of Compute instance and Block Storage volume availability
|
// instance and Block Storage volume availability zones aren't specified,
|
||||||
// zones aren't specified, the default enforced by your OpenStack cluster will
|
// the default enforced by your OpenStack cluster will be used.
|
||||||
// be used.
|
|
||||||
VolumeAvailabilityZone string `mapstructure:"volume_availability_zone" required:"false"`
|
VolumeAvailabilityZone string `mapstructure:"volume_availability_zone" required:"false"`
|
||||||
|
|
||||||
// Not really used, but here for BC
|
// Not really used, but here for BC
|
||||||
OpenstackProvider string `mapstructure:"openstack_provider"`
|
OpenstackProvider string `mapstructure:"openstack_provider"`
|
||||||
// Deprecated use floating_ip or
|
// *Deprecated* use `floating_ip` or `floating_ip_pool` instead.
|
||||||
// floating_ip_pool instead.
|
|
||||||
UseFloatingIp bool `mapstructure:"use_floating_ip" required:"false"`
|
UseFloatingIp bool `mapstructure:"use_floating_ip" required:"false"`
|
||||||
|
|
||||||
sourceImageOpts images.ListOpts
|
sourceImageOpts images.ListOpts
|
||||||
}
|
}
|
||||||
|
|
||||||
type ImageFilter struct {
|
type ImageFilter struct {
|
||||||
// filters used to select a source_image.
|
// filters used to select a source_image. NOTE: This will fail unless
|
||||||
// NOTE: This will fail unless exactly one image is returned, or
|
// exactly one image is returned, or most_recent is set to true. Of the
|
||||||
// most_recent is set to true. Of the filters described in
|
// filters described in ImageService, the following are valid:
|
||||||
// ImageService, the
|
|
||||||
// following are valid:
|
|
||||||
Filters ImageFilterOptions `mapstructure:"filters" required:"false"`
|
Filters ImageFilterOptions `mapstructure:"filters" required:"false"`
|
||||||
// Selects the newest created image when true.
|
// Selects the newest created image when true. This is most useful for
|
||||||
// This is most useful for selecting a daily distro build.
|
// selecting a daily distro build.
|
||||||
MostRecent bool `mapstructure:"most_recent" required:"false"`
|
MostRecent bool `mapstructure:"most_recent" required:"false"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -223,8 +253,8 @@ func (c *RunConfig) Prepare(ctx *interpolate.Context) []error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.UseBlockStorageVolume {
|
if c.UseBlockStorageVolume {
|
||||||
// Use Compute instance availability zone for the Block Storage volume if
|
// Use Compute instance availability zone for the Block Storage volume
|
||||||
// it's not provided.
|
// if it's not provided.
|
||||||
if c.VolumeAvailabilityZone == "" {
|
if c.VolumeAvailabilityZone == "" {
|
||||||
c.VolumeAvailabilityZone = c.AvailabilityZone
|
c.VolumeAvailabilityZone = c.AvailabilityZone
|
||||||
}
|
}
|
||||||
|
@ -235,7 +265,8 @@ func (c *RunConfig) Prepare(ctx *interpolate.Context) []error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if neither ID or image name is provided outside the filter, build the filter
|
// if neither ID or image name is provided outside the filter, build the
|
||||||
|
// filter
|
||||||
if len(c.SourceImage) == 0 && len(c.SourceImageName) == 0 {
|
if len(c.SourceImage) == 0 && len(c.SourceImageName) == 0 {
|
||||||
|
|
||||||
listOpts, filterErr := c.SourceImageFilters.Filters.Build()
|
listOpts, filterErr := c.SourceImageFilters.Filters.Build()
|
||||||
|
|
|
@ -1,467 +0,0 @@
|
||||||
---
|
|
||||||
description: |
|
|
||||||
The openstack Packer builder is able to create new images for use with
|
|
||||||
OpenStack. The builder takes a source image, runs any provisioning necessary on
|
|
||||||
the image after launching it, then creates a new reusable image. This reusable
|
|
||||||
image can then be used as the foundation of new servers that are launched
|
|
||||||
within OpenStack.
|
|
||||||
layout: docs
|
|
||||||
page_title: 'OpenStack - Builders'
|
|
||||||
sidebar_current: 'docs-builders-openstack'
|
|
||||||
---
|
|
||||||
|
|
||||||
# OpenStack Builder
|
|
||||||
|
|
||||||
Type: `openstack`
|
|
||||||
|
|
||||||
The `openstack` Packer builder is able to create new images for use with
|
|
||||||
[OpenStack](http://www.openstack.org). The builder takes a source image, runs
|
|
||||||
any provisioning necessary on the image after launching it, then creates a new
|
|
||||||
reusable image. This reusable image can then be used as the foundation of new
|
|
||||||
servers that are launched within OpenStack. The builder will create temporary
|
|
||||||
keypairs that provide temporary access to the server while the image is being
|
|
||||||
created. This simplifies configuration quite a bit.
|
|
||||||
|
|
||||||
The builder does *not* manage images. Once it creates an image, it is up to you
|
|
||||||
to use it or delete it.
|
|
||||||
|
|
||||||
\~> **Note:** To use OpenStack builder with the OpenStack Newton (Oct 2016)
|
|
||||||
or earlier, we recommend you use Packer v1.1.2 or earlier version.
|
|
||||||
|
|
||||||
\~> **OpenStack Liberty or later requires OpenSSL!** To use the OpenStack
|
|
||||||
builder with OpenStack Liberty (Oct 2015) or later you need to have OpenSSL
|
|
||||||
installed *if you are using temporary key pairs*, i.e. don't use
|
|
||||||
[`ssh_keypair_name`](openstack.html#ssh_keypair_name) nor
|
|
||||||
[`ssh_password`](/docs/templates/communicator.html#ssh_password). All major
|
|
||||||
OS'es have OpenSSL installed by default except Windows. This have been resolved
|
|
||||||
in OpenStack Ocata(Feb 2017).
|
|
||||||
|
|
||||||
\~> **Note:** OpenStack Block Storage volume support is available only for
|
|
||||||
V3 Block Storage API. It's available in OpenStack since Mitaka release (Apr
|
|
||||||
2016).
|
|
||||||
|
|
||||||
## Configuration Reference
|
|
||||||
|
|
||||||
There are many configuration options available for the builder. They are
|
|
||||||
segmented below into two categories: required and optional parameters. Within
|
|
||||||
each category, the available configuration keys are alphabetized.
|
|
||||||
|
|
||||||
In addition to the options listed here, a
|
|
||||||
[communicator](/docs/templates/communicator.html) can be configured for this
|
|
||||||
builder.
|
|
||||||
|
|
||||||
### Required:
|
|
||||||
|
|
||||||
- `flavor` (string) - The ID, name, or full URL for the desired flavor for
|
|
||||||
the server to be created.
|
|
||||||
|
|
||||||
- `image_name` (string) - The name of the resulting image.
|
|
||||||
|
|
||||||
- `identity_endpoint` (string) - The URL to the OpenStack Identity service.
|
|
||||||
If not specified, Packer will use the environment variables `OS_AUTH_URL`,
|
|
||||||
if set. This is not required if using `cloud.yaml`.
|
|
||||||
|
|
||||||
- `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.
|
|
||||||
|
|
||||||
- `source_image_filter` (map) - The search filters for determining the base
|
|
||||||
image to use. This is an alternative way of providing `source_image` and
|
|
||||||
only one of these methods can be used. `source_image` will override the
|
|
||||||
filters.
|
|
||||||
|
|
||||||
- `username` or `user_id` (string) - The username or id used to connect to
|
|
||||||
the OpenStack service. If not specified, Packer will use the environment
|
|
||||||
variable `OS_USERNAME` or `OS_USERID`, if set. This is not required if
|
|
||||||
using access token or application credential instead of password, or if using
|
|
||||||
`cloud.yaml`.
|
|
||||||
|
|
||||||
- `password` (string) - The password used to connect to the OpenStack
|
|
||||||
service. If not specified, Packer will use the environment variables
|
|
||||||
`OS_PASSWORD`, if set. This is not required if using access token or
|
|
||||||
application credential instead of password, or if using `cloud.yaml`.
|
|
||||||
|
|
||||||
### Optional:
|
|
||||||
|
|
||||||
- `application_credential_id` (string) - The application credential id to
|
|
||||||
use with application credential based authorization. Packer will use the
|
|
||||||
environment variable `OS_APPLICATION_CREDENTIAL_ID`, if set.
|
|
||||||
|
|
||||||
- `application_credential_name` (string) - The application credential name to
|
|
||||||
use with application credential based authorization. Packer will use the
|
|
||||||
environment variable `OS_APPLICATION_CREDENTIAL_NAME`, if set.
|
|
||||||
|
|
||||||
- `application_credential_secret` (string) - The application credential secret
|
|
||||||
to use with application credential based authorization. Packer will use the
|
|
||||||
environment variable `OS_APPLICATION_CREDENTIAL_SECRET`, if set.
|
|
||||||
|
|
||||||
- `availability_zone` (string) - The availability zone to launch the server
|
|
||||||
in. If this isn't specified, the default enforced by your OpenStack cluster
|
|
||||||
will be used. This may be required for some OpenStack clusters.
|
|
||||||
|
|
||||||
- `cacert` (string) - Custom CA certificate file path. If omitted the
|
|
||||||
`OS_CACERT` environment variable can be used.
|
|
||||||
|
|
||||||
- `cert` (string) - Client certificate file path for SSL client
|
|
||||||
authentication. If omitted the `OS_CERT` environment variable can be used.
|
|
||||||
|
|
||||||
- `cloud` (string) - An entry in a `clouds.yaml` file. See the OpenStack
|
|
||||||
os-client-config
|
|
||||||
[documentation](https://docs.openstack.org/os-client-config/latest/user/configuration.html)
|
|
||||||
for more information about `clouds.yaml` files. If omitted, the `OS_CLOUD`
|
|
||||||
environment variable is used.
|
|
||||||
|
|
||||||
- `config_drive` (boolean) - Whether or not nova should use ConfigDrive for
|
|
||||||
cloud-init metadata.
|
|
||||||
|
|
||||||
- `domain_name` or `domain_id` (string) - The Domain name or ID you are
|
|
||||||
authenticating with. OpenStack installations require this if identity v3 is
|
|
||||||
used. Packer will use the environment variable `OS_DOMAIN_NAME` or
|
|
||||||
`OS_DOMAIN_ID`, if set.
|
|
||||||
|
|
||||||
- `endpoint_type` (string) - The endpoint type to use. Can be any of
|
|
||||||
"internal", "internalURL", "admin", "adminURL", "public", and "publicURL".
|
|
||||||
By default this is "public".
|
|
||||||
|
|
||||||
- `floating_ip` (string) - A specific floating IP to assign to this instance.
|
|
||||||
|
|
||||||
- `floating_ip_network` (string) - The ID or name of an external network that
|
|
||||||
can be used for creation of a new floating IP.
|
|
||||||
|
|
||||||
- `floating_ip_pool` (string) - *Deprecated* use `floating_ip_network`
|
|
||||||
instead.
|
|
||||||
|
|
||||||
- `force_delete` (boolean) - Whether to force the OpenStack instance to be
|
|
||||||
forcefully deleted. This is useful for environments that have
|
|
||||||
reclaim / soft deletion enabled. By default this is false.
|
|
||||||
|
|
||||||
- `image_members` (array of strings) - List of members to add to the image
|
|
||||||
after creation. An image member is usually a project (also called the
|
|
||||||
"tenant") with whom the image is shared.
|
|
||||||
|
|
||||||
- `image_tags` (array of strings) - List of tags to add to the image after
|
|
||||||
creation.
|
|
||||||
|
|
||||||
- `image_visibility` (string) - One of "public", "private", "shared", or
|
|
||||||
"community".
|
|
||||||
|
|
||||||
- `insecure` (boolean) - Whether or not the connection to OpenStack can be
|
|
||||||
done over an insecure connection. By default this is false.
|
|
||||||
|
|
||||||
- `key` (string) - Client private key file path for SSL client
|
|
||||||
authentication. If omitted the `OS_KEY` environment variable can be used.
|
|
||||||
|
|
||||||
- `metadata` (object of key/value strings) - Glance metadata that will be
|
|
||||||
applied to the image.
|
|
||||||
|
|
||||||
- `instance_name` (string) - Name that is applied to the server instance
|
|
||||||
created by Packer. If this isn't specified, the default is same as
|
|
||||||
`image_name`.
|
|
||||||
|
|
||||||
- `instance_metadata` (object of key/value strings) - Metadata that is
|
|
||||||
applied to the server instance created by Packer. Also called server
|
|
||||||
properties in some documentation. The strings have a max size of 255 bytes
|
|
||||||
each.
|
|
||||||
|
|
||||||
- `networks` (array of strings) - A list of networks by UUID to attach to
|
|
||||||
this instance.
|
|
||||||
|
|
||||||
- `ports` (array of strings) - A list of ports by UUID to attach to this
|
|
||||||
instance.
|
|
||||||
|
|
||||||
- `rackconnect_wait` (boolean) - For rackspace, whether or not to wait for
|
|
||||||
Rackconnect to assign the machine an IP address before connecting via SSH.
|
|
||||||
Defaults to false.
|
|
||||||
|
|
||||||
- `region` (string) - The name of the region, such as "DFW", in which to
|
|
||||||
launch the server to create the image. If not specified, Packer will use
|
|
||||||
the environment variable `OS_REGION_NAME`, if set.
|
|
||||||
|
|
||||||
- `reuse_ips` (boolean) - Whether or not to attempt to reuse existing
|
|
||||||
unassigned floating ips in the project before allocating a new one. Note
|
|
||||||
that it is not possible to safely do this concurrently, so if you are
|
|
||||||
running multiple openstack builds concurrently, or if other processes are
|
|
||||||
assigning and using floating IPs in the same openstack project while packer
|
|
||||||
is running, you should not set this to true. Defaults to false.
|
|
||||||
|
|
||||||
- `security_groups` (array of strings) - A list of security groups by name to
|
|
||||||
add to this instance.
|
|
||||||
|
|
||||||
- `source_image_filter` (object) - Filters used to populate filter options.
|
|
||||||
Example:
|
|
||||||
|
|
||||||
``` json
|
|
||||||
{
|
|
||||||
"source_image_filter": {
|
|
||||||
"filters": {
|
|
||||||
"name": "ubuntu-16.04",
|
|
||||||
"visibility": "protected",
|
|
||||||
"owner": "d1a588cf4b0743344508dc145649372d1",
|
|
||||||
"tags": ["prod", "ready"],
|
|
||||||
"properties": {
|
|
||||||
"os_distro": "ubuntu"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"most_recent": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
This selects the most recent production Ubuntu 16.04 shared to you by the
|
|
||||||
given owner. NOTE: This will fail unless *exactly* one image is returned,
|
|
||||||
or `most_recent` is set to true. In the example of multiple returned
|
|
||||||
images, `most_recent` will cause this to succeed by selecting the newest
|
|
||||||
image of the returned images.
|
|
||||||
|
|
||||||
- `filters` (map of strings) - filters used to select a `source_image`.
|
|
||||||
NOTE: This will fail unless *exactly* one image is returned, or
|
|
||||||
`most_recent` is set to true. Of the filters described in
|
|
||||||
[ImageService](https://developer.openstack.org/api-ref/image/v2/), the
|
|
||||||
following are valid:
|
|
||||||
|
|
||||||
- name (string)
|
|
||||||
|
|
||||||
- owner (string)
|
|
||||||
|
|
||||||
- tags (array of strings)
|
|
||||||
|
|
||||||
- visibility (string)
|
|
||||||
|
|
||||||
- properties (map of strings to strings) (fields that can be set
|
|
||||||
with `openstack image set --property key=value`)
|
|
||||||
|
|
||||||
- `most_recent` (boolean) - Selects the newest created image when true.
|
|
||||||
This is most useful for selecting a daily distro build.
|
|
||||||
|
|
||||||
You may set use this in place of `source_image` If `source_image_filter` is
|
|
||||||
provided alongside `source_image`, the `source_image` will override the
|
|
||||||
filter. The filter will not be used in this case.
|
|
||||||
|
|
||||||
- `ssh_interface` (string) - The type of interface to connect via SSH. Values
|
|
||||||
useful for Rackspace are "public" or "private", and the default behavior is
|
|
||||||
to connect via whichever is returned first from the OpenStack API.
|
|
||||||
|
|
||||||
- `ssh_ip_version` (string) - The IP version to use for SSH connections,
|
|
||||||
valid values are `4` and `6`. Useful on dual stacked instances where the
|
|
||||||
default behavior is to connect via whichever IP address is returned first
|
|
||||||
from the OpenStack API.
|
|
||||||
|
|
||||||
- `ssh_keypair_name` (string) - If specified, this is the key that will be
|
|
||||||
used for SSH with the machine. By default, this is blank, and Packer will
|
|
||||||
generate a temporary keypair.
|
|
||||||
[`ssh_password`](/docs/templates/communicator.html#ssh_password) is used.
|
|
||||||
[`ssh_private_key_file`](/docs/templates/communicator.html#ssh_private_key_file)
|
|
||||||
or `ssh_agent_auth` must be specified when `ssh_keypair_name` is utilized.
|
|
||||||
|
|
||||||
- `ssh_agent_auth` (boolean) - If true, the local SSH agent will be used to
|
|
||||||
authenticate connections to the source instance. No temporary keypair will
|
|
||||||
be created, and the values of `ssh_password` and `ssh_private_key_file`
|
|
||||||
will be ignored. To use this option with a key pair already configured in
|
|
||||||
the source image, leave the `ssh_keypair_name` blank. To associate an
|
|
||||||
existing key pair with the source instance, set the `ssh_keypair_name`
|
|
||||||
field to the name of the key pair.
|
|
||||||
|
|
||||||
- `temporary_key_pair_name` (string) - The name of the temporary key pair to
|
|
||||||
generate. By default, Packer generates a name that looks like
|
|
||||||
`packer_<UUID>`, where <UUID> is a 36 character unique identifier.
|
|
||||||
|
|
||||||
- `tenant_id` or `tenant_name` (string) - The tenant ID or name to boot the
|
|
||||||
instance into. Some OpenStack installations require this. If not specified,
|
|
||||||
Packer will use the environment variable `OS_TENANT_NAME` or
|
|
||||||
`OS_TENANT_ID`, if set. Tenant is also called Project in later versions of
|
|
||||||
OpenStack.
|
|
||||||
|
|
||||||
- `token` (string) - the token (id) to use with token based authorization.
|
|
||||||
Packer will use the environment variable `OS_TOKEN`, if set.
|
|
||||||
|
|
||||||
- `use_floating_ip` (boolean) - *Deprecated* use `floating_ip` or
|
|
||||||
`floating_ip_pool` instead.
|
|
||||||
|
|
||||||
- `user_data` (string) - User data to apply when launching the instance. Note
|
|
||||||
that you need to be careful about escaping characters due to the templates
|
|
||||||
being JSON. It is often more convenient to use `user_data_file`, instead.
|
|
||||||
Packer will not automatically wait for a user script to finish before
|
|
||||||
shutting down the instance this must be handled in a provisioner.
|
|
||||||
|
|
||||||
- `user_data_file` (string) - Path to a file that will be used for the user
|
|
||||||
data when launching the instance.
|
|
||||||
|
|
||||||
- `use_blockstorage_volume` (boolean) - Use Block Storage service volume for
|
|
||||||
the instance root volume instead of Compute service local volume (default).
|
|
||||||
|
|
||||||
- `volume_name` (string) - Name of the Block Storage service volume. If this
|
|
||||||
isn't specified, random string will be used.
|
|
||||||
|
|
||||||
- `volume_type` (string) - Type of the Block Storage service volume. If this
|
|
||||||
isn't specified, the default enforced by your OpenStack cluster will be
|
|
||||||
used.
|
|
||||||
|
|
||||||
- `volume_size` (int) - Size of the Block Storage service volume in GB. If
|
|
||||||
this isn't specified, it is set to source image min disk value (if set) or
|
|
||||||
calculated from the source image bytes size. Note that in some cases this
|
|
||||||
needs to be specified, if `use_blockstorage_volume` is true.
|
|
||||||
|
|
||||||
- `volume_availability_zone` (string) - Availability zone of the Block
|
|
||||||
Storage service volume. If omitted, Compute instance availability zone will
|
|
||||||
be used. If both of Compute instance and Block Storage volume availability
|
|
||||||
zones aren't specified, the default enforced by your OpenStack cluster will
|
|
||||||
be used.
|
|
||||||
|
|
||||||
- `image_disk_format` (string) - Disk format of the resulting image. This
|
|
||||||
option works if `use_blockstorage_volume` is true.
|
|
||||||
|
|
||||||
## Basic Example: DevStack
|
|
||||||
|
|
||||||
Here is a basic example. This is a example to build on DevStack running in a
|
|
||||||
VM.
|
|
||||||
|
|
||||||
``` json
|
|
||||||
{
|
|
||||||
"type": "openstack",
|
|
||||||
"identity_endpoint": "http://<devstack-ip>:5000/v3",
|
|
||||||
"tenant_name": "admin",
|
|
||||||
"domain_name": "Default",
|
|
||||||
"username": "admin",
|
|
||||||
"password": "<your admin password>",
|
|
||||||
"region": "RegionOne",
|
|
||||||
"ssh_username": "root",
|
|
||||||
"image_name": "Test image",
|
|
||||||
"source_image": "<image id>",
|
|
||||||
"flavor": "m1.tiny",
|
|
||||||
"insecure": "true"
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Basic Example: Rackspace public cloud
|
|
||||||
|
|
||||||
Here is a basic example. This is a working example to build a Ubuntu 12.04 LTS
|
|
||||||
(Precise Pangolin) on Rackspace OpenStack cloud offering.
|
|
||||||
|
|
||||||
``` json
|
|
||||||
{
|
|
||||||
"type": "openstack",
|
|
||||||
"username": "foo",
|
|
||||||
"password": "foo",
|
|
||||||
"region": "DFW",
|
|
||||||
"ssh_username": "root",
|
|
||||||
"image_name": "Test image",
|
|
||||||
"source_image": "23b564c9-c3e6-49f9-bc68-86c7a9ab5018",
|
|
||||||
"flavor": "2"
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Basic Example: Private OpenStack cloud
|
|
||||||
|
|
||||||
This example builds an Ubuntu 14.04 image on a private OpenStack cloud, powered
|
|
||||||
by Metacloud.
|
|
||||||
|
|
||||||
``` json
|
|
||||||
{
|
|
||||||
"type": "openstack",
|
|
||||||
"ssh_username": "root",
|
|
||||||
"image_name": "ubuntu1404_packer_test_1",
|
|
||||||
"source_image": "91d9c168-d1e5-49ca-a775-3bfdbb6c97f1",
|
|
||||||
"flavor": "2"
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
In this case, the connection information for connecting to OpenStack doesn't
|
|
||||||
appear in the template. That is because I source a standard OpenStack script
|
|
||||||
with environment variables set before I run this. This script is setting
|
|
||||||
environment variables like:
|
|
||||||
|
|
||||||
- `OS_AUTH_URL`
|
|
||||||
- `OS_TENANT_ID`
|
|
||||||
- `OS_USERNAME`
|
|
||||||
- `OS_PASSWORD`
|
|
||||||
|
|
||||||
This is slightly different when identity v3 is used:
|
|
||||||
|
|
||||||
- `OS_AUTH_URL`
|
|
||||||
- `OS_USERNAME`
|
|
||||||
- `OS_PASSWORD`
|
|
||||||
- `OS_DOMAIN_NAME`
|
|
||||||
- `OS_TENANT_NAME`
|
|
||||||
|
|
||||||
This will authenticate the user on the domain and scope you to the project. A
|
|
||||||
tenant is the same as a project. It's optional to use names or IDs in v3. This
|
|
||||||
means you can use `OS_USERNAME` or `OS_USERID`, `OS_TENANT_ID` or
|
|
||||||
`OS_TENANT_NAME` and `OS_DOMAIN_ID` or `OS_DOMAIN_NAME`.
|
|
||||||
|
|
||||||
The above example would be equivalent to an RC file looking like this :
|
|
||||||
|
|
||||||
``` shell
|
|
||||||
export OS_AUTH_URL="https://identity.myprovider/v3"
|
|
||||||
export OS_USERNAME="myuser"
|
|
||||||
export OS_PASSWORD="password"
|
|
||||||
export OS_USER_DOMAIN_NAME="mydomain"
|
|
||||||
export OS_PROJECT_DOMAIN_NAME="mydomain"
|
|
||||||
```
|
|
||||||
|
|
||||||
## Basic Example: Instance with Block Storage root volume
|
|
||||||
|
|
||||||
A basic example of Instance with a remote root Block Storage service volume.
|
|
||||||
This is a working example to build an image on private OpenStack cloud powered
|
|
||||||
by Selectel VPC.
|
|
||||||
|
|
||||||
``` json
|
|
||||||
{
|
|
||||||
"type": "openstack",
|
|
||||||
"identity_endpoint": "https://api.selvpc.com/identity/v3",
|
|
||||||
"tenant_id": "2e90c5c04c7b4c509be78723e2b55b77",
|
|
||||||
"username": "foo",
|
|
||||||
"password": "foo",
|
|
||||||
"region": "ru-3",
|
|
||||||
"ssh_username": "root",
|
|
||||||
"image_name": "Test image",
|
|
||||||
"source_image": "5f58ea7e-6264-4939-9d0f-0c23072b1132",
|
|
||||||
"networks": "9aab504e-bedf-48af-9256-682a7fa3dabb",
|
|
||||||
"flavor": "1001",
|
|
||||||
"availability_zone": "ru-3a",
|
|
||||||
"use_blockstorage_volume": true,
|
|
||||||
"volume_type": "fast.ru-3a"
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Notes on OpenStack Authorization
|
|
||||||
|
|
||||||
The simplest way to get all settings for authorization against OpenStack is to
|
|
||||||
go into the OpenStack Dashboard (Horizon) select your *Project* and navigate
|
|
||||||
*Project, Access & Security*, select *API Access* and *Download OpenStack RC
|
|
||||||
File v3*. Source the file, and select your wanted region by setting environment
|
|
||||||
variable `OS_REGION_NAME` or `OS_REGION_ID` and
|
|
||||||
`export OS_TENANT_NAME=$OS_PROJECT_NAME` or
|
|
||||||
`export OS_TENANT_ID=$OS_PROJECT_ID`.
|
|
||||||
|
|
||||||
\~> `OS_TENANT_NAME` or `OS_TENANT_ID` must be used even with Identity v3,
|
|
||||||
`OS_PROJECT_NAME` and `OS_PROJECT_ID` has no effect in Packer.
|
|
||||||
|
|
||||||
To troubleshoot authorization issues test you environment variables with the
|
|
||||||
OpenStack cli. It can be installed with
|
|
||||||
|
|
||||||
$ pip install --user python-openstackclient
|
|
||||||
|
|
||||||
### Authorize Using Tokens
|
|
||||||
|
|
||||||
To authorize with a access token only `identity_endpoint` and `token` is
|
|
||||||
needed, and possibly `tenant_name` or `tenant_id` depending on your token type.
|
|
||||||
Or use the following environment variables:
|
|
||||||
|
|
||||||
- `OS_AUTH_URL`
|
|
||||||
- `OS_TOKEN`
|
|
||||||
- One of `OS_TENANT_NAME` or `OS_TENANT_ID`
|
|
||||||
|
|
||||||
### Authorize Using Application Credential
|
|
||||||
|
|
||||||
To authorize with an application credential, only `identity_endpoint`,
|
|
||||||
`application_credential_id`, and `application_credential_secret` are needed.
|
|
||||||
Or use the following environment variables:
|
|
||||||
|
|
||||||
- `OS_AUTH_URL`
|
|
||||||
- `OS_APPLICATION_CREDENTIAL_ID`
|
|
||||||
- `OS_APPLICATION_CREDENTIAL_SECRET`
|
|
|
@ -0,0 +1,215 @@
|
||||||
|
---
|
||||||
|
description: |
|
||||||
|
The openstack Packer builder is able to create new images for use with
|
||||||
|
OpenStack. The builder takes a source image, runs any provisioning necessary on
|
||||||
|
the image after launching it, then creates a new reusable image. This reusable
|
||||||
|
image can then be used as the foundation of new servers that are launched
|
||||||
|
within OpenStack.
|
||||||
|
layout: docs
|
||||||
|
page_title: 'OpenStack - Builders'
|
||||||
|
sidebar_current: 'docs-builders-openstack'
|
||||||
|
---
|
||||||
|
|
||||||
|
# OpenStack Builder
|
||||||
|
|
||||||
|
Type: `openstack`
|
||||||
|
|
||||||
|
The `openstack` Packer builder is able to create new images for use with
|
||||||
|
[OpenStack](http://www.openstack.org). The builder takes a source image, runs
|
||||||
|
any provisioning necessary on the image after launching it, then creates a new
|
||||||
|
reusable image. This reusable image can then be used as the foundation of new
|
||||||
|
servers that are launched within OpenStack. The builder will create temporary
|
||||||
|
keypairs that provide temporary access to the server while the image is being
|
||||||
|
created. This simplifies configuration quite a bit.
|
||||||
|
|
||||||
|
The builder does *not* manage images. Once it creates an image, it is up to you
|
||||||
|
to use it or delete it.
|
||||||
|
|
||||||
|
\~> **Note:** To use OpenStack builder with the OpenStack Newton (Oct 2016)
|
||||||
|
or earlier, we recommend you use Packer v1.1.2 or earlier version.
|
||||||
|
|
||||||
|
\~> **OpenStack Liberty or later requires OpenSSL!** To use the OpenStack
|
||||||
|
builder with OpenStack Liberty (Oct 2015) or later you need to have OpenSSL
|
||||||
|
installed *if you are using temporary key pairs*, i.e. don't use
|
||||||
|
[`ssh_keypair_name`](openstack.html#ssh_keypair_name) nor
|
||||||
|
[`ssh_password`](/docs/templates/communicator.html#ssh_password). All major
|
||||||
|
OS'es have OpenSSL installed by default except Windows. This have been resolved
|
||||||
|
in OpenStack Ocata(Feb 2017).
|
||||||
|
|
||||||
|
\~> **Note:** OpenStack Block Storage volume support is available only for
|
||||||
|
V3 Block Storage API. It's available in OpenStack since Mitaka release (Apr
|
||||||
|
2016).
|
||||||
|
|
||||||
|
## Configuration Reference
|
||||||
|
|
||||||
|
There are many configuration options available for the builder. They are
|
||||||
|
segmented below into two categories: required and optional parameters. Within
|
||||||
|
each category, the available configuration keys are alphabetized.
|
||||||
|
|
||||||
|
In addition to the options listed here, a
|
||||||
|
[communicator](/docs/templates/communicator.html) can be configured for this
|
||||||
|
builder.
|
||||||
|
|
||||||
|
### Required:
|
||||||
|
|
||||||
|
<%= partial "partials/builder/openstack/AccessConfig-required" %>
|
||||||
|
<%= partial "partials/builder/openstack/ImageConfig-required" %>
|
||||||
|
<%= partial "partials/builder/openstack/RunConfig-required" %>
|
||||||
|
|
||||||
|
### Optional:
|
||||||
|
|
||||||
|
<%= partial "partials/builder/openstack/AccessConfig-not-required" %>
|
||||||
|
<%= partial "partials/builder/openstack/ImageConfig-not-required" %>
|
||||||
|
<%= partial "partials/builder/openstack/RunConfig-not-required" %>
|
||||||
|
|
||||||
|
|
||||||
|
## Basic Example: DevStack
|
||||||
|
|
||||||
|
Here is a basic example. This is a example to build on DevStack running in a
|
||||||
|
VM.
|
||||||
|
|
||||||
|
``` json
|
||||||
|
{
|
||||||
|
"type": "openstack",
|
||||||
|
"identity_endpoint": "http://<devstack-ip>:5000/v3",
|
||||||
|
"tenant_name": "admin",
|
||||||
|
"domain_name": "Default",
|
||||||
|
"username": "admin",
|
||||||
|
"password": "<your admin password>",
|
||||||
|
"region": "RegionOne",
|
||||||
|
"ssh_username": "root",
|
||||||
|
"image_name": "Test image",
|
||||||
|
"source_image": "<image id>",
|
||||||
|
"flavor": "m1.tiny",
|
||||||
|
"insecure": "true"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Basic Example: Rackspace public cloud
|
||||||
|
|
||||||
|
Here is a basic example. This is a working example to build a Ubuntu 12.04 LTS
|
||||||
|
(Precise Pangolin) on Rackspace OpenStack cloud offering.
|
||||||
|
|
||||||
|
``` json
|
||||||
|
{
|
||||||
|
"type": "openstack",
|
||||||
|
"username": "foo",
|
||||||
|
"password": "foo",
|
||||||
|
"region": "DFW",
|
||||||
|
"ssh_username": "root",
|
||||||
|
"image_name": "Test image",
|
||||||
|
"source_image": "23b564c9-c3e6-49f9-bc68-86c7a9ab5018",
|
||||||
|
"flavor": "2"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Basic Example: Private OpenStack cloud
|
||||||
|
|
||||||
|
This example builds an Ubuntu 14.04 image on a private OpenStack cloud, powered
|
||||||
|
by Metacloud.
|
||||||
|
|
||||||
|
``` json
|
||||||
|
{
|
||||||
|
"type": "openstack",
|
||||||
|
"ssh_username": "root",
|
||||||
|
"image_name": "ubuntu1404_packer_test_1",
|
||||||
|
"source_image": "91d9c168-d1e5-49ca-a775-3bfdbb6c97f1",
|
||||||
|
"flavor": "2"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
In this case, the connection information for connecting to OpenStack doesn't
|
||||||
|
appear in the template. That is because I source a standard OpenStack script
|
||||||
|
with environment variables set before I run this. This script is setting
|
||||||
|
environment variables like:
|
||||||
|
|
||||||
|
- `OS_AUTH_URL`
|
||||||
|
- `OS_TENANT_ID`
|
||||||
|
- `OS_USERNAME`
|
||||||
|
- `OS_PASSWORD`
|
||||||
|
|
||||||
|
This is slightly different when identity v3 is used:
|
||||||
|
|
||||||
|
- `OS_AUTH_URL`
|
||||||
|
- `OS_USERNAME`
|
||||||
|
- `OS_PASSWORD`
|
||||||
|
- `OS_DOMAIN_NAME`
|
||||||
|
- `OS_TENANT_NAME`
|
||||||
|
|
||||||
|
This will authenticate the user on the domain and scope you to the project. A
|
||||||
|
tenant is the same as a project. It's optional to use names or IDs in v3. This
|
||||||
|
means you can use `OS_USERNAME` or `OS_USERID`, `OS_TENANT_ID` or
|
||||||
|
`OS_TENANT_NAME` and `OS_DOMAIN_ID` or `OS_DOMAIN_NAME`.
|
||||||
|
|
||||||
|
The above example would be equivalent to an RC file looking like this :
|
||||||
|
|
||||||
|
``` shell
|
||||||
|
export OS_AUTH_URL="https://identity.myprovider/v3"
|
||||||
|
export OS_USERNAME="myuser"
|
||||||
|
export OS_PASSWORD="password"
|
||||||
|
export OS_USER_DOMAIN_NAME="mydomain"
|
||||||
|
export OS_PROJECT_DOMAIN_NAME="mydomain"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Basic Example: Instance with Block Storage root volume
|
||||||
|
|
||||||
|
A basic example of Instance with a remote root Block Storage service volume.
|
||||||
|
This is a working example to build an image on private OpenStack cloud powered
|
||||||
|
by Selectel VPC.
|
||||||
|
|
||||||
|
``` json
|
||||||
|
{
|
||||||
|
"type": "openstack",
|
||||||
|
"identity_endpoint": "https://api.selvpc.com/identity/v3",
|
||||||
|
"tenant_id": "2e90c5c04c7b4c509be78723e2b55b77",
|
||||||
|
"username": "foo",
|
||||||
|
"password": "foo",
|
||||||
|
"region": "ru-3",
|
||||||
|
"ssh_username": "root",
|
||||||
|
"image_name": "Test image",
|
||||||
|
"source_image": "5f58ea7e-6264-4939-9d0f-0c23072b1132",
|
||||||
|
"networks": "9aab504e-bedf-48af-9256-682a7fa3dabb",
|
||||||
|
"flavor": "1001",
|
||||||
|
"availability_zone": "ru-3a",
|
||||||
|
"use_blockstorage_volume": true,
|
||||||
|
"volume_type": "fast.ru-3a"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Notes on OpenStack Authorization
|
||||||
|
|
||||||
|
The simplest way to get all settings for authorization against OpenStack is to
|
||||||
|
go into the OpenStack Dashboard (Horizon) select your *Project* and navigate
|
||||||
|
*Project, Access & Security*, select *API Access* and *Download OpenStack RC
|
||||||
|
File v3*. Source the file, and select your wanted region by setting environment
|
||||||
|
variable `OS_REGION_NAME` or `OS_REGION_ID` and
|
||||||
|
`export OS_TENANT_NAME=$OS_PROJECT_NAME` or
|
||||||
|
`export OS_TENANT_ID=$OS_PROJECT_ID`.
|
||||||
|
|
||||||
|
\~> `OS_TENANT_NAME` or `OS_TENANT_ID` must be used even with Identity v3,
|
||||||
|
`OS_PROJECT_NAME` and `OS_PROJECT_ID` has no effect in Packer.
|
||||||
|
|
||||||
|
To troubleshoot authorization issues test you environment variables with the
|
||||||
|
OpenStack cli. It can be installed with
|
||||||
|
|
||||||
|
$ pip install --user python-openstackclient
|
||||||
|
|
||||||
|
### Authorize Using Tokens
|
||||||
|
|
||||||
|
To authorize with a access token only `identity_endpoint` and `token` is
|
||||||
|
needed, and possibly `tenant_name` or `tenant_id` depending on your token type.
|
||||||
|
Or use the following environment variables:
|
||||||
|
|
||||||
|
- `OS_AUTH_URL`
|
||||||
|
- `OS_TOKEN`
|
||||||
|
- One of `OS_TENANT_NAME` or `OS_TENANT_ID`
|
||||||
|
|
||||||
|
### Authorize Using Application Credential
|
||||||
|
|
||||||
|
To authorize with an application credential, only `identity_endpoint`,
|
||||||
|
`application_credential_id`, and `application_credential_secret` are needed.
|
||||||
|
Or use the following environment variables:
|
||||||
|
|
||||||
|
- `OS_AUTH_URL`
|
||||||
|
- `OS_APPLICATION_CREDENTIAL_ID`
|
||||||
|
- `OS_APPLICATION_CREDENTIAL_SECRET`
|
|
@ -1,57 +1,55 @@
|
||||||
<!-- Code generated from the comments of the AccessConfig struct in builder/openstack/access_config.go; DO NOT EDIT MANUALLY -->
|
<!-- Code generated from the comments of the AccessConfig struct in builder/openstack/access_config.go; DO NOT EDIT MANUALLY -->
|
||||||
|
|
||||||
- `user_id` (string) - User ID
|
- `user_id` (string) - Sets username
|
||||||
- `tenant_id` (string) - The tenant ID or name to boot the
|
|
||||||
instance into. Some OpenStack installations require this. If not specified,
|
- `tenant_id` (string) - The tenant ID or name to boot the instance into. Some OpenStack
|
||||||
Packer will use the environment variable OS_TENANT_NAME or
|
installations require this. If not specified, Packer will use the
|
||||||
OS_TENANT_ID, if set. Tenant is also called Project in later versions of
|
environment variable OS_TENANT_NAME or OS_TENANT_ID, if set. Tenant is
|
||||||
OpenStack.
|
also called Project in later versions of OpenStack.
|
||||||
|
|
||||||
- `tenant_name` (string) - Tenant Name
|
- `tenant_name` (string) - Tenant Name
|
||||||
- `domain_id` (string) - Domain ID
|
- `domain_id` (string) - Domain ID
|
||||||
- `domain_name` (string) - The Domain name or ID you are
|
- `domain_name` (string) - The Domain name or ID you are authenticating with. OpenStack
|
||||||
authenticating with. OpenStack installations require this if identity v3 is
|
installations require this if identity v3 is used. Packer will use the
|
||||||
used. Packer will use the environment variable OS_DOMAIN_NAME or
|
environment variable OS_DOMAIN_NAME or OS_DOMAIN_ID, if set.
|
||||||
OS_DOMAIN_ID, if set.
|
|
||||||
|
|
||||||
- `insecure` (bool) - Whether or not the connection to OpenStack can be
|
- `insecure` (bool) - Whether or not the connection to OpenStack can be done over an insecure
|
||||||
done over an insecure connection. By default this is false.
|
connection. By default this is false.
|
||||||
|
|
||||||
- `region` (string) - The name of the region, such as "DFW", in which to
|
- `region` (string) - The name of the region, such as "DFW", in which to launch the server to
|
||||||
launch the server to create the image. If not specified, Packer will use
|
create the image. If not specified, Packer will use the environment
|
||||||
the environment variable OS_REGION_NAME, if set.
|
variable OS_REGION_NAME, if set.
|
||||||
|
|
||||||
- `endpoint_type` (string) - The endpoint type to use. Can be any of
|
- `endpoint_type` (string) - The endpoint type to use. Can be any of "internal", "internalURL",
|
||||||
"internal", "internalURL", "admin", "adminURL", "public", and "publicURL".
|
"admin", "adminURL", "public", and "publicURL". By default this is
|
||||||
By default this is "public".
|
"public".
|
||||||
|
|
||||||
- `cacert` (string) - Custom CA certificate file path. If omitted the
|
- `cacert` (string) - Custom CA certificate file path. If omitted the OS_CACERT environment
|
||||||
OS_CACERT environment variable can be used.
|
variable can be used.
|
||||||
|
|
||||||
- `cert` (string) - Client certificate file path for SSL client
|
- `cert` (string) - Client certificate file path for SSL client authentication. If omitted
|
||||||
authentication. If omitted the OS_CERT environment variable can be used.
|
the OS_CERT environment variable can be used.
|
||||||
|
|
||||||
- `key` (string) - Client private key file path for SSL client
|
- `key` (string) - Client private key file path for SSL client authentication. If omitted
|
||||||
authentication. If omitted the OS_KEY environment variable can be used.
|
the OS_KEY environment variable can be used.
|
||||||
|
|
||||||
- `token` (string) - the token (id) to use with token based authorization.
|
- `token` (string) - the token (id) to use with token based authorization. Packer will use
|
||||||
Packer will use the environment variable OS_TOKEN, if set.
|
the environment variable OS_TOKEN, if set.
|
||||||
|
|
||||||
- `application_credential_name` (string) - The application credential name to
|
- `application_credential_name` (string) - The application credential name to use with application credential based
|
||||||
use with application credential based authorization. Packer will use the
|
authorization. Packer will use the environment variable
|
||||||
environment variable OS_APPLICATION_CREDENTIAL_NAME, if set.
|
OS_APPLICATION_CREDENTIAL_NAME, if set.
|
||||||
|
|
||||||
- `application_credential_id` (string) - The application credential id to
|
- `application_credential_id` (string) - The application credential id to use with application credential based
|
||||||
use with application credential based authorization. Packer will use the
|
authorization. Packer will use the environment variable
|
||||||
environment variable OS_APPLICATION_CREDENTIAL_ID, if set.
|
OS_APPLICATION_CREDENTIAL_ID, if set.
|
||||||
|
|
||||||
- `application_credential_secret` (string) - The application credential secret
|
- `application_credential_secret` (string) - The application credential secret to use with application credential
|
||||||
to use with application credential based authorization. Packer will use the
|
based authorization. Packer will use the environment variable
|
||||||
environment variable OS_APPLICATION_CREDENTIAL_SECRET, if set.
|
OS_APPLICATION_CREDENTIAL_SECRET, if set.
|
||||||
|
|
||||||
- `cloud` (string) - An entry in a clouds.yaml file. See the OpenStack
|
- `cloud` (string) - An entry in a `clouds.yaml` file. See the OpenStack os-client-config
|
||||||
os-client-config
|
[documentation](https://docs.openstack.org/os-client-config/latest/user/configuration.html)
|
||||||
documentation
|
for more information about `clouds.yaml` files. If omitted, the
|
||||||
for more information about clouds.yaml files. If omitted, the OS_CLOUD
|
`OS_CLOUD` environment variable is used.
|
||||||
environment variable is used.
|
|
||||||
|
|
|
@ -1,17 +1,16 @@
|
||||||
<!-- Code generated from the comments of the AccessConfig struct in builder/openstack/access_config.go; DO NOT EDIT MANUALLY -->
|
<!-- Code generated from the comments of the AccessConfig struct in builder/openstack/access_config.go; DO NOT EDIT MANUALLY -->
|
||||||
|
|
||||||
- `username` (string) - The username or id used to connect to
|
- `username` (string) - The username or id used to connect to the OpenStack service. If not
|
||||||
the OpenStack service. If not specified, Packer will use the environment
|
specified, Packer will use the environment variable OS_USERNAME or
|
||||||
variable OS_USERNAME or OS_USERID, if set. This is not required if
|
OS_USERID, if set. This is not required if using access token or
|
||||||
using access token or application credential instead of password, or if using
|
|
||||||
cloud.yaml.
|
|
||||||
|
|
||||||
- `password` (string) - The password used to connect to the OpenStack
|
|
||||||
service. If not specified, Packer will use the environment variables
|
|
||||||
OS_PASSWORD, if set. This is not required if using access token or
|
|
||||||
application credential instead of password, or if using cloud.yaml.
|
application credential instead of password, or if using cloud.yaml.
|
||||||
|
|
||||||
- `identity_endpoint` (string) - The URL to the OpenStack Identity service.
|
- `password` (string) - The password used to connect to the OpenStack service. If not specified,
|
||||||
If not specified, Packer will use the environment variables OS_AUTH_URL,
|
Packer will use the environment variables OS_PASSWORD, if set. This is
|
||||||
if set. This is not required if using cloud.yaml.
|
not required if using access token or application credential instead of
|
||||||
|
password, or if using cloud.yaml.
|
||||||
|
|
||||||
|
- `identity_endpoint` (string) - The URL to the OpenStack Identity service. If not specified, Packer will
|
||||||
|
use the environment variables OS_AUTH_URL, if set. This is not required
|
||||||
|
if using cloud.yaml.
|
||||||
|
|
|
@ -1,18 +1,15 @@
|
||||||
<!-- Code generated from the comments of the ImageConfig struct in builder/openstack/image_config.go; DO NOT EDIT MANUALLY -->
|
<!-- Code generated from the comments of the ImageConfig struct in builder/openstack/image_config.go; DO NOT EDIT MANUALLY -->
|
||||||
|
|
||||||
- `metadata` (map[string]string) - Glance metadata that will be
|
- `metadata` (map[string]string) - Glance metadata that will be applied to the image.
|
||||||
applied to the image.
|
|
||||||
|
|
||||||
- `image_visibility` (imageservice.ImageVisibility) - One of "public", "private", "shared", or
|
- `image_visibility` (imageservice.ImageVisibility) - One of "public", "private", "shared", or "community".
|
||||||
"community".
|
|
||||||
|
|
||||||
- `image_members` ([]string) - List of members to add to the image
|
- `image_members` ([]string) - List of members to add to the image after creation. An image member is
|
||||||
after creation. An image member is usually a project (also called the
|
usually a project (also called the "tenant") with whom the image is
|
||||||
"tenant") with whom the image is shared.
|
shared.
|
||||||
|
|
||||||
- `image_disk_format` (string) - Disk format of the resulting image. This
|
- `image_disk_format` (string) - Disk format of the resulting image. This option works if
|
||||||
option works if use_blockstorage_volume is true.
|
use_blockstorage_volume is true.
|
||||||
|
|
||||||
- `image_tags` ([]string) - List of tags to add to the image after
|
- `image_tags` ([]string) - List of tags to add to the image after creation.
|
||||||
creation.
|
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
<!-- Code generated from the comments of the ImageFilter struct in builder/openstack/run_config.go; DO NOT EDIT MANUALLY -->
|
<!-- Code generated from the comments of the ImageFilter struct in builder/openstack/run_config.go; DO NOT EDIT MANUALLY -->
|
||||||
|
|
||||||
- `filters` (ImageFilterOptions) - filters used to select a source_image.
|
- `filters` (ImageFilterOptions) - filters used to select a source_image. NOTE: This will fail unless
|
||||||
NOTE: This will fail unless exactly one image is returned, or
|
exactly one image is returned, or most_recent is set to true. Of the
|
||||||
most_recent is set to true. Of the filters described in
|
filters described in ImageService, the following are valid:
|
||||||
ImageService, the
|
|
||||||
following are valid:
|
|
||||||
|
|
||||||
- `most_recent` (bool) - Selects the newest created image when true.
|
- `most_recent` (bool) - Selects the newest created image when true. This is most useful for
|
||||||
This is most useful for selecting a daily distro build.
|
selecting a daily distro build.
|
||||||
|
|
|
@ -1,85 +1,74 @@
|
||||||
<!-- Code generated from the comments of the RunConfig struct in builder/openstack/run_config.go; DO NOT EDIT MANUALLY -->
|
<!-- Code generated from the comments of the RunConfig struct in builder/openstack/run_config.go; DO NOT EDIT MANUALLY -->
|
||||||
|
|
||||||
- `availability_zone` (string) - The availability zone to launch the server
|
- `availability_zone` (string) - The availability zone to launch the server in. If this isn't specified,
|
||||||
in. If this isn't specified, the default enforced by your OpenStack cluster
|
the default enforced by your OpenStack cluster will be used. This may be
|
||||||
will be used. This may be required for some OpenStack clusters.
|
required for some OpenStack clusters.
|
||||||
|
|
||||||
- `rackconnect_wait` (bool) - For rackspace, whether or not to wait for
|
- `rackconnect_wait` (bool) - For rackspace, whether or not to wait for Rackconnect to assign the
|
||||||
Rackconnect to assign the machine an IP address before connecting via SSH.
|
machine an IP address before connecting via SSH. Defaults to false.
|
||||||
Defaults to false.
|
|
||||||
|
|
||||||
- `floating_ip_network` (string) - The ID or name of an external network that
|
- `floating_ip_network` (string) - The ID or name of an external network that can be used for creation of a
|
||||||
can be used for creation of a new floating IP.
|
new floating IP.
|
||||||
|
|
||||||
- `floating_ip` (string) - A specific floating IP to assign to this instance.
|
- `floating_ip` (string) - A specific floating IP to assign to this instance.
|
||||||
|
|
||||||
- `reuse_ips` (bool) - Whether or not to attempt to reuse existing
|
- `reuse_ips` (bool) - Whether or not to attempt to reuse existing unassigned floating ips in
|
||||||
unassigned floating ips in the project before allocating a new one. Note
|
the project before allocating a new one. Note that it is not possible to
|
||||||
that it is not possible to safely do this concurrently, so if you are
|
safely do this concurrently, so if you are running multiple openstack
|
||||||
running multiple openstack builds concurrently, or if other processes are
|
builds concurrently, or if other processes are assigning and using
|
||||||
assigning and using floating IPs in the same openstack project while packer
|
floating IPs in the same openstack project while packer is running, you
|
||||||
is running, you should not set this to true. Defaults to false.
|
should not set this to true. Defaults to false.
|
||||||
|
|
||||||
- `security_groups` ([]string) - A list of security groups by name to
|
- `security_groups` ([]string) - A list of security groups by name to add to this instance.
|
||||||
add to this instance.
|
|
||||||
|
|
||||||
- `networks` ([]string) - A list of networks by UUID to attach to
|
- `networks` ([]string) - A list of networks by UUID to attach to this instance.
|
||||||
this instance.
|
|
||||||
|
|
||||||
- `ports` ([]string) - A list of ports by UUID to attach to this
|
- `ports` ([]string) - A list of ports by UUID to attach to this instance.
|
||||||
|
|
||||||
|
- `user_data` (string) - User data to apply when launching the instance. Note that you need to be
|
||||||
|
careful about escaping characters due to the templates being JSON. It is
|
||||||
|
often more convenient to use user_data_file, instead. Packer will not
|
||||||
|
automatically wait for a user script to finish before shutting down the
|
||||||
|
instance this must be handled in a provisioner.
|
||||||
|
|
||||||
|
- `user_data_file` (string) - Path to a file that will be used for the user data when launching the
|
||||||
instance.
|
instance.
|
||||||
|
|
||||||
- `user_data` (string) - User data to apply when launching the instance. Note
|
- `instance_name` (string) - Name that is applied to the server instance created by Packer. If this
|
||||||
that you need to be careful about escaping characters due to the templates
|
isn't specified, the default is same as image_name.
|
||||||
being JSON. It is often more convenient to use user_data_file, instead.
|
|
||||||
Packer will not automatically wait for a user script to finish before
|
|
||||||
shutting down the instance this must be handled in a provisioner.
|
|
||||||
|
|
||||||
- `user_data_file` (string) - Path to a file that will be used for the user
|
- `instance_metadata` (map[string]string) - Metadata that is applied to the server instance created by Packer. Also
|
||||||
data when launching the instance.
|
called server properties in some documentation. The strings have a max
|
||||||
|
size of 255 bytes each.
|
||||||
|
|
||||||
- `instance_name` (string) - Name that is applied to the server instance
|
- `force_delete` (bool) - Whether to force the OpenStack instance to be forcefully deleted. This
|
||||||
created by Packer. If this isn't specified, the default is same as
|
is useful for environments that have reclaim / soft deletion enabled. By
|
||||||
image_name.
|
default this is false.
|
||||||
|
|
||||||
- `instance_metadata` (map[string]string) - Metadata that is
|
- `config_drive` (bool) - Whether or not nova should use ConfigDrive for cloud-init metadata.
|
||||||
applied to the server instance created by Packer. Also called server
|
|
||||||
properties in some documentation. The strings have a max size of 255 bytes
|
|
||||||
each.
|
|
||||||
|
|
||||||
- `force_delete` (bool) - Whether to force the OpenStack instance to be
|
- `floating_ip_pool` (string) - Deprecated use floating_ip_network instead.
|
||||||
forcefully deleted. This is useful for environments that have
|
|
||||||
reclaim / soft deletion enabled. By default this is false.
|
|
||||||
|
|
||||||
- `config_drive` (bool) - Whether or not nova should use ConfigDrive for
|
- `use_blockstorage_volume` (bool) - Use Block Storage service volume for the instance root volume instead of
|
||||||
cloud-init metadata.
|
Compute service local volume (default).
|
||||||
|
|
||||||
- `floating_ip_pool` (string) - Deprecated use floating_ip_network
|
- `volume_name` (string) - Name of the Block Storage service volume. If this isn't specified,
|
||||||
instead.
|
random string will be used.
|
||||||
|
|
||||||
- `use_blockstorage_volume` (bool) - Use Block Storage service volume for
|
- `volume_type` (string) - Type of the Block Storage service volume. If this isn't specified, the
|
||||||
the instance root volume instead of Compute service local volume (default).
|
default enforced by your OpenStack cluster will be used.
|
||||||
|
|
||||||
- `volume_name` (string) - Name of the Block Storage service volume. If this
|
- `volume_size` (int) - Size of the Block Storage service volume in GB. If this isn't specified,
|
||||||
isn't specified, random string will be used.
|
it is set to source image min disk value (if set) or calculated from the
|
||||||
|
source image bytes size. Note that in some cases this needs to be
|
||||||
|
specified, if use_blockstorage_volume is true.
|
||||||
|
|
||||||
- `volume_type` (string) - Type of the Block Storage service volume. If this
|
- `volume_availability_zone` (string) - Availability zone of the Block Storage service volume. If omitted,
|
||||||
isn't specified, the default enforced by your OpenStack cluster will be
|
Compute instance availability zone will be used. If both of Compute
|
||||||
used.
|
instance and Block Storage volume availability zones aren't specified,
|
||||||
|
the default enforced by your OpenStack cluster will be used.
|
||||||
- `volume_size` (int) - Size of the Block Storage service volume in GB. If
|
|
||||||
this isn't specified, it is set to source image min disk value (if set) or
|
|
||||||
calculated from the source image bytes size. Note that in some cases this
|
|
||||||
needs to be specified, if use_blockstorage_volume is true.
|
|
||||||
|
|
||||||
- `volume_availability_zone` (string) - Availability zone of the Block
|
|
||||||
Storage service volume. If omitted, Compute instance availability zone will
|
|
||||||
be used. If both of Compute instance and Block Storage volume availability
|
|
||||||
zones aren't specified, the default enforced by your OpenStack cluster will
|
|
||||||
be used.
|
|
||||||
|
|
||||||
- `openstack_provider` (string) - Not really used, but here for BC
|
- `openstack_provider` (string) - Not really used, but here for BC
|
||||||
|
|
||||||
- `use_floating_ip` (bool) - Deprecated use floating_ip or
|
- `use_floating_ip` (bool) - *Deprecated* use `floating_ip` or `floating_ip_pool` instead.
|
||||||
floating_ip_pool instead.
|
|
||||||
|
|
|
@ -1,19 +1,62 @@
|
||||||
<!-- Code generated from the comments of the RunConfig struct in builder/openstack/run_config.go; DO NOT EDIT MANUALLY -->
|
<!-- Code generated from the comments of the RunConfig struct in builder/openstack/run_config.go; DO NOT EDIT MANUALLY -->
|
||||||
|
|
||||||
- `source_image` (string) - The ID or full URL to the base image to use. This
|
- `source_image` (string) - The ID or full URL to the base image to use. This is the image that will
|
||||||
is the image that will be used to launch a new server and provision it.
|
be used to launch a new server and provision it. Unless you specify
|
||||||
Unless you specify completely custom SSH settings, the source image must
|
completely custom SSH settings, the source image must have cloud-init
|
||||||
have cloud-init installed so that the keypair gets assigned properly.
|
installed so that the keypair gets assigned properly.
|
||||||
|
|
||||||
- `source_image_name` (string) - The name of the base image to use. This is
|
- `source_image_name` (string) - The name of the base image to use. This is an alternative way of
|
||||||
an alternative way of providing source_image and only either of them can
|
providing source_image and only either of them can be specified.
|
||||||
be specified.
|
|
||||||
|
|
||||||
- `source_image_filter` (ImageFilter) - The search filters for determining the base
|
- `source_image_filter` (ImageFilter) - Filters used to populate filter options. Example:
|
||||||
image to use. This is an alternative way of providing source_image and
|
|
||||||
only one of these methods can be used. source_image will override the
|
|
||||||
filters.
|
|
||||||
|
|
||||||
- `flavor` (string) - The ID, name, or full URL for the desired flavor for
|
``` json {
|
||||||
the server to be created.
|
"source_image_filter": {
|
||||||
|
"filters": {
|
||||||
|
"name": "ubuntu-16.04",
|
||||||
|
"visibility": "protected",
|
||||||
|
"owner": "d1a588cf4b0743344508dc145649372d1",
|
||||||
|
"tags": ["prod", "ready"],
|
||||||
|
"properties": {
|
||||||
|
"os_distro": "ubuntu"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"most_recent": true
|
||||||
|
}
|
||||||
|
} ```
|
||||||
|
|
||||||
|
This selects the most recent production Ubuntu 16.04 shared to you by
|
||||||
|
the given owner. NOTE: This will fail unless *exactly* one image is
|
||||||
|
returned, or `most_recent` is set to true. In the example of multiple
|
||||||
|
returned images, `most_recent` will cause this to succeed by selecting
|
||||||
|
the newest image of the returned images.
|
||||||
|
|
||||||
|
- `filters` (map of strings) - filters used to select a
|
||||||
|
`source_image`.
|
||||||
|
NOTE: This will fail unless *exactly* one image is returned, or
|
||||||
|
`most_recent` is set to true. Of the filters described in
|
||||||
|
[ImageService](https://developer.openstack.org/api-ref/image/v2/), the
|
||||||
|
following are valid:
|
||||||
|
|
||||||
|
- name (string)
|
||||||
|
|
||||||
|
- owner (string)
|
||||||
|
|
||||||
|
- tags (array of strings)
|
||||||
|
|
||||||
|
- visibility (string)
|
||||||
|
|
||||||
|
- properties (map of strings to strings) (fields that can be set
|
||||||
|
with `openstack image set --property key=value`)
|
||||||
|
|
||||||
|
- `most_recent` (boolean) - Selects the newest created image when
|
||||||
|
true.
|
||||||
|
This is most useful for selecting a daily distro build.
|
||||||
|
|
||||||
|
You may set use this in place of `source_image` If `source_image_filter`
|
||||||
|
is provided alongside `source_image`, the `source_image` will override
|
||||||
|
the filter. The filter will not be used in this case.
|
||||||
|
|
||||||
|
- `flavor` (string) - The ID, name, or full URL for the desired flavor for the server to be
|
||||||
|
created.
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
<!-- Code generated from the comments of the RunConfig struct in builder/openstack/run_config.go; DO NOT EDIT MANUALLY -->
|
<!-- Code generated from the comments of the RunConfig struct in builder/openstack/run_config.go; DO NOT EDIT MANUALLY -->
|
||||||
RunConfig contains configuration for running an instance from a source
|
RunConfig contains configuration for running an instance from a source image
|
||||||
image and details on how to access that launched image.
|
and details on how to access that launched image.
|
||||||
|
|
Loading…
Reference in New Issue