Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
b2c51068
Commit
b2c51068
authored
Apr 21, 2014
by
Mike Buzzetti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding support for purging subnets
parent
5dada940
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
6 deletions
+20
-6
library/cloud/ec2_elb_lb
+20
-6
No files found.
library/cloud/ec2_elb_lb
View file @
b2c51068
...
@@ -72,7 +72,12 @@ options:
...
@@ -72,7 +72,12 @@ options:
required: false
required: false
default: None
default: None
aliases: []
aliases: []
version_added: "1.6"
version_added: "1.6"
purge_subnets:
description:
- Purge existing subnet on ELB that are not found in subnets
required: false
default: false
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.
...
@@ -189,6 +194,7 @@ EXAMPLES = """
...
@@ -189,6 +194,7 @@ EXAMPLES = """
security_group_ids: 'sg-123456, sg-67890'
security_group_ids: 'sg-123456, sg-67890'
region: us-west-2
region: us-west-2
subnets: 'subnet-123456, subnet-67890'
subnets: 'subnet-123456, subnet-67890'
purge_subnets: yes
listeners:
listeners:
- protocol: http
- protocol: http
load_balancer_port: 80
load_balancer_port: 80
...
@@ -213,7 +219,7 @@ class ElbManager(object):
...
@@ -213,7 +219,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
,
health_check
=
None
,
subnets
=
None
,
purge_subnets
=
None
,
region
=
None
,
**
aws_connect_params
):
region
=
None
,
**
aws_connect_params
):
self
.
module
=
module
self
.
module
=
module
...
@@ -225,6 +231,7 @@ class ElbManager(object):
...
@@ -225,6 +231,7 @@ class ElbManager(object):
self
.
security_group_ids
=
security_group_ids
self
.
security_group_ids
=
security_group_ids
self
.
health_check
=
health_check
self
.
health_check
=
health_check
self
.
subnets
=
subnets
self
.
subnets
=
subnets
self
.
purge_subnets
=
purge_subnets
self
.
aws_connect_params
=
aws_connect_params
self
.
aws_connect_params
=
aws_connect_params
self
.
region
=
region
self
.
region
=
region
...
@@ -434,8 +441,12 @@ class ElbManager(object):
...
@@ -434,8 +441,12 @@ class ElbManager(object):
def
_set_subnets
(
self
):
def
_set_subnets
(
self
):
"""Determine which subnets need to be attached or detached on the ELB"""
"""Determine which subnets need to be attached or detached on the ELB"""
if
self
.
subnets
:
if
self
.
subnets
:
subnets_to_detach
=
list
(
set
(
self
.
elb
.
subnets
)
-
set
(
self
.
subnets
))
if
self
.
purge_subnets
:
subnets_to_attach
=
list
(
set
(
self
.
subnets
)
-
set
(
self
.
elb
.
subnets
))
subnets_to_detach
=
list
(
set
(
self
.
elb
.
subnets
)
-
set
(
self
.
subnets
))
subnets_to_attach
=
list
(
set
(
self
.
subnets
)
-
set
(
self
.
elb
.
subnets
))
else
:
subnets_to_detach
=
None
subnets_to_attach
=
list
(
set
(
self
.
subnets
)
-
set
(
self
.
elb
.
subnets
))
if
subnets_to_attach
:
if
subnets_to_attach
:
self
.
_attach_subnets
(
subnets_to_attach
)
self
.
_attach_subnets
(
subnets_to_attach
)
...
@@ -517,7 +528,8 @@ def main():
...
@@ -517,7 +528,8 @@ def main():
purge_zones
=
{
'default'
:
False
,
'required'
:
False
,
'type'
:
'bool'
},
purge_zones
=
{
'default'
:
False
,
'required'
:
False
,
'type'
:
'bool'
},
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'
}
)
)
)
)
...
@@ -538,6 +550,7 @@ def main():
...
@@ -538,6 +550,7 @@ def main():
security_group_ids
=
module
.
params
[
'security_group_ids'
]
security_group_ids
=
module
.
params
[
'security_group_ids'
]
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'
]
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"
)
...
@@ -546,7 +559,8 @@ def main():
...
@@ -546,7 +559,8 @@ def main():
module
.
fail_json
(
msg
=
"At least one availability zone or subnet is required for ELB creation"
)
module
.
fail_json
(
msg
=
"At least one availability zone or subnet is required for ELB creation"
)
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
,
subnets
,
purge_zones
,
security_group_ids
,
health_check
,
subnets
,
purge_subnets
,
region
=
region
,
**
aws_connect_params
)
region
=
region
,
**
aws_connect_params
)
if
state
==
'present'
:
if
state
==
'present'
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment