Added launch group support for ec2 module

pull/18777/head
Kai Webber 9 years ago committed by Matt Clay
parent 89eec3e4cf
commit 4a8bd74f52

@ -244,6 +244,13 @@ options:
required: false required: false
default: null default: null
aliases: ['network_interface'] aliases: ['network_interface']
spot_launch_group:
version_added: "2.0"
description:
- Launch group for spot request, see U(http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/how-spot-instances-work.html#spot-launch-group)
required: false
default: null
aliases: []
author: author:
- "Tim Gerla (@tgerla)" - "Tim Gerla (@tgerla)"
@ -355,6 +362,7 @@ EXAMPLES = '''
wait: yes wait: yes
vpc_subnet_id: subnet-29e63245 vpc_subnet_id: subnet-29e63245
assign_public_ip: yes assign_public_ip: yes
spot_launch_group: report_generators
# Examples using pre-existing network interfaces # Examples using pre-existing network interfaces
- ec2: - ec2:
@ -857,6 +865,7 @@ def create_instances(module, ec2, vpc, override_count=None):
source_dest_check = module.boolean(module.params.get('source_dest_check')) source_dest_check = module.boolean(module.params.get('source_dest_check'))
termination_protection = module.boolean(module.params.get('termination_protection')) termination_protection = module.boolean(module.params.get('termination_protection'))
network_interfaces = module.params.get('network_interfaces') network_interfaces = module.params.get('network_interfaces')
spot_launch_group = module.params.get('spot_launch_group')
# group_id and group_name are exclusive of each other # group_id and group_name are exclusive of each other
if group_id and group_name: if group_id and group_name:
@ -1039,6 +1048,9 @@ def create_instances(module, ec2, vpc, override_count=None):
module.fail_json( module.fail_json(
msg="placement_group parameter requires Boto version 2.3.0 or higher.") msg="placement_group parameter requires Boto version 2.3.0 or higher.")
if spot_launch_group and isinstance(spot_launch_group, basestring):
params['launch_group'] = spot_launch_group
params.update(dict( params.update(dict(
count = count_remaining, count = count_remaining,
type = spot_type, type = spot_type,
@ -1307,6 +1319,7 @@ def main():
instance_type = dict(aliases=['type']), instance_type = dict(aliases=['type']),
spot_price = dict(), spot_price = dict(),
spot_type = dict(default='one-time', choices=["one-time", "persistent"]), spot_type = dict(default='one-time', choices=["one-time", "persistent"]),
spot_launch_group = dict(),
image = dict(), image = dict(),
kernel = dict(), kernel = dict(),
count = dict(type='int', default='1'), count = dict(type='int', default='1'),

Loading…
Cancel
Save