From 72035367fe7dff428927c4f445ef58d4e8433d43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20de=20Villamil?= Date: Mon, 23 Jun 2014 09:05:47 +0200 Subject: [PATCH] Adding support for spot instances in ansible_lc. AWS allows to define launch configuration with spot instances. This is also natively supported by boto (see http://boto.readthedocs.org/en/latest/ref/autoscale.html) --- cloud/ec2_lc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) mode change 100644 => 100755 cloud/ec2_lc diff --git a/cloud/ec2_lc b/cloud/ec2_lc old mode 100644 new mode 100755 index dbf93ba629a..14d9f83bfd6 --- a/cloud/ec2_lc +++ b/cloud/ec2_lc @@ -68,6 +68,12 @@ options: required: false default: null aliases: [] + spot_price: + description: + - The spot price you are bidding. Only applies for an autoscaling group with spot instances. + required: false + default: null + aliases: [] extends_documentation_fragment: aws """ @@ -126,6 +132,7 @@ def create_launch_config(connection, module): user_data = module.params.get('user_data') volumes = module.params['volumes'] instance_type = module.params.get('instance_type') + spot_price = module.params.get('spot_price') bdm = BlockDeviceMapping() if volumes: @@ -144,7 +151,8 @@ def create_launch_config(connection, module): security_groups=security_groups, user_data=user_data, block_device_mappings=[bdm], - instance_type=instance_type) + instance_type=instance_type, + spot_price=spot_price) launch_configs = connection.get_all_launch_configurations(names=[name]) changed = False @@ -184,6 +192,7 @@ def main(): volumes=dict(type='list'), instance_type=dict(type='str'), state=dict(default='present', choices=['present', 'absent']), + spot_price=dict(type='float'), ) )