Commit 357d3a10 by John Jarvis

script and play to connect sandboxes to prod

parent 5ef9da4e
- name: connect a sandbox to production data
hosts: all
gather_facts: False
sudo: True
tasks:
- name: Dump mongo data using the cloned dbs for forums
shell: >
mongodump -d comments-prod-clone -u {{ CLONE_FORUM_USER }} -p {{ CLONE_FORUM_PASS }} -h {{ CLONE_FORUM_HOST }} --port {{ CLONE_FORUM_PORT }} -o /mnt/forum-dump -c {{ item }}
with_items:
- activities
- blocked_hash
- contents
- contents_tag_aggregation
- delayed_backend_mongoid_jobs
- results
- subscriptions
- users
- name: Restore the mongo data for the forums
shell: >
mongorestore --drop -d cs_comments_service -u cs_comments_service -p 'password' /mnt/forum-dump
- name: Dump mongo data using the cloned dbs for the modulestore
shell: >
mongodump -d prod-edx-clone -u {{ CLONE_MODULESTORE_USER }} -p {{ CLONE_MODULESTORE_PASS }} -h {{ CLONE_MODULESTORE_HOST }} --port {{ CLONE_MODULESTORE_PORT }} -o /mnt/modulestore-dump -c modulestore
- name: Restore the mongo data for the modulestore
shell: >
mongorestore --drop -d edxapp -u edxapp -p 'password' /mnt/modulestore-dump
- name: Remove dump files
shell: >
rm -rf {{ item }}
with_items:
- /mnt/forum-dump
- /mnt/modulestore-dump
#!/usr/bin/env bash
# Ansible provisioning wrapper script that
# assumes the following parameters set
# as environment variables
#
# - github_username
# - server_type
# - instance_type
# - region
# - aws_account
# - keypair
# - ami
# - root_ebs_size
# - security_group
# - dns_zone
# - dns_name
# - environment
# - name_tag
export PYTHONUNBUFFERED=1
export BOTO_CONFIG=/var/lib/jenkins/${aws_account}.boto
if [[ -z $WORKSPACE ]]; then
dir=$(dirname $0)
source "$dir/ascii-convert.sh"
else
source "$WORKSPACE/configuration/util/jenkins/ascii-convert.sh"
fi
if [[ ! -f $BOTO_CONFIG ]]; then
echo "AWS credentials not found for $aws_account"
exit 1
fi
if [[ -z $sandbox_to_update ]]; then
sandbox_to_update="${BUILD_USER}.m.sandbox.edx.org"
fi
cd $WORKSPACE/configuration/playbooks/edx-east
ansible-playbook connect_sandbox.yml -i $sandbox_to_update, -e@${WORKSPACE}/configuration-secure/ansible/vars/clone-db.yml --user ubuntu -v
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