Commit cc183f75 by John Jarvis

add option for syncdb

parent f4e663a6
...@@ -4,9 +4,10 @@ ...@@ -4,9 +4,10 @@
gather_facts: False gather_facts: False
vars: vars:
db_dry_run: "--db-dry-run" db_dry_run: "--db-dry-run"
syncdb: false
tasks: tasks:
# Syncdb with migrate when the migrate user is overridden in extra vars # Syncdb with migrate when the migrate user is overridden in extra vars
- name: syncdb and migrate - name: migrate
shell: > shell: >
chdir={{ edxapp_code_dir }} chdir={{ edxapp_code_dir }}
python manage.py {{ item }} migrate --noinput {{ db_dry_run }} --settings=aws_migrate python manage.py {{ item }} migrate --noinput {{ db_dry_run }} --settings=aws_migrate
...@@ -16,3 +17,14 @@ ...@@ -16,3 +17,14 @@
with_items: with_items:
- lms - lms
- cms - cms
- name: syncdb
shell: >
chdir={{ edxapp_code_dir }}
python manage.py {{ item }} syncdb --noinput --settings=aws_migrate
environment:
DB_MIGRATION_USER: "{{ COMMON_MYSQL_MIGRATE_USER }}"
DB_MIGRATION_PASS: "{{ COMMON_MYSQL_MIGRATE_PASS }}"
when: syncdb
with_items:
- lms
- cms
...@@ -33,7 +33,11 @@ if [[ $db_dry_run == "false" ]]; then ...@@ -33,7 +33,11 @@ if [[ $db_dry_run == "false" ]]; then
# Set this to an empty string if db_dry_run is # Set this to an empty string if db_dry_run is
# not set. By default the db_dry_run var is # not set. By default the db_dry_run var is
# set to --db-dry-run # set to --db-dry-run
extra_var_args+=" -e db_dry_run=''" extra_var_args+=" -e db_dry_run=''"
else
# always skip syncdb unless dry run is unchecked
syncdb="false"
fi fi
if [[ -f ${WORKSPACE}/configuration-secure/ansible/vars/${environment}-${deployment}.yml ]]; then if [[ -f ${WORKSPACE}/configuration-secure/ansible/vars/${environment}-${deployment}.yml ]]; then
...@@ -47,6 +51,7 @@ done ...@@ -47,6 +51,7 @@ done
extra_var_args+=" -e edxapp_app_dir=${WORKSPACE}" extra_var_args+=" -e edxapp_app_dir=${WORKSPACE}"
extra_var_args+=" -e edxapp_code_dir=${WORKSPACE}/edx-platform" extra_var_args+=" -e edxapp_code_dir=${WORKSPACE}/edx-platform"
extra_var_args+=" -e edxapp_user=jenkins" extra_var_args+=" -e edxapp_user=jenkins"
extra_var_args+=" -e syncdb=$syncdb"
# Generate the json configuration files # Generate the json configuration files
ansible-playbook -c local $extra_var_args --tags edxapp_cfg -i localhost, -s -U jenkins edxapp.yml ansible-playbook -c local $extra_var_args --tags edxapp_cfg -i localhost, -s -U jenkins edxapp.yml
......
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