Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
configuration
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
edx
configuration
Commits
96304170
Commit
96304170
authored
Sep 18, 2014
by
e0d
Committed by
Feanil Patel
May 11, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug fixes
parent
1846b267
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
3 deletions
+20
-3
playbooks/library/ec2_subnet
+20
-3
No files found.
playbooks/library/ec2_subnet
View file @
96304170
...
...
@@ -69,7 +69,7 @@ class NonUniqueSubnetSpecification(Exception):
class
SubnetManager
:
def
__init__
(
self
,
connection
,
vpc_id
,
cidr_block
,
az
,
name
,
route_table_id
,
tags
=
[]):
def
__init__
(
self
,
connection
,
vpc_id
,
cidr_block
,
az
,
name
,
route_table_id
,
network_acl_id
,
tags
=
[]):
self
.
connection
=
connection
self
.
vpc_id
=
vpc_id
...
...
@@ -77,6 +77,7 @@ class SubnetManager:
self
.
az
=
az
self
.
name
=
name
self
.
route_table_id
=
route_table_id
self
.
network_acl_id
=
network_acl_id
self
.
tags
=
tags
self
.
subnet
=
None
...
...
@@ -117,6 +118,8 @@ class SubnetManager:
self
.
subnet
=
self
.
connection
.
create_subnet
(
self
.
vpc_id
,
self
.
cidr_block
,
availability_zone
=
self
.
az
)
self
.
do_tags
()
self
.
connection
.
associate_route_table
(
self
.
route_table_id
,
self
.
subnet
.
id
)
if
self
.
network_acl_id
:
self
.
connection
.
associate_network_acl
(
self
.
network_acl_id
,
self
.
subnet
.
id
)
return
changed
def
update_subnet
(
self
):
...
...
@@ -137,6 +140,18 @@ class SubnetManager:
self
.
connection
.
associate_route_table
(
self
.
route_table_id
,
self
.
subnet
.
id
)
changed
==
True
if
self
.
network_acl_id
:
self
.
connection
.
associate_network_acl
(
self
.
network_acl_id
,
self
.
subnet
.
id
)
# acl_results = self.connection.get_all_network_acls(
# filters={'association.subnet_id': self.subnet.id, 'vpc_id': self.vpc_id})
#
# if len(acl_results) == 1:
# acl = acl_results[0]
#
# if acl.id != self.network_acl_id:
# self.connection.disassociate_network_acl
return
changed
def
absent
(
self
):
...
...
@@ -176,7 +191,8 @@ def main():
vpc_id
=
dict
(
required
=
True
,
type
=
'str'
),
cidr_block
=
dict
(
required
=
True
,
type
=
'str'
),
az
=
dict
(
required
=
True
,
type
=
'str'
),
route_table_id
=
dict
(
require
=
True
,
type
=
'str'
),
route_table_id
=
dict
(
required
=
True
,
type
=
'str'
),
network_acl_id
=
dict
(
type
=
'str'
),
tags
=
dict
(
type
=
'list'
),
)
)
...
...
@@ -197,9 +213,10 @@ def main():
az
=
module
.
params
.
get
(
'az'
)
name
=
module
.
params
.
get
(
'name'
)
route_table_id
=
module
.
params
.
get
(
'route_table_id'
)
network_acl_id
=
module
.
params
.
get
(
'network_acl_id'
)
tags
=
module
.
params
.
get
(
'tags'
)
manager
=
SubnetManager
(
connection
,
vpc_id
,
cidr_block
,
az
,
name
,
route_table_id
,
tags
)
manager
=
SubnetManager
(
connection
,
vpc_id
,
cidr_block
,
az
,
name
,
route_table_id
,
network_acl_id
,
tags
)
state
=
module
.
params
.
get
(
'state'
)
...
...
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