builder/openstack: AZ support
This commit is contained in:
parent
44d86c2e90
commit
693f04afcc
@ -75,10 +75,11 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
|
|||||||
DebugKeyPath: fmt.Sprintf("os_%s.pem", b.config.PackerBuildName),
|
DebugKeyPath: fmt.Sprintf("os_%s.pem", b.config.PackerBuildName),
|
||||||
},
|
},
|
||||||
&StepRunSourceServer{
|
&StepRunSourceServer{
|
||||||
Name: b.config.ImageName,
|
Name: b.config.ImageName,
|
||||||
SourceImage: b.config.SourceImage,
|
SourceImage: b.config.SourceImage,
|
||||||
SecurityGroups: b.config.SecurityGroups,
|
SecurityGroups: b.config.SecurityGroups,
|
||||||
Networks: b.config.Networks,
|
Networks: b.config.Networks,
|
||||||
|
AvailabilityZone: b.config.AvailabilityZone,
|
||||||
},
|
},
|
||||||
&StepWaitForRackConnect{
|
&StepWaitForRackConnect{
|
||||||
Wait: b.config.RackconnectWait,
|
Wait: b.config.RackconnectWait,
|
||||||
|
@ -11,17 +11,18 @@ import (
|
|||||||
// RunConfig contains configuration for running an instance from a source
|
// RunConfig contains configuration for running an instance from a source
|
||||||
// image and details on how to access that launched image.
|
// image and details on how to access that launched image.
|
||||||
type RunConfig struct {
|
type RunConfig struct {
|
||||||
SourceImage string `mapstructure:"source_image"`
|
SourceImage string `mapstructure:"source_image"`
|
||||||
Flavor string `mapstructure:"flavor"`
|
Flavor string `mapstructure:"flavor"`
|
||||||
RawSSHTimeout string `mapstructure:"ssh_timeout"`
|
RawSSHTimeout string `mapstructure:"ssh_timeout"`
|
||||||
SSHUsername string `mapstructure:"ssh_username"`
|
SSHUsername string `mapstructure:"ssh_username"`
|
||||||
SSHPort int `mapstructure:"ssh_port"`
|
SSHPort int `mapstructure:"ssh_port"`
|
||||||
SSHInterface string `mapstructure:"ssh_interface"`
|
SSHInterface string `mapstructure:"ssh_interface"`
|
||||||
RackconnectWait bool `mapstructure:"rackconnect_wait"`
|
AvailabilityZone string `mapstructure:"availability_zone"`
|
||||||
FloatingIpPool string `mapstructure:"floating_ip_pool"`
|
RackconnectWait bool `mapstructure:"rackconnect_wait"`
|
||||||
FloatingIp string `mapstructure:"floating_ip"`
|
FloatingIpPool string `mapstructure:"floating_ip_pool"`
|
||||||
SecurityGroups []string `mapstructure:"security_groups"`
|
FloatingIp string `mapstructure:"floating_ip"`
|
||||||
Networks []string `mapstructure:"networks"`
|
SecurityGroups []string `mapstructure:"security_groups"`
|
||||||
|
Networks []string `mapstructure:"networks"`
|
||||||
|
|
||||||
// Not really used, but here for BC
|
// Not really used, but here for BC
|
||||||
OpenstackProvider string `mapstructure:"openstack_provider"`
|
OpenstackProvider string `mapstructure:"openstack_provider"`
|
||||||
|
@ -11,10 +11,11 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type StepRunSourceServer struct {
|
type StepRunSourceServer struct {
|
||||||
Name string
|
Name string
|
||||||
SourceImage string
|
SourceImage string
|
||||||
SecurityGroups []string
|
SecurityGroups []string
|
||||||
Networks []string
|
Networks []string
|
||||||
|
AvailabilityZone string
|
||||||
|
|
||||||
server *servers.Server
|
server *servers.Server
|
||||||
}
|
}
|
||||||
@ -41,11 +42,12 @@ func (s *StepRunSourceServer) Run(state multistep.StateBag) multistep.StepAction
|
|||||||
ui.Say("Launching server...")
|
ui.Say("Launching server...")
|
||||||
s.server, err = servers.Create(computeClient, keypairs.CreateOptsExt{
|
s.server, err = servers.Create(computeClient, keypairs.CreateOptsExt{
|
||||||
CreateOptsBuilder: servers.CreateOpts{
|
CreateOptsBuilder: servers.CreateOpts{
|
||||||
Name: s.Name,
|
Name: s.Name,
|
||||||
ImageRef: s.SourceImage,
|
ImageRef: s.SourceImage,
|
||||||
FlavorRef: flavor,
|
FlavorRef: flavor,
|
||||||
SecurityGroups: s.SecurityGroups,
|
SecurityGroups: s.SecurityGroups,
|
||||||
Networks: networks,
|
Networks: networks,
|
||||||
|
AvailabilityZone: s.AvailabilityZone,
|
||||||
},
|
},
|
||||||
|
|
||||||
KeyName: keyName,
|
KeyName: keyName,
|
||||||
|
@ -50,6 +50,10 @@ each category, the available configuration keys are alphabetized.
|
|||||||
* `api_key` (string) - The API key used to access OpenStack. Some OpenStack
|
* `api_key` (string) - The API key used to access OpenStack. Some OpenStack
|
||||||
installations require this.
|
installations require this.
|
||||||
|
|
||||||
|
* `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.
|
||||||
|
|
||||||
* `floating_ip` (string) - A specific floating IP to assign to this instance.
|
* `floating_ip` (string) - A specific floating IP to assign to this instance.
|
||||||
`use_floating_ip` must also be set to true for this to have an affect.
|
`use_floating_ip` must also be set to true for this to have an affect.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user