mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-26 20:31:27 -07:00
[ecs_service] fix assign_public ip for network configuration (#41685)
* fix assign_public ip for ecs_service * used module.botocore_at_least instead of distutils
This commit is contained in:
parent
14598ab3e2
commit
5a72eef0a3
3 changed files with 141 additions and 0 deletions
|
@ -102,6 +102,7 @@ options:
|
|||
- network configuration of the service. Only applicable for task definitions created with C(awsvpc) I(network_mode).
|
||||
- I(network_configuration) has two keys, I(subnets), a list of subnet IDs to which the task is attached and I(security_groups),
|
||||
a list of group names or group IDs for the task
|
||||
- assign_public_ip requires botocore >= 1.8.4
|
||||
version_added: 2.6
|
||||
launch_type:
|
||||
description:
|
||||
|
@ -324,6 +325,10 @@ class EcsServiceManager:
|
|||
except (botocore.exceptions.ClientError, botocore.exceptions.BotoCoreError) as e:
|
||||
self.module.fail_json_aws(e, msg="Couldn't look up security groups")
|
||||
result['securityGroups'] = groups
|
||||
if 'assign_public_ip' in network_config and self.module.botocore_at_least('1.8.4'):
|
||||
result['assign_public_ip'] = 'assign_public_ip'
|
||||
else:
|
||||
self.module.fail_json(msg='botocore needs to be version 1.8.4 or higher to use assign_public_ip in network_configuration')
|
||||
return dict(awsvpcConfiguration=result)
|
||||
|
||||
def find_in_array(self, array_of_services, service_name, field_name='serviceArn'):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue