mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Support internal-only ELBs in EC2.
This commit is contained in:
parent
0ac74aaf59
commit
0cc6c479bc
1 changed files with 20 additions and 9 deletions
|
@ -78,6 +78,11 @@ options:
|
||||||
- Purge existing subnet on ELB that are not found in subnets
|
- Purge existing subnet on ELB that are not found in subnets
|
||||||
required: false
|
required: false
|
||||||
default: false
|
default: false
|
||||||
|
scheme:
|
||||||
|
description:
|
||||||
|
- The scheme to use when creating the ELB. For a private VPC-visible ELB use 'internal'.
|
||||||
|
required: false
|
||||||
|
default: 'internet-facing'
|
||||||
validate_certs:
|
validate_certs:
|
||||||
description:
|
description:
|
||||||
- When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0.
|
- When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0.
|
||||||
|
@ -118,6 +123,7 @@ EXAMPLES = """
|
||||||
- local_action:
|
- local_action:
|
||||||
module: ec2_elb_lb
|
module: ec2_elb_lb
|
||||||
name: "test-vpc"
|
name: "test-vpc"
|
||||||
|
scheme: internal
|
||||||
state: present
|
state: present
|
||||||
subnets:
|
subnets:
|
||||||
- subnet-abcd1234
|
- subnet-abcd1234
|
||||||
|
@ -219,7 +225,7 @@ class ElbManager(object):
|
||||||
def __init__(self, module, name, listeners=None, purge_listeners=None,
|
def __init__(self, module, name, listeners=None, purge_listeners=None,
|
||||||
zones=None, purge_zones=None, security_group_ids=None,
|
zones=None, purge_zones=None, security_group_ids=None,
|
||||||
health_check=None, subnets=None, purge_subnets=None,
|
health_check=None, subnets=None, purge_subnets=None,
|
||||||
region=None, **aws_connect_params):
|
scheme="internet-facing", region=None, **aws_connect_params):
|
||||||
|
|
||||||
self.module = module
|
self.module = module
|
||||||
self.name = name
|
self.name = name
|
||||||
|
@ -231,6 +237,7 @@ class ElbManager(object):
|
||||||
self.health_check = health_check
|
self.health_check = health_check
|
||||||
self.subnets = subnets
|
self.subnets = subnets
|
||||||
self.purge_subnets = purge_subnets
|
self.purge_subnets = purge_subnets
|
||||||
|
self.scheme = scheme
|
||||||
|
|
||||||
self.aws_connect_params = aws_connect_params
|
self.aws_connect_params = aws_connect_params
|
||||||
self.region = region
|
self.region = region
|
||||||
|
@ -275,7 +282,8 @@ class ElbManager(object):
|
||||||
'zones': check_elb.availability_zones,
|
'zones': check_elb.availability_zones,
|
||||||
'security_group_ids': check_elb.security_groups,
|
'security_group_ids': check_elb.security_groups,
|
||||||
'status': self.status,
|
'status': self.status,
|
||||||
'subnets': self.subnets
|
'subnets': self.subnets,
|
||||||
|
'scheme': check_elb.scheme
|
||||||
}
|
}
|
||||||
|
|
||||||
if check_elb.health_check:
|
if check_elb.health_check:
|
||||||
|
@ -327,7 +335,8 @@ class ElbManager(object):
|
||||||
zones=self.zones,
|
zones=self.zones,
|
||||||
security_groups=self.security_group_ids,
|
security_groups=self.security_group_ids,
|
||||||
complex_listeners=listeners,
|
complex_listeners=listeners,
|
||||||
subnets=self.subnets)
|
subnets=self.subnets,
|
||||||
|
scheme=self.scheme)
|
||||||
if self.elb:
|
if self.elb:
|
||||||
self.changed = True
|
self.changed = True
|
||||||
self.status = 'created'
|
self.status = 'created'
|
||||||
|
@ -545,7 +554,8 @@ def main():
|
||||||
security_group_ids={'default': None, 'required': False, 'type': 'list'},
|
security_group_ids={'default': None, 'required': False, 'type': 'list'},
|
||||||
health_check={'default': None, 'required': False, 'type': 'dict'},
|
health_check={'default': None, 'required': False, 'type': 'dict'},
|
||||||
subnets={'default': None, 'required': False, 'type': 'list'},
|
subnets={'default': None, 'required': False, 'type': 'list'},
|
||||||
purge_subnets={'default': False, 'required': False, 'type': 'bool'}
|
purge_subnets={'default': False, 'required': False, 'type': 'bool'},
|
||||||
|
scheme={'default': 'internet-facing', 'required': False}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -567,6 +577,7 @@ def main():
|
||||||
health_check = module.params['health_check']
|
health_check = module.params['health_check']
|
||||||
subnets = module.params['subnets']
|
subnets = module.params['subnets']
|
||||||
purge_subnets = module.params['purge_subnets']
|
purge_subnets = module.params['purge_subnets']
|
||||||
|
scheme = module.params['scheme']
|
||||||
|
|
||||||
if state == 'present' and not listeners:
|
if state == 'present' and not listeners:
|
||||||
module.fail_json(msg="At least one port is required for ELB creation")
|
module.fail_json(msg="At least one port is required for ELB creation")
|
||||||
|
@ -577,7 +588,7 @@ def main():
|
||||||
elb_man = ElbManager(module, name, listeners, purge_listeners, zones,
|
elb_man = ElbManager(module, name, listeners, purge_listeners, zones,
|
||||||
purge_zones, security_group_ids, health_check,
|
purge_zones, security_group_ids, health_check,
|
||||||
subnets, purge_subnets,
|
subnets, purge_subnets,
|
||||||
region=region, **aws_connect_params)
|
scheme, region=region, **aws_connect_params)
|
||||||
|
|
||||||
if state == 'present':
|
if state == 'present':
|
||||||
elb_man.ensure_ok()
|
elb_man.ensure_ok()
|
||||||
|
|
Loading…
Reference in a new issue