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
aa02e62f
Commit
aa02e62f
authored
May 14, 2015
by
Feanil Patel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add RDS subnet related logic.
parent
0a2447d2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
63 additions
and
8 deletions
+63
-8
playbooks/roles/edx_vpc/tasks/main.yml
+63
-8
No files found.
playbooks/roles/edx_vpc/tasks/main.yml
View file @
aa02e62f
...
...
@@ -91,9 +91,9 @@
region
:
"
{{
aws_region
}}"
tags
:
-
Name
:
"
{{
vpc_name
}}-nat-instance"
register
:
potential_existing_nat
register
:
nat_instance
-
debug
:
msg="{{
potential_existing_nat
}}"
-
debug
:
msg="{{
nat_instance
}}"
-
name
:
create nat instance
local_action
:
...
...
@@ -110,17 +110,28 @@
instance_tags
:
Name
:
"
{{
vpc_name
}}-nat-instance"
image
:
"
{{
vpc_nat_ami_id
}}"
register
:
created_nat_instance
when
:
potential_existing_nat.instances|length == 0
register
:
new_nat_instance
when
:
nat_instance.instances|length == 0
# We need to do this instead of registering the output of the above
# command because if the above command get skipped, the output does
# not contain information about the instance.
-
name
:
lookup the created nat_instance
local_action
:
module
:
"
ec2_lookup"
region
:
"
{{
aws_region
}}"
tags
:
-
Name
:
"
{{
vpc_name
}}-nat-instance"
register
:
nat_instance
-
name
:
assign eip to nat
ec2_eip
:
profile
:
"
{{
profile
}}"
region
:
"
{{
aws_region
}}"
instance_id
:
"
{{
created_
nat_instance.instances[0].id
}}"
instance_id
:
"
{{
nat_instance.instances[0].id
}}"
in_vpc
:
true
reuse_existing_ip_allowed
:
true
when
:
potential_existing_nat.instances|length == 0
when
:
new_nat_instance.changed
-
name
:
create private route table
ec2_rt
:
...
...
@@ -130,5 +141,49 @@
state
:
"
present"
name
:
"
{{
vpc_name
}}-private"
routes
:
"
{{
vpc_private_route_table
}}"
register
:
created_public_rt
when
:
potential_existing_nat.instances|length == 0
register
:
created_private_rt
-
name
:
create db network acl
ec2_acl
:
profile
:
"
{{
profile
}}"
name
:
"
{{
vpc_db_acl.name
}}"
vpc_id
:
"
{{
created_vpc.vpc_id
}}"
state
:
"
present"
region
:
"
{{
aws_region
}}"
rules
:
"
{{
vpc_db_acl.rules
}}"
register
:
created_db_acl
-
name
:
create db subnets
ec2_subnet
:
profile
:
"
{{
profile
}}"
vpc_id
:
"
{{
created_vpc.vpc_id
}}"
region
:
"
{{
aws_region
}}"
state
:
"
present"
name
:
"
{{
item.name
}}"
cidr
:
"
{{
item.cidr
}}"
az
:
"
{{
item.az
}}"
route_table_id
:
"
{{
created_private_rt.id
}}"
network_acl_id
:
"
{{
created_db_acl.id
}}"
with_items
:
vpc_db_subnets
register
:
created_db_subnets
-
name
:
extract the subnet ids
util_map
:
function
:
'
zip_to_list'
input
:
"
{{
created_db_subnets.results
}}"
args
:
-
"
subnet_id"
register
:
db_subnet_ids
-
debug
:
msg="{{ db_subnet_ids }}"
-
name
:
create db subnet group
rds_subnet_group
:
profile
:
"
{{
profile
}}"
region
:
"
{{
aws_region
}}"
state
:
"
present"
name
:
"
{{
vpc_db_subnet_group.name
}}"
description
:
"
{{
vpc_db_subnet_group.description
}}"
subnets
:
"
{{
db_subnet_ids.function_output
}}"
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