Commit 9112873e by Edward Zarecor Committed by e0d

Initial attempt to write a play file

fixing path

refactor edx_ansible deploy

fixing role inclusion, I think

remove heredoc

indent bug.

fix printf

dern

yeah, ok.

Old version wasn't a win

conflicts

provision with sandbox

hacking

Adding new defaults
parent 73f1aa1f
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
roles: roles:
- role: swapfile - role: swapfile
SWAPFILE_SIZE: 2GB SWAPFILE_SIZE: 2GB
- aws
- role: nginx - role: nginx
nginx_sites: nginx_sites:
- certs - certs
...@@ -57,9 +58,13 @@ ...@@ -57,9 +58,13 @@
- role: ecomworker - role: ecomworker
ECOMMERCE_WORKER_BROKER_HOST: 127.0.0.1 ECOMMERCE_WORKER_BROKER_HOST: 127.0.0.1
when: SANDBOX_ENABLE_ECOMMERCE when: SANDBOX_ENABLE_ECOMMERCE
- programs - role: programs
- analytics_api when: SANDBOX_ENABLE_PROGRAMS
- insights - role: analytics_api
- role: analytics_api
when: SANDBOX_ENABLE_ANALYTICS_API
- role: insights
when: SANDBOX_ENABLE_INSIGHTS
# not ready yet: - edx_notes_api # not ready yet: - edx_notes_api
- demo - demo
- oauth_client_setup - oauth_client_setup
...@@ -67,11 +72,15 @@ ...@@ -67,11 +72,15 @@
- role: elasticsearch - role: elasticsearch
when: "'localhost' in EDXAPP_ELASTIC_SEARCH_CONFIG|map(attribute='host')" when: "'localhost' in EDXAPP_ELASTIC_SEARCH_CONFIG|map(attribute='host')"
- forum - forum
when: SANDBOX_ENABLE_FORUM
- role: notifier - role: notifier
NOTIFIER_DIGEST_TASK_INTERVAL: 5 NOTIFIER_DIGEST_TASK_INTERVAL: 5
when: SANDBOX_ENABLE_NOTIFIER
- role: xqueue - role: xqueue
update_users: True update_users: True
when: SANDBOX_ENABLE_XQUEUE
- certs - certs
when: SANDBOX_ENABLE_CERTS
- edx_ansible - edx_ansible
- role: datadog - role: datadog
when: COMMON_ENABLE_DATADOG when: COMMON_ENABLE_DATADOG
......
...@@ -89,6 +89,7 @@ extra_vars_file="/var/tmp/extra-vars-$$.yml" ...@@ -89,6 +89,7 @@ extra_vars_file="/var/tmp/extra-vars-$$.yml"
sandbox_secure_vars_file="${WORKSPACE}/configuration-secure/ansible/vars/developer-sandbox.yml" sandbox_secure_vars_file="${WORKSPACE}/configuration-secure/ansible/vars/developer-sandbox.yml"
sandbox_internal_vars_file="${WORKSPACE}/configuration-internal/ansible/vars/developer-sandbox.yml" sandbox_internal_vars_file="${WORKSPACE}/configuration-internal/ansible/vars/developer-sandbox.yml"
extra_var_arg="-e@${extra_vars_file}" extra_var_arg="-e@${extra_vars_file}"
play_file="/var/tmp/play-$$.yml"
if [[ $edx_internal == "true" ]]; then if [[ $edx_internal == "true" ]]; then
# if this is a an edx server include # if this is a an edx server include
...@@ -104,7 +105,7 @@ fi ...@@ -104,7 +105,7 @@ fi
if [[ -z $zone ]]; then if [[ -z $zone ]]; then
zone="us-east-1c" zone="us-east-1c"
fi fi
f
if [[ -z $vpc_subnet_id ]]; then if [[ -z $vpc_subnet_id ]]; then
vpc_subnet_id="subnet-cd867aba" vpc_subnet_id="subnet-cd867aba"
fi fi
...@@ -140,7 +141,7 @@ fi ...@@ -140,7 +141,7 @@ fi
if [[ -z $enable_newrelic ]]; then if [[ -z $enable_newrelic ]]; then
enable_newrelic="false" enable_newrelic="false"
fi fi
a/
if [[ -z $enable_datadog ]]; then if [[ -z $enable_datadog ]]; then
enable_datadog="false" enable_datadog="false"
fi fi
...@@ -170,6 +171,12 @@ ssh-keygen -f "/var/lib/jenkins/.ssh/known_hosts" -R "$deploy_host" ...@@ -170,6 +171,12 @@ ssh-keygen -f "/var/lib/jenkins/.ssh/known_hosts" -R "$deploy_host"
cd playbooks/edx-east cd playbooks/edx-east
cat << EOF > $extra_vars_file cat << EOF > $extra_vars_file
SANDBOX_ENABLE_ECOMMERCE: false
SANDBOX_ENABLE_ANALYTICS_API: false
SANDBOX_ENABLE_INSIGHTS: false
SANDBOX_ENABLE_FORUM: true
SANDBOX_ENABLE_CERTS: false
edx_platform_version: $edxapp_version edx_platform_version: $edxapp_version
forum_version: $forum_version forum_version: $forum_version
notifier_version: $notifier_version notifier_version: $notifier_version
...@@ -361,21 +368,32 @@ if [[ $reconfigure == "true" || $server_type == "full_edx_installation_from_scra ...@@ -361,21 +368,32 @@ if [[ $reconfigure == "true" || $server_type == "full_edx_installation_from_scra
run_ansible edx_continuous_integration.yml -i "${deploy_host}," $extra_var_arg --user ubuntu run_ansible edx_continuous_integration.yml -i "${deploy_host}," $extra_var_arg --user ubuntu
fi fi
cat <<EOF >> $play_file
- hosts: all
tasks:
- include: $WORKSPACE/configuration/playbooks/edx-east/edx_ansible.yml
EOF
if [[ $reconfigure != "true" && $server_type == "full_edx_installation" ]]; then if [[ $reconfigure != "true" && $server_type == "full_edx_installation" ]]; then
# Run deploy tasks for the roles selected # Run deploy tasks for the roles selected
for i in $roles; do for i in $roles; do
if [[ ${deploy[$i]} == "true" ]]; then if [[ ${deploy[$i]} == "true" ]]; then
cat $extra_vars_file
run_ansible ${i}.yml -i "${deploy_host}," $extra_var_arg --user ubuntu printf "%s\n" " - include: $WORKSPACE/configuration/playbooks/edx-east/${i}.yml" >> $play_file
if [[ ${i} == "edxapp" ]]; then if [[ ${i} == "edxapp" ]]; then
run_ansible worker.yml -i "${deploy_host}," $extra_var_arg --user ubuntu printf "%s\n" " - include: $WORKSPACE/configuration/playbooks/edx-east/worker.yml" >> $play_file
fi fi
fi fi
done done
cat $play_file
echo
cat $extra_vars_file
#run_ansible $play_file -i "${deploy_host}," $extra_var_arg --user ubuntu
run_ansible $WORKSPACE/configuration/playbooks/edx_sandbox.yml -i "${deploy_host}," $extra_var_arg --user ubuntu
fi fi
# deploy the edx_ansible role
run_ansible edx_ansible.yml -i "${deploy_host}," $extra_var_arg --user ubuntu
cat $sandbox_secure_vars_file $sandbox_internal_vars_file $extra_vars_file | grep -v -E "_version|migrate_db" > ${extra_vars_file}_clean cat $sandbox_secure_vars_file $sandbox_internal_vars_file $extra_vars_file | grep -v -E "_version|migrate_db" > ${extra_vars_file}_clean
ansible -c ssh -i "${deploy_host}," $deploy_host -m copy -a "src=${extra_vars_file}_clean dest=/edx/app/edx_ansible/server-vars.yml" -u ubuntu -b ansible -c ssh -i "${deploy_host}," $deploy_host -m copy -a "src=${extra_vars_file}_clean dest=/edx/app/edx_ansible/server-vars.yml" -u ubuntu -b
ret=$? ret=$?
......
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