Adds support for Cloudwatch detailled monitoring in ec2_lc module.

Enabling detailled monitoring in the launch config is mandatory to be able to activate cloudwatch in the to be created autoscaling group.
This commit is contained in:
Frédéric de Villamil 2014-06-23 10:47:22 +02:00
parent 52c7d50f1e
commit 126d15cc43

View file

@ -73,6 +73,11 @@ options:
- The spot price you are bidding. Only applies for an autoscaling group with spot instances. - The spot price you are bidding. Only applies for an autoscaling group with spot instances.
required: false required: false
default: null default: null
instance_monitoring:
description:
- whether instances in group are launched with detailed monitoring.
required: false
default: false
aliases: [] aliases: []
extends_documentation_fragment: aws extends_documentation_fragment: aws
""" """
@ -133,6 +138,7 @@ def create_launch_config(connection, module):
volumes = module.params['volumes'] volumes = module.params['volumes']
instance_type = module.params.get('instance_type') instance_type = module.params.get('instance_type')
spot_price = module.params.get('spot_price') spot_price = module.params.get('spot_price')
instance_monitoring = module.params.get('instance_monitoring')
bdm = BlockDeviceMapping() bdm = BlockDeviceMapping()
if volumes: if volumes:
@ -152,7 +158,8 @@ def create_launch_config(connection, module):
user_data=user_data, user_data=user_data,
block_device_mappings=[bdm], block_device_mappings=[bdm],
instance_type=instance_type, instance_type=instance_type,
spot_price=spot_price) spot_price=spot_price,
instance_monitoring=instance_monitoring)
launch_configs = connection.get_all_launch_configurations(names=[name]) launch_configs = connection.get_all_launch_configurations(names=[name])
changed = False changed = False
@ -193,6 +200,7 @@ def main():
instance_type=dict(type='str'), instance_type=dict(type='str'),
state=dict(default='present', choices=['present', 'absent']), state=dict(default='present', choices=['present', 'absent']),
spot_price=dict(type='float'), spot_price=dict(type='float'),
instance_monitoring=dict(default=False, type='bool'),
) )
) )