Commit 68eabc30 by John Jarvis

New playbooks for the sandbox configuration

edx_sandbox for edx-east and an edx_sandbox reference
new launch_instance role for bringing instances up using the ec2 module
new edxlocal role for installing local dependencies
parent de4cdc8b
- name: Create sandbox instance
hosts: localhost
connection: local
user: root
sudo: False
gather_facts: False
vars:
keypair: continuous-integration
instance_type: m1.large
security_group: sandbox
image: ami-d0f89fb9
region: us-east-1
roles:
- launch_instance
- name: Configure instance(s)
hosts: ec2-54-226-85-68.compute-1.amazonaws.com
sudo: True
gather_facts: True
vars:
migrate_db: True
vars_files:
- "{{ secure_dir }}/vars/edxapp_sandbox.yml"
- "{{ secure_dir }}/vars/users.yml"
roles:
- common
- nginx
- gunicorn
- edxlocal
- edxapp
- name: Create sandbox instance
hosts: localhost
connection: local
user: root
sudo: False
gather_facts: False
vars:
keypair: continuous-integration
instance_type: m1.large
security_group: sandbox
image: ami-d0f89fb9
region: us-east-1
roles:
- launch_instance
- name: Configure instance(s)
hosts: ec2-54-226-85-68.compute-1.amazonaws.com
sudo: True
gather_facts: True
vars:
migrate_db: True
vars_files:
- "{{ secure_dir }}/vars/edxapp_ref_users.yml"
- "{{ secure_dir }}/vars/edxapp_sandbox.yml"
roles:
- common
- nginx
- gunicorn
- edxlocal
- edxapp
# Installs packages to run edx locally on a single instance
# requires:
# - group_vars/all
# - common/tasks/main.yml
# - nginx/tasks/main.yml
---
- name: install python-pymongo (req for ansible)
pip: name=pymongo
- name: install python-mysqldb (req for ansible)
apt: pkg=python-mysqldb state=present
- name: install mysql server and recommends
apt: pkg=mysql-server-5.5 state=present install_recommends=yes
- name: create a database
mysql_db: >
db=wwc
state=present
encoding=utf8
- name: install mongo server and recommends
apt: pkg=mongodb-server state=present install_recommends=yes
- name: stop mongo service
service: name=mongodb state=stopped
- name: move mongodb to /mnt
command: mv /var/lib/mongodb /mnt/. creates=/mnt/mongodb
- name: create mongodb symlink
file: src=/mnt/mongodb dest=/var/lib/mongodb state=link
- name: start mongo service
service: name=mongodb state=started
- name: wait for mongo server to start
wait_for: port=27017 delay=2
- name: create a mongodb user
mongodb_user: >
database=wwc
name=edxapp
password=password
state=present
- name: install memcached
apt: pkg=memcached state=present
# Launches an ec2 instance and blocks until the instance is up
# adds it to the host group
- name: Launch instance
local_action: ec2 keypair=$keypair group=$security_group instance_type=$instance_type image=$image wait=true region=$region
register: ec2
- name: Add new instance to host group
local_action: add_host hostname=${item.public_ip} groupname=launched
with_items: ${ec2.instances}
- name: Wait for SSH to come up
local_action: wait_for host=${item.public_dns_name} port=22 delay=60 timeout=320 state=started
with_items: ${ec2.instances}
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