mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Merge branch 'budlight-patch-2' into devel
This commit is contained in:
commit
863d5f3951
1 changed files with 11 additions and 3 deletions
|
@ -39,7 +39,7 @@ options:
|
|||
required: false
|
||||
availability_zones:
|
||||
description:
|
||||
- List of availability zone names in which to create the group.
|
||||
- List of availability zone names in which to create the group. Defaults to all the availability zones in the region if vpc_zone_identifier is not set.
|
||||
required: false
|
||||
launch_config_name:
|
||||
description:
|
||||
|
@ -102,7 +102,7 @@ def enforce_required_arguments(module):
|
|||
they cannot be mandatory arguments for the module, so we enforce
|
||||
them here '''
|
||||
missing_args = []
|
||||
for arg in ('min_size', 'max_size', 'launch_config_name', 'availability_zones'):
|
||||
for arg in ('min_size', 'max_size', 'launch_config_name'):
|
||||
if module.params[arg] is None:
|
||||
missing_args.append(arg)
|
||||
if missing_args:
|
||||
|
@ -125,6 +125,14 @@ def create_autoscaling_group(connection, module):
|
|||
|
||||
as_groups = connection.get_all_groups(names=[group_name])
|
||||
|
||||
if not vpc_zone_identifier and not availability_zones:
|
||||
region, ec2_url, aws_connect_params = get_aws_connection_info(module)
|
||||
try:
|
||||
ec2_connection = connect_to_aws(boto.ec2, region, **aws_connect_params)
|
||||
except boto.exception.NoAuthHandlerFound, e:
|
||||
module.fail_json(msg=str(e))
|
||||
module.params['availability_zones'] = [zone.name for zone in ec2_connection.get_all_zones()]
|
||||
|
||||
if not as_groups:
|
||||
ag = AutoScalingGroup(
|
||||
group_name=group_name,
|
||||
|
|
Loading…
Reference in a new issue