Commit faafbcd4 by Jason Bau

Merge pull request #169 from edx/jbau/safer_migrate_db

Make the condition on migrate_db a bit safer for using in var_prompt
parents d6ec69b6 93d4bffa
# this gets all running prod webservers # this gets all running prod webservers
#- hosts: tag_environment_prod:&tag_function_webserver #- hosts: tag_environment_prod:&tag_function_webserver
# or we can get subsets of them by name # or we can get subsets of them by name
- hosts: ~tag_Name_app(12|22)_prod - hosts: ~tag_Name_app(4)_prod
#- hosts: ~tag_Name_app(11|21)_prod #- hosts: ~tag_Name_app(11|21)_prod
## these are cold hosts: ## these are cold hosts:
#- hosts: ~tag_Name_app(12|22)_prod #- hosts: ~tag_Name_app(12|22)_prod
...@@ -12,8 +12,8 @@ ...@@ -12,8 +12,8 @@
sudo: True sudo: True
vars_prompt: vars_prompt:
- name: "migrate_db" - name: "migrate_db"
prompt: "Should this playbook run database migrations? (<Return> for false, anything else for true)" prompt: "Should this playbook run database migrations? (Type 'yes' to run, anything else to skip migrations)"
default: false default: "no"
private: no private: no
vars: vars:
secure_dir: '../../../configuration-secure/ansible' secure_dir: '../../../configuration-secure/ansible'
......
# this gets all running prod webservers
- hosts: tag_environment_prod:&tag_function_util
# or we can get subsets of them by name
#- hosts: ~tag_Name_util(1|2)_prod
sudo: True
vars:
secure_dir: '../../../configuration-secure/ansible'
# this indicates the path to site-specific (with precedence)
# things like nginx template files
local_dir: '../../../configuration-secure/ansible/local'
migrate_db: "no"
vars_files:
- "{{ secure_dir }}/vars/edxapp_prod_vars.yml"
- "{{ secure_dir }}/vars/users.yml"
- "{{ secure_dir }}/vars/edxapp_prod_users.yml"
- "{{ secure_dir }}/vars/shib_prod_vars.yml"
roles:
- common
- { role: 'edxapp', celery_worker: True }
...@@ -9,8 +9,9 @@ ...@@ -9,8 +9,9 @@
# this indicates the path to site-specific (with precedence) # this indicates the path to site-specific (with precedence)
# things like nginx template files # things like nginx template files
local_dir: '../../../configuration-secure/ansible/local' local_dir: '../../../configuration-secure/ansible/local'
migrate_db: "no"
vars_files: vars_files:
- "{{ secure_dir }}/vars/edxapp_prod_vars.yml" - "{{ secure_dir }}/vars/ora_prod_vars.yml"
- "{{ secure_dir }}/vars/users.yml" - "{{ secure_dir }}/vars/users.yml"
- "{{ secure_dir }}/vars/edxapp_prod_users.yml" - "{{ secure_dir }}/vars/edxapp_prod_users.yml"
roles: roles:
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
sudo: True sudo: True
gather_facts: True gather_facts: True
vars: vars:
migrate_db: True migrate_db: "yes"
openid_workaround: True openid_workaround: True
ansible_ssh_private_key_file: /var/lib/jenkins/continuous-integration.pem ansible_ssh_private_key_file: /var/lib/jenkins/continuous-integration.pem
vars_files: vars_files:
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
sudo: True sudo: True
gather_facts: True gather_facts: True
vars: vars:
migrate_db: True migrate_db: "yes"
openid_workaround: True openid_workaround: True
ansible_ssh_private_key_file: /var/lib/jenkins/continuous-integration.pem ansible_ssh_private_key_file: /var/lib/jenkins/continuous-integration.pem
vars_files: vars_files:
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
sudo: True sudo: True
gather_facts: True gather_facts: True
vars: vars:
migrate_db: True migrate_db: "yes"
openid_workaround: True openid_workaround: True
roles: roles:
- common - common
......
...@@ -189,7 +189,7 @@ ...@@ -189,7 +189,7 @@
- name: syncdb and migrate - name: syncdb and migrate
shell: sudo -u www-data SERVICE_VARIANT=lms /opt/edx/bin/django-admin.py syncdb --migrate --noinput --settings=lms.envs.aws --pythonpath=/opt/wwc/edx-platform shell: sudo -u www-data SERVICE_VARIANT=lms /opt/edx/bin/django-admin.py syncdb --migrate --noinput --settings=lms.envs.aws --pythonpath=/opt/wwc/edx-platform
when: migrate_db is defined when: migrate_db is defined and migrate_db|lower == "yes"
tags: tags:
- deploy - deploy
- lms - lms
......
...@@ -86,7 +86,7 @@ ...@@ -86,7 +86,7 @@
- name: syncdb and migrate - name: syncdb and migrate
shell: sudo -u www-data {{ora_venv_dir}}/bin/django-admin.py syncdb --migrate --noinput --settings=edx_ora.aws --pythonpath={{ora_code_dir}} shell: sudo -u www-data {{ora_venv_dir}}/bin/django-admin.py syncdb --migrate --noinput --settings=edx_ora.aws --pythonpath={{ora_code_dir}}
when: migrate_db when: migrate_db is defined and migrate_db|lower == "yes"
notify: notify:
- restart edx-ora - restart edx-ora
- restart edx-ora-celery - restart edx-ora-celery
......
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
- name: syncdb and migrate - name: syncdb and migrate
shell: sudo -u www-data /opt/edx/bin/django-admin.py syncdb --migrate --noinput --settings=xqueue.aws_settings --pythonpath=/opt/wwc/xqueue shell: sudo -u www-data /opt/edx/bin/django-admin.py syncdb --migrate --noinput --settings=xqueue.aws_settings --pythonpath=/opt/wwc/xqueue
when: migrate_db when: migrate_db is defined and migrate_db|lower == "yes"
tags: tags:
- xqueue - xqueue
- syncdb - syncdb
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
sudo: True sudo: True
gather_facts: True gather_facts: True
vars: vars:
migrate_db: True migrate_db: "yes"
openid_workaround: True openid_workaround: True
vars_files: vars_files:
- "group_vars/all" - "group_vars/all"
......
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