Commit d4dc2aac by Han Su Kim

Adding vpc_subnet_id to allow for t2 instancds

Adding vpc_subnet_id to allow for t2 instancds

Adding vpc_subnet_id to allow for t2 instancds

Adding vpc_subnet_id to allow for t2 instancds

Adding vpc_subnet_id to allow for t2 instancds

Adding vpc_subnet_id to allow for t2 instancds

Adding vpc_subnet_id to allow for t2 instancds

Adding vpc_subnet_id to allow for t2 instancds

Adding vpc_subnet_id to allow for t2 instancds

Adding vpc_subnet_id to allow for t2 instancds

Adding vpc_subnet_id to allow for t2 instancds

Adding vpc_subnet_id to allow for t2 instancds

Update ansible-provision.sh

Taking out verbose mode

taking out diff mode
parent cbcaac46
...@@ -4,91 +4,6 @@ ...@@ -4,91 +4,6 @@
sudo: True sudo: True
tasks: tasks:
- name: Switch the mongo db to use ephemeral
file: >
name=/mnt/mongodb
state=directory
owner=mongodb
group=mongodb
tags: update_mongo_data
- name: update the mongo config to use the new mongo dir
shell: >
sed -i 's#^dbpath=.*#dbpath=/mnt/mongodb#' /etc/mongodb.conf
tags: update_mongo_data
- name: restart mongodb
service: >
name=mongodb
state=restarted
tags: update_mongo_data
- name: grab the most recent backup from s3 for forums
shell : >
/edx/bin/s3cmd ls s3://edx-mongohq/mongohq_backups/ | grep comment | sort | tail -1 | awk '{ print $4 }'
register: s3cmd_out_forum
tags: update_mongo_data
- name: grab the most recent backup from s3 for forums
shell : >
/edx/bin/s3cmd get {{ s3cmd_out_forum.stdout }} --skip-existing
chdir=/mnt
tags: update_mongo_data
when: s3cmd_out_forum.stdout is defined
- name: untar the s3 backup
shell: >
tar zxf {{ s3cmd_out_forum.stdout|basename }}
chdir=/mnt
when: s3cmd_out_forum.stdout is defined
tags: update_mongo_data
- name: grab the most recent backup from s3 for prod-edx
shell : >
/edx/bin/s3cmd ls s3://edx-mongohq/mongohq_backups/ | grep prod-edx | sort | tail -1 | awk '{ print $4 }'
register: s3cmd_out_modulestore
tags: update_mongo_data
- name: grab the most recent backup from s3 for prod-edx
shell : >
/edx/bin/s3cmd get {{ s3cmd_out_modulestore.stdout }} --skip-existing
chdir=/mnt
tags: update_mongo_data
when: s3cmd_out_modulestore.stdout is defined
- name: untar the s3 backup
shell: >
tar zxf {{ s3cmd_out_modulestore.stdout|basename }}
chdir=/mnt
tags: update_mongo_data
when: s3cmd_out_modulestore.stdout is defined
- name: Restore the mongo data for the forums
shell: >
mongorestore --drop -d cs_comments_service /mnt/comments-prod
tags: update_mongo_data
- name: Restore the mongo data for the modulestore
shell: >
mongorestore --drop -d edxapp /mnt/prod-edx
tags: update_mongo_data
# recreate users after the restore
- name: create a mongodb users
mongodb_user: >
database={{ item.database }}
name={{ item.user }}
password={{ item.password }}
state=present
with_items:
- user: cs_comments_service
password: password
database: cs_comments_service
- user: exdapp
password: password
database: edxapp
# WARNING - calling lineinfile on a symlink # WARNING - calling lineinfile on a symlink
# will convert the symlink to a file! # will convert the symlink to a file!
# don't use /edx/etc/server-vars.yml here # don't use /edx/etc/server-vars.yml here
...@@ -108,6 +23,17 @@ ...@@ -108,6 +23,17 @@
- "EDXAPP_MYSQL_PASSWORD: {{ EDXAPP_MYSQL_PASSWORD }}" - "EDXAPP_MYSQL_PASSWORD: {{ EDXAPP_MYSQL_PASSWORD }}"
tags: update_edxapp_mysql_host tags: update_edxapp_mysql_host
- name: Update mongo to point to the sandbox mongo clone
lineinfile: >
dest=/edx/app/edx_ansible/server-vars.yml
line="{{ item }}"
with_items:
- "EDXAPP_MONGO_HOSTS: {{ EDXAPP_MONGO_HOSTS }}"
- "EDXAPP_MONGO_DB_NAME: {{ EDXAPP_MONGO_DB_NAME }}"
- "EDXAPP_MONGO_USER: {{ EDXAPP_MONGO_USER }}"
- "EDXAPP_MONGO_PASS: {{ EDXAPP_MONGO_PASS }}"
tags: update_edxapp_mysql_host
- name: call update on edx-platform - name: call update on edx-platform
shell: > shell: >
/edx/bin/update edx-platform master /edx/bin/update edx-platform master
......
...@@ -4,12 +4,12 @@ ...@@ -4,12 +4,12 @@
gather_facts: False gather_facts: False
vars: vars:
keypair: continuous-integration keypair: continuous-integration
instance_type: m1.medium instance_type: t2.medium
security_group: sandbox security_group: sandbox-vpc
# ubuntu 12.04 # ubuntu 12.04
ami: ami-d0f89fb9 ami: ami-f478849c
region: us-east-1 region: us-east-1
zone: us-east-1b zone: us-east-1c
instance_tags: instance_tags:
environment: sandbox environment: sandbox
github_username: temp github_username: temp
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
dns_zone: m.sandbox.edx.org dns_zone: m.sandbox.edx.org
name_tag: sandbox-temp name_tag: sandbox-temp
elb: false elb: false
vpc_subnet_id: subnet-cd867aba
roles: roles:
- role: launch_ec2 - role: launch_ec2
keypair: "{{ keypair }}" keypair: "{{ keypair }}"
...@@ -33,6 +34,8 @@ ...@@ -33,6 +34,8 @@
dns_name: "{{ dns_name }}" dns_name: "{{ dns_name }}"
dns_zone: "{{ dns_zone }}" dns_zone: "{{ dns_zone }}"
zone: "{{ zone }}" zone: "{{ zone }}"
vpc_subnet_id: "{{ vpc_subnet_id }}"
assign_public_ip: yes
terminate_instance: true terminate_instance: true
instance_profile_name: sandbox instance_profile_name: sandbox
......
...@@ -41,6 +41,8 @@ ...@@ -41,6 +41,8 @@
group: "{{ security_group }}" group: "{{ security_group }}"
instance_type: "{{ instance_type }}" instance_type: "{{ instance_type }}"
image: "{{ ami }}" image: "{{ ami }}"
vpc_subnet_id: "{{ vpc_subnet_id }}"
assign_public_ip: yes
wait: true wait: true
region: "{{ region }}" region: "{{ region }}"
instance_tags: "{{instance_tags}}" instance_tags: "{{instance_tags}}"
......
...@@ -64,7 +64,11 @@ if [[ -z $region ]]; then ...@@ -64,7 +64,11 @@ if [[ -z $region ]]; then
fi fi
if [[ -z $zone ]]; then if [[ -z $zone ]]; then
zone="us-east-1b" zone="us-east-1c"
fi
if [[ -z $vpc_subnet_id ]]; then
vpc_subnet_id="subnet-cd867aba"
fi fi
if [[ -z $elb ]]; then if [[ -z $elb ]]; then
...@@ -81,16 +85,16 @@ fi ...@@ -81,16 +85,16 @@ fi
if [[ -z $ami ]]; then if [[ -z $ami ]]; then
if [[ $server_type == "full_edx_installation" ]]; then if [[ $server_type == "full_edx_installation" ]]; then
ami="ami-f0814498" ami="ami-f287419a"
elif [[ $server_type == "ubuntu_12.04" || $server_type == "full_edx_installation_from_scratch" ]]; then elif [[ $server_type == "ubuntu_12.04" || $server_type == "full_edx_installation_from_scratch" ]]; then
ami="ami-59a4a230" ami="ami-f478849c"
elif [[ $server_type == "ubuntu_14.04(experimental)" ]]; then elif [[ $server_type == "ubuntu_14.04(experimental)" ]]; then
ami="ami-408c7f28" ami="ami-a6926dce"
fi fi
fi fi
if [[ -z $instance_type ]]; then if [[ -z $instance_type ]]; then
instance_type="m1.medium" instance_type="t2.medium"
fi fi
if [[ -z $enable_monitoring ]]; then if [[ -z $enable_monitoring ]]; then
...@@ -201,7 +205,7 @@ EOF ...@@ -201,7 +205,7 @@ EOF
# run the tasks to launch an ec2 instance from AMI # run the tasks to launch an ec2 instance from AMI
cat $extra_vars_file cat $extra_vars_file
ansible-playbook edx_provision.yml -i inventory.ini $extra_var_arg --user ubuntu ansible-playbook edx_provision.yml -i inventory.ini $extra_var_arg --user ubuntu
if [[ $server_type == "full_edx_installation" ]]; then if [[ $server_type == "full_edx_installation" ]]; then
# additional tasks that need to be run if the # additional tasks that need to be run if the
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment