Commit 15448a7e by Ibrahim

Automate WL Sandbox

parent aed6d562
......@@ -506,3 +506,9 @@
- Role: edxapp
- Added `EDXAPP_ZENDESK_OAUTH_ACCESS_TOKEN` for making requests to Zendesk through front-end.
- Role: whitelabel
- Added `WHITELABEL_THEME_DIR` to point to the location of whitelabel themes.
- Added `WHITELABEL_ADMIN_USER` to specify an admin user.
- Added `WHITELABEL_DNS` for DNS settings of themes.
- Added `WHITELABEL_ORG` for whitelabel organization settings.
- name: Setup Whitelabel themes
hosts: all
become: True
gather_facts: True
vars:
ENABLE_DATADOG: False
ENABLE_NEWRELIC: False
CLUSTER_NAME: 'discovery'
vars_files:
- "roles/edxapp/defaults/main.yml"
- "roles/discovery/defaults/main.yml"
- "roles/ecommerce/defaults/main.yml"
roles:
- aws
- edxlocal
- role: nginx
nginx_default_sites:
- discovery
- discovery
- role: datadog
when: COMMON_ENABLE_DATADOG
- role: splunkforwarder
when: COMMON_ENABLE_SPLUNKFORWARDER
- role: newrelic
when: COMMON_ENABLE_NEWRELIC
- role: newrelic_infrastructure
when: COMMON_ENABLE_NEWRELIC_INFRASTRUCTURE
- whitelabel
......@@ -91,6 +91,24 @@
- "{{ ec2.instances }}"
- ['studio', 'ecommerce', 'preview', 'discovery', 'credentials', 'veda']
- name: Add DNS name for whitelabel sites
local_action:
module: route53
overwrite: yes
command: create
zone: "{{ dns_zone }}"
type: CNAME
ttl: 300
record: "{{ item[1] }}"
value: "{{ item[0].public_dns_name }}"
register: task_result
until: task_result|succeeded
retries: 5
delay: 30
with_nested:
- "{{ ec2.instances }}"
- "{{ WHITELABEL_DNS }}"
- name: Add new instance to host group
local_action:
module: add_host
......
WHITELABEL_THEME_DIR: "edx-themes"
WHITELABEL_COURSE_TITLE: "WL_E2E-Test"
WHITELABEL_COURSE_NUM: "WL_E2E"
WHITELABEL_COURSE_RUN: "2018"
WHITELABEL_MODULE_STORE: "split"
---
dependencies:
- common
- edxapp_common
- role: edx_themes
theme_users:
- "{{ edxapp_user }}"
when: EDXAPP_ENABLE_COMPREHENSIVE_THEMING
# LMS
- name: Create Sites and Themes
shell: >
{{ COMMON_BIN_DIR }}/python.edxapp {{ COMMON_BIN_DIR }}/manage.edxapp lms --settings={{ COMMON_EDXAPP_SETTINGS }}
create_sites_and_configurations --dns-name {{ dns_name }} --theme-path {{ WHITELABEL_THEME_DIR }}
become_user: "{{ edxapp_user }}"
environment: "{{ edxapp_environment }}"
# CMS
- name: Create Courses
shell: >
{{ COMMON_BIN_DIR }}/python.edxapp {{ COMMON_BIN_DIR }}/manage.edxapp cms --settings={{ COMMON_EDXAPP_SETTINGS }}
create_course {{ WHITELABEL_MODULE_STORE }} {{ WHITELABEL_ADMIN_USER }} {{ item }} {{ WHITELABEL_COURSE_NUM }}
{{ WHITELABEL_COURSE_RUN }} {{ item }}-{{ WHITELABEL_COURSE_TITLE }}
become_user: "{{ edxapp_user }}"
environment: "{{ edxapp_environment }}"
with_items: "{{ WHITELABEL_ORG }}"
# Discovery
- name: Create Sites and Partners
shell: >
{{ COMMON_BIN_DIR }}/python.discovery {{ COMMON_BIN_DIR }}/manage.discovery create_sites_and_partners
--dns-name {{ dns_name }} --settings=course_discovery.settings.production --theme-path {{ WHITELABEL_THEME_DIR }}
become_user: "{{ discovery_user }}"
environment: "{{ discovery_environment }}"
# Ecommere
- name: Create Sites and Partners for Ecommerce
shell: >
{{ COMMON_BIN_DIR }}/python.ecommerce {{ COMMON_BIN_DIR }}/manage.ecommerce create_sites_and_partners
--dns-name {{ dns_name }} --settings=ecommerce.settings.production --theme-path {{ WHITELABEL_THEME_DIR }}
become_user: "{{ ecommerce_user }}"
environment: "{{ ecommerce_environment }}"
......@@ -169,6 +169,10 @@ if [[ -z $enable_client_profiling ]]; then
enable_client_profiling="false"
fi
if [[ -z $set_whitelabel ]]; then
set_whitelabel="true"
fi
# Lowercase the dns name to deal with an ansible bug
dns_name="${dns_name,,}"
......@@ -405,5 +409,10 @@ fi
# set the hostname
run_ansible set_hostname.yml -i "${deploy_host}," -e hostname_fqdn=${deploy_host} --user ubuntu
if [[ $set_whitelabel == "true" ]]; then
# Setup Whitelabel themes
run_ansible whitelabel.yml -i "${deploy_host}," $extra_var_arg --user ubuntu
fi
rm -f "$extra_vars_file"
rm -f ${extra_vars_file}_clean
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