Commit 2b807592 by Feanil Patel

Merge pull request #745 from edx/feanil/proper_extra_vars

Feanil/proper extra vars
parents b074558f 8ba2271b
...@@ -13,8 +13,8 @@ COMMON_LOG_DIR: "{{ COMMON_DATA_DIR }}/log" ...@@ -13,8 +13,8 @@ COMMON_LOG_DIR: "{{ COMMON_DATA_DIR }}/log"
COMMON_BIN_DIR: "{{ COMMON_BASE_DIR }}/bin" COMMON_BIN_DIR: "{{ COMMON_BASE_DIR }}/bin"
COMMON_CFG_DIR: "{{ COMMON_BASE_DIR }}/etc" COMMON_CFG_DIR: "{{ COMMON_BASE_DIR }}/etc"
COMMON_ENV_NAME: 'default_env' COMMON_ENVIRONMENT: 'default_env'
COMMON_ENV_TYPE: 'default_type' COMMON_DEPLOYMENT: 'default_deployment'
COMMON_PYPI_MIRROR_URL: 'https://pypi.python.org/simple' COMMON_PYPI_MIRROR_URL: 'https://pypi.python.org/simple'
# do not include http/https # do not include http/https
COMMON_GIT_MIRROR: 'github.com' COMMON_GIT_MIRROR: 'github.com'
......
...@@ -44,6 +44,21 @@ ...@@ -44,6 +44,21 @@
when: celery_worker is defined and not devstack when: celery_worker is defined and not devstack
sudo_user: "{{ supervisor_user }}" sudo_user: "{{ supervisor_user }}"
- name: syncdb and migrate
shell: SERVICE_VARIANT=lms {{ edxapp_venv_bin}}/django-admin.py syncdb --migrate --noinput --settings=lms.envs.aws --pythonpath={{ edxapp_code_dir }}
when: migrate_db is defined and migrate_db|lower == "yes"
sudo_user: "{{ edxapp_user }}"
notify:
- "restart edxapp"
- "restart edxapp_workers"
- name: db migrate
shell: SERVICE_VARIANT=lms {{ edxapp_venv_bin }}/django-admin.py migrate --noinput --settings=lms.envs.aws --pythonpath={{ edxapp_code_dir }}
when: migrate_only is defined and migrate_only|lower == "yes"
notify:
- "restart edxapp"
- "restart edxapp_workers"
sudo_user: "{{ edxapp_user }}"
# Gather assets using rake if possible # Gather assets using rake if possible
...@@ -61,18 +76,3 @@ ...@@ -61,18 +76,3 @@
environment: "{{ edxapp_environment }}" environment: "{{ edxapp_environment }}"
- name: syncdb and migrate
shell: SERVICE_VARIANT=lms {{ edxapp_venv_bin}}/django-admin.py syncdb --migrate --noinput --settings=lms.envs.aws --pythonpath={{ edxapp_code_dir }}
when: migrate_db is defined and migrate_db|lower == "yes"
sudo_user: "{{ edxapp_user }}"
notify:
- "restart edxapp"
- "restart edxapp_workers"
- name: db migrate
shell: SERVICE_VARIANT=lms {{ edxapp_venv_bin }}/django-admin.py migrate --noinput --settings=lms.envs.aws --pythonpath={{ edxapp_code_dir }}
when: migrate_only is defined and migrate_only|lower == "yes"
notify:
- "restart edxapp"
- "restart edxapp_workers"
sudo_user: "{{ edxapp_user }}"
...@@ -18,14 +18,14 @@ ...@@ -18,14 +18,14 @@
- name: create ora application config - name: create ora application config
copy: copy:
src={{secure_dir}}/files/{{COMMON_ENV_TYPE}}/legacy_ora/ora.env.json src={{secure_dir}}/files/{{COMMON_ENVIRONMENT}}/legacy_ora/ora.env.json
dest={{ora_app_dir}}/env.json dest={{ora_app_dir}}/env.json
sudo_user: "{{ ora_user }}" sudo_user: "{{ ora_user }}"
register: env_state register: env_state
- name: create ora auth file - name: create ora auth file
copy: copy:
src={{secure_dir}}/files/{{COMMON_ENV_TYPE}}/legacy_ora/ora.auth.json src={{secure_dir}}/files/{{COMMON_ENVIRONMENT}}/legacy_ora/ora.auth.json
dest={{ora_app_dir}}/auth.json dest={{ora_app_dir}}/auth.json
sudo_user: "{{ ora_user }}" sudo_user: "{{ ora_user }}"
register: auth_state register: auth_state
......
...@@ -26,7 +26,7 @@ server { ...@@ -26,7 +26,7 @@ server {
{% endif %} {% endif %}
server_name studio.*; server_name ~^((stage|prod)-)?studio\..*;
access_log {{ nginx_log_dir }}/access.log; access_log {{ nginx_log_dir }}/access.log;
error_log {{ nginx_log_dir }}/error.log error; error_log {{ nginx_log_dir }}/error.log error;
......
...@@ -25,15 +25,15 @@ SPLUNKFORWARDER_PASSWORD: !!null ...@@ -25,15 +25,15 @@ SPLUNKFORWARDER_PASSWORD: !!null
SPLUNKFORWARDER_LOG_ITEMS: SPLUNKFORWARDER_LOG_ITEMS:
- directory: '{{ COMMON_LOG_DIR }}' - directory: '{{ COMMON_LOG_DIR }}'
recursive: true recursive: true
index: '{{COMMON_ENV_TYPE}}-{{COMMON_ENV_NAME}}' index: '{{COMMON_ENVIRONMENT}}-{{COMMON_DEPLOYMENT}}'
sourcetype: 'edx' sourcetype: 'edx'
- directory: '/var/log' - directory: '/var/log'
recursive: true recursive: true
index: '{{COMMON_ENV_TYPE}}-{{COMMON_ENV_NAME}}' index: '{{COMMON_ENVIRONMENT}}-{{COMMON_DEPLOYMENT}}'
sourcetype: 'syslog' sourcetype: 'syslog'
- directory: '{{ COMMON_LOG_DIR }}/nginx' - directory: '{{ COMMON_LOG_DIR }}/nginx'
recursive: true recursive: true
index: '{{COMMON_ENV_TYPE}}-{{COMMON_ENV_NAME}}' index: '{{COMMON_ENVIRONMENT}}-{{COMMON_DEPLOYMENT}}'
sourcetype: 'nginx' sourcetype: 'nginx'
# #
......
...@@ -58,7 +58,7 @@ class MongoConnection: ...@@ -58,7 +58,7 @@ class MongoConnection:
'deployment': args.deployment, 'deployment': args.deployment,
'configuration_ref': args.configuration_version, 'configuration_ref': args.configuration_version,
'configuration_secure_ref': args.configuration_secure_version, 'configuration_secure_ref': args.configuration_secure_version,
'vars': extra_vars, 'vars': git_refs,
} }
try: try:
self.mongo_ami.insert(query) self.mongo_ami.insert(query)
...@@ -142,6 +142,8 @@ def parse_args(): ...@@ -142,6 +142,8 @@ def parse_args():
help="don't cleanup on failures") help="don't cleanup on failures")
parser.add_argument('--vars', metavar="EXTRA_VAR_FILE", parser.add_argument('--vars', metavar="EXTRA_VAR_FILE",
help="path to extra var file", required=False) help="path to extra var file", required=False)
parser.add_argument('--refs', metavar="GIT_REFS_FILE",
help="path to a var file with app git refs", required=False)
parser.add_argument('-a', '--application', required=False, parser.add_argument('-a', '--application', required=False,
help="Application for subnet, defaults to admin", help="Application for subnet, defaults to admin",
default="admin") default="admin")
...@@ -314,11 +316,14 @@ EOF ...@@ -314,11 +316,14 @@ EOF
fi fi
cat << EOF >> $extra_vars cat << EOF >> $extra_vars
---
# extra vars passed into # extra vars passed into
# abbey.py including versions # abbey.py including versions
# of all the repositories # of all the repositories
{extra_vars_yml} {extra_vars_yml}
{git_refs_yml}
# path to local checkout of # path to local checkout of
# the secure repo # the secure repo
secure_vars: $secure_vars_file secure_vars: $secure_vars_file
...@@ -370,6 +375,7 @@ rm -rf $base_dir ...@@ -370,6 +375,7 @@ rm -rf $base_dir
identity_file=identity_file, identity_file=identity_file,
queue_name=run_id, queue_name=run_id,
extra_vars_yml=extra_vars_yml, extra_vars_yml=extra_vars_yml,
git_refs_yml=git_refs_yml,
secure_vars=secure_vars) secure_vars=secure_vars)
ec2_args = { ec2_args = {
...@@ -633,9 +639,17 @@ if __name__ == '__main__': ...@@ -633,9 +639,17 @@ if __name__ == '__main__':
extra_vars_yml = f.read() extra_vars_yml = f.read()
extra_vars = yaml.load(extra_vars_yml) extra_vars = yaml.load(extra_vars_yml)
else: else:
extra_vars_yml = "---\n" extra_vars_yml = ""
extra_vars = {} extra_vars = {}
if args.refs:
with open(args.refs) as f:
git_refs_yml = f.read()
git_refs = yaml.load(git_refs_yml)
else:
git_refs_yml = ""
git_refs = {}
if args.secure_vars: if args.secure_vars:
secure_vars = args.secure_vars secure_vars = args.secure_vars
else: else:
......
...@@ -149,6 +149,7 @@ def update_elb_rds_dns(zone): ...@@ -149,6 +149,7 @@ def update_elb_rds_dns(zone):
stack_elbs = [elb for elb in elb_con.get_all_load_balancers() stack_elbs = [elb for elb in elb_con.get_all_load_balancers()
if elb.vpc_id == vpc_id] if elb.vpc_id == vpc_id]
for elb in stack_elbs: for elb in stack_elbs:
for inst in elb.instances: for inst in elb.instances:
instance = ec2_con.get_all_instances( instance = ec2_con.get_all_instances(
...@@ -160,13 +161,12 @@ def update_elb_rds_dns(zone): ...@@ -160,13 +161,12 @@ def update_elb_rds_dns(zone):
else: else:
# deprecated, for backwards compatibility # deprecated, for backwards compatibility
play_tag = instance.tags['role'] play_tag = instance.tags['role']
play_tag = instance.tags['role']
fqdn = "{}-{}.{}".format(env_tag, play_tag, zone_name) fqdn = "{}-{}.{}".format(env_tag, play_tag, zone_name)
add_or_update_record(zone, fqdn, 'CNAME', 600, [elb.dns_name]) add_or_update_record(zone, fqdn, 'CNAME', 600, [elb.dns_name])
if play_tag == 'edxapp': if play_tag == 'edxapp':
# create courses and studio CNAME records for edxapp # create courses and studio CNAME records for edxapp
for name in ['courses', 'studio']: for name in ['courses', 'studio']:
fqdn = "{}.{}".format(name, zone_name) fqdn = "{}-{}.{}".format(env_tag, name, zone_name)
add_or_update_record(zone, fqdn, 'CNAME', add_or_update_record(zone, fqdn, 'CNAME',
600, [elb.dns_name]) 600, [elb.dns_name])
break # only need the first instance for tag info break # only need the first instance for tag info
......
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