Commit 5cd56655 by Sef Kloninger

validate machine var, remove migrate_db prompt

Added a validation on the machine variable, expected to be passed in
from the command line now, so that the worker play only works on
machines named "util" and the app play on machines named "app".
Otherwise it would be too easy to mix those up.

Now that we're using -e command line options, it's easier to use this to
specify the "modify_db" variable than prompt_vars.  Having every install
block on this question before was such a hassle!  Now we just won't
migrate unless you explicitly say so on the ansible command with
"migrate_db=yes" or "migrate_only=yes".

Conflicts:
	playbooks/edx-west/carnegie-prod-app.yml
	playbooks/edx-west/carnegie-prod-worker.yml
	playbooks/edx-west/cme-prod-app.yml
	playbooks/edx-west/cme-prod-worker.yml
	playbooks/edx-west/stage-app.yml
parent 31913ab9
......@@ -31,13 +31,19 @@ sure that the stanford-deploy-20130415 ssh key is in your ssh agent.
Some specifics:
* To hit multiple machines the -e parameter would look like this: ```"machine=app(1|2|4)"```.
* To do database migrations, include this: ```-e "migrate_db=yes"```. The default
behavior is to not do migrations.
* To hit multiple machines the use this: ```-e "machine=app(1|2|4)"```.
Use multiple separate "-e" options to specify multiple vars on the
command line.
* Usually I do with the ```--list-hosts``` option first to verify that I'm
doing something sane before actually running.
* To do the utility machines, use ```prod-worker.yml```. Those also
take the machine variable.
* To install the utility machines, substitute ```prod-worker.yml```. Those
are also parameterized on the take the machine variable (util1, util(1|2),
and so forth).
## Ansible Commands - Stage
......
<<<<<<< HEAD
- hosts: ~tag_Name_app(10|20)_carn
=======
# This uses variable expansion so you can select machine(s) from the command line
# using the -e flag. See README for instructions on how to use.
- hosts: ~tag_Name_{{machine}}_carn
pre_tasks:
- fail: msg="This playbook only runnable on 'app' machines"
when: "'app' not in machine"
>>>>>>> ddd57c4... validate machine var, remove migrate_db prompt
sudo: True
vars_prompt:
- name: "migrate_db"
prompt: "Should this playbook run database migrations? (Type 'yes' to run, anything else to skip migrations)"
default: "no"
private: no
vars:
secure_dir: '../../../configuration-secure/ansible'
# this indicates the path to site-specific (with precedence)
......
<<<<<<< HEAD
# this gets all running prod webservers
- hosts: tag_environment_prod_carn:&tag_function_util
# or we can get subsets of them by name
#- hosts: ~tag_Name_util(10)_carn
=======
- name: Basic util setup on carnegie workers
# This uses variable expansion so you can select machine(s) from the command line
# using the -e flag. See README for instructions on how to use.
hosts: ~tag_Name_{{machine}}_carn
pre_tasks:
- fail: msg="This playbook only runnable on 'util' machines"
when: "'util' not in machine"
>>>>>>> ddd57c4... validate machine var, remove migrate_db prompt
sudo: True
gather_facts: True
vars:
secure_dir: '../../../edx-secret/ansible'
# this indicates the path to site-specific (with precedence)
......
......@@ -9,17 +9,21 @@
# - apt: pkg=libzmq-dev,python-zmq state=present
# - action: fireball
<<<<<<< HEAD
# this gets all running prod webservers
#- hosts: tag_environment_prod:&tag_function_webserver
# or we can get subsets of them by name
- hosts: ~tag_Name_app(10|20)_cme
=======
# This uses variable expansion so you can select machine(s) from the command line
# using the -e flag. See README for instructions on how to use.
- hosts: ~tag_Name_{{machine}}_cme
pre_tasks:
- fail: msg="This playbook only runnable on 'app' machines"
when: "'app' not in machine"
>>>>>>> ddd57c4... validate machine var, remove migrate_db prompt
sudo: True
vars_prompt:
- name: "migrate_db"
prompt: "Should this playbook run database migrations? (Type 'yes' to run, anything else to skip migrations)"
default: "no"
private: no
vars:
secure_dir: '../../../edx-secret/ansible'
# this indicates the path to site-specific (with precedence)
......
<<<<<<< HEAD
# this gets all running prod webservers
- hosts: tag_environment_prod_cme:&tag_function_util
# or we can get subsets of them by name
#- hosts: ~tag_Name_util(10)_cme
=======
- name: Basic util setup on cme hosts
# This uses variable expansion so you can select machine(s) from the command line
# using the -e flag. See README for instructions on how to use.
hosts: ~tag_Name_{{machine}}_cme
pre_tasks:
- fail: msg="This playbook only runnable on 'util' machines"
when: "'util' not in machine"
>>>>>>> ddd57c4... validate machine var, remove migrate_db prompt
sudo: True
vars:
secure_dir: '../../../edx-secret/ansible'
......
# This uses variable expansion so you can select machine(s) from the command line
# using the -e flag. See README for instructions on how to use.
- hosts: ~tag_Name_{{machine}}_prod
#
# This alternative hits all running prod webservers. Left here as an example.
#- hosts: tag_environment_prod:&tag_function_webserver
pre_tasks:
- fail: msg="This playbook only runnable on 'app' machines"
when: "'app' not in machine"
sudo: True
vars_prompt:
- name: "migrate_db"
prompt: "Should this playbook run database migrations? (Type 'yes' to run, anything else to skip migrations)"
default: "no"
private: no
vars:
secure_dir: '../../../configuration-secure/ansible'
# this indicates the path to site-specific (with precedence)
......
- name: Basic util setup on all hosts
# This uses variable expansion so you can select machine(s) from the command line
# using the -e flag. See README for instructions on how to use.
# This uses variable expansion so you can select machine(s) from the command line
# using the -e flag. See README for instructions on how to use.
hosts: ~tag_Name_{{machine}}_prod
#
# This alternative hits all running prod webservers. Left here as an example.
# hosts: tag_environment_prod:&tag_function_util
pre_tasks:
- fail: msg="This playbook only runnable on 'util' machines"
when: "'util' not in machine"
sudo: True
vars:
secure_dir: '../../../configuration-secure/ansible'
......
# This uses variable expansion so you can select machine(s) from the command line
# using the -e flag. See README for instructions on how to use.
- hosts: ~tag_Name_{{machine}}_stage
#
# This alternative hits all running prod webservers. Left here as an example.
#- hosts: tag_environment_stage:&tag_function_webserver
- hosts: ~tag_Name_{{ machine }}_stage
pre_tasks:
- fail: msg="This playbook only runnable on 'app' machines"
when: "'app' not in machine"
sudo: True
vars_prompt:
- name: "migrate_db"
prompt: "Should this playbook run database migrations? (Type 'yes' to run, anything else to skip migrations)"
default: "no"
private: no
vars:
not_prod: true
secure_dir: ../../../edx-secret/ansible
......
---
- name: Basic util setup on all hosts
# This uses variable expansion so you can select machine(s) from the command line
# using the -e flag. See README for instructions on how to use.
# This uses variable expansion so you can select machine(s) from the command line
# using the -e flag. See README for instructions on how to use.
hosts: ~tag_Name_{{machine}}_stage
#
# This alternative hits all running prod webservers. Left here as an example.
# hosts: tag_environment_stage:&tag_function_util
pre_tasks:
- fail: msg="This playbook only runnable on 'util' machines"
when: "'util' not in machine"
sudo: True
vars:
secure_dir: ../../../edx-secret/ansible
......
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