From 7d85477acbac5966792e74f8919d079e4065b61a Mon Sep 17 00:00:00 2001 From: Rowan Wookey Date: Mon, 16 Mar 2015 17:53:35 +0000 Subject: [PATCH] Fixes #542 error when ec2_asg arguments aren't specified If max_size/min_size/desired_capacity are omitted when updating an autoscaling group use the existing values --- lib/ansible/modules/cloud/amazon/ec2_asg.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/ansible/modules/cloud/amazon/ec2_asg.py b/lib/ansible/modules/cloud/amazon/ec2_asg.py index 96c3f3bf16e..f2cb5aaf31f 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_asg.py +++ b/lib/ansible/modules/cloud/amazon/ec2_asg.py @@ -46,15 +46,15 @@ options: required: true min_size: description: - - Minimum number of instances in group + - Minimum number of instances in group, if unspecified then the current group value will be used. required: false max_size: description: - - Maximum number of instances in group + - Maximum number of instances in group, if unspecified then the current group value will be used. required: false desired_capacity: description: - - Desired number of instances in group + - Desired number of instances in group, if unspecified then the current group value will be used. required: false replace_all_instances: description: @@ -581,6 +581,13 @@ def replace(connection, module): changed = False return(changed, props) + #check if min_size/max_size/desired capacity have been specified and if not use ASG values + if min_size is None: + min_size = as_group.min_size + if max_size is None: + max_size = as_group.max_size + if desired_capacity is None: + desired_capacity = as_group.desired_capacity # set temporary settings and wait for them to be reached # This should get overriden if the number of instances left is less than the batch size.