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
OpenEdx
configuration
Commits
3d6da859
Commit
3d6da859
authored
Sep 19, 2014
by
e0d
Committed by
Feanil Patel
May 11, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
initial update of entries
parent
96304170
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
94 additions
and
19 deletions
+94
-19
playbooks/edx-east/edx_service.yml
+16
-16
playbooks/library/ec2_acl
+78
-3
No files found.
playbooks/edx-east/edx_service.yml
View file @
3d6da859
...
@@ -55,25 +55,25 @@
...
@@ -55,25 +55,25 @@
-
"
id"
-
"
id"
register
:
acl_data
register
:
acl_data
-
name
:
Manage ELB Subnets
#
- name: Manage ELB Subnets
ec2_subnet
:
#
ec2_subnet:
state
:
"
{{
state
}}"
#
state: "{{ state }}"
region
:
"
{{
aws_region
}}"
#
region: "{{ aws_region }}"
name
:
"
{{
item.name
}}"
#
name: "{{ item.name }}"
vpc_id
:
"
{{
vpc_id
}}"
#
vpc_id: "{{ vpc_id }}"
cidr_block
:
"
{{
item.cidr
}}"
#
cidr_block: "{{ item.cidr }}"
az
:
"
{{
item.az
}}"
#
az: "{{ item.az }}"
route_table_id
:
"
{{
item.route_table_id
}}"
#
route_table_id: "{{ item.route_table_id }}"
tags
:
"
{{
item.tags
}}"
#
tags: "{{ item.tags }}"
register
:
created_elb_subnets
#
register: created_elb_subnets
with_items
:
elb_subnets
#
with_items: elb_subnets
#
#
# Hack alert, this registers a list in the global namespace
# Hack alert, this registers a list in the global namespace
# of just the subnet ids that were created above
# of just the subnet ids that were created above
#
#
-
debug
:
msg="{{ created_elb_subnets.results|map(attribute='subnet_id')| list }}"
#
- debug: msg="{{ created_elb_subnets.results|map(attribute='subnet_id')| list }}"
register
:
elb_sn_list
#
register: elb_sn_list
-
name
:
Manage Service Subnets
-
name
:
Manage Service Subnets
ec2_subnet
:
ec2_subnet
:
...
@@ -109,7 +109,7 @@
...
@@ -109,7 +109,7 @@
name
:
"
{{
elb_name
}}"
name
:
"
{{
elb_name
}}"
state
:
"
{{
state
}}"
state
:
"
{{
state
}}"
security_group_ids
:
"
{{
elb_sec_group.group_id
}}"
security_group_ids
:
"
{{
elb_sec_group.group_id
}}"
subnets
:
"
{{
elb_s
n_list.msg
}}"
subnets
:
"
{{
elb_s
ubnets
}}"
health_check
:
"
{{
elb_healthcheck
}}"
health_check
:
"
{{
elb_healthcheck
}}"
listeners
:
"
{{
elb_listeners
}}"
listeners
:
"
{{
elb_listeners
}}"
register
:
elb
register
:
elb
...
@@ -151,7 +151,7 @@
...
@@ -151,7 +151,7 @@
register
:
asg
register
:
asg
-
name
:
Manage scaling policies
-
name
:
Manage scaling policies
ec2_scaling_policy
:
ec2_scaling_policy
_1.8
:
state
:
"
{{
item.state
}}"
state
:
"
{{
item.state
}}"
profile
:
"
{{
item.profile
}}"
profile
:
"
{{
item.profile
}}"
region
:
"
{{
item.region
}}"
region
:
"
{{
item.region
}}"
...
...
playbooks/library/ec2_acl
View file @
3d6da859
...
@@ -105,10 +105,85 @@ class ACLManager():
...
@@ -105,10 +105,85 @@ class ACLManager():
self
.
do_tags
()
self
.
do_tags
()
return
changed
return
changed
# TODO refactor out repitition
def
update_rules
(
self
):
def
update_rules
(
self
):
# TODO implement
rules
=
[]
current_ingress
=
[
x
.
rule_number
for
x
in
self
.
acl
.
network_acl_entries
if
x
.
egress
==
'false'
]
return
rules
current_egress
=
[
x
.
rule_number
for
x
in
self
.
acl
.
network_acl_entries
if
x
.
egress
==
'true'
]
modified_ingress
=
[]
modified_egress
=
[]
for
rule
in
self
.
rules
:
egress
=
True
if
rule
[
'type'
]
==
"egress"
else
False
protocol
=
PROTOCOL_NUMBERS
[
rule
[
'protocol'
]
.
upper
()]
if
not
egress
:
if
rule
[
'number'
]
not
in
current_ingress
:
# new rule
self
.
connection
.
create_network_acl_entry
(
self
.
acl
.
id
,
rule
[
'number'
],
protocol
,
rule
[
'rule_action'
],
rule
[
'cidr_block'
],
egress
=
egress
,
port_range_from
=
rule
[
'from_port'
],
port_range_to
=
rule
[
'to_port'
])
else
:
# blindly replace rather than attempting
# to determine in the entry has changed
modified_ingress
.
append
(
rule
[
'number'
])
self
.
connection
.
replace_network_acl_entry
(
self
.
acl
.
id
,
rule
[
'number'
],
protocol
,
rule
[
'rule_action'
],
rule
[
'cidr_block'
],
egress
=
egress
,
port_range_from
=
rule
[
'from_port'
],
port_range_to
=
rule
[
'to_port'
])
else
:
if
rule
[
'number'
]
not
in
current_egress
:
# new rule
self
.
connection
.
create_network_acl_entry
(
self
.
acl
.
id
,
rule
[
'number'
],
protocol
,
rule
[
'rule_action'
],
rule
[
'cidr_block'
],
egress
=
egress
,
port_range_from
=
rule
[
'from_port'
],
port_range_to
=
rule
[
'to_port'
])
else
:
# blindly replace rather than attempting
# to determine in the entry has changed
modified_egress
.
append
(
rule
[
'number'
])
self
.
connection
.
replace_network_acl_entry
(
self
.
acl
.
id
,
rule
[
'number'
],
protocol
,
rule
[
'rule_action'
],
rule
[
'cidr_block'
],
egress
=
egress
,
port_range_from
=
rule
[
'from_port'
],
port_range_to
=
rule
[
'to_port'
])
removed_ingress_rule_numbers
=
[
c
for
c
in
current_ingress
if
c
not
in
modified_ingress
]
removed_egress_rule_numbers
=
[
c
for
c
in
current_egress
if
c
not
in
modified_egress
]
for
number
in
removed_ingress_rule_numbers
:
n
=
int
(
number
)
# reserved range for AWS
if
n
<
32767
:
self
.
connection
.
delete_network_acl_entry
(
self
.
acl
.
id
,
n
,
False
)
for
number
in
removed_egress_rule_numbers
:
n
=
int
(
number
)
# reserved range for AWS
if
n
<
32767
:
self
.
connection
.
delete_network_acl_entry
(
self
.
acl
.
id
,
n
,
True
)
def
create_rules
(
self
):
def
create_rules
(
self
):
...
...
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