Commit 91242ec6 by John Jarvis

Merge pull request #1167 from edx/jarv/clean-ami

Jarv/clean ami
parents bc23df7c 9dd25d7d
...@@ -42,6 +42,13 @@ if [[ ! -f $BOTO_CONFIG ]]; then ...@@ -42,6 +42,13 @@ if [[ ! -f $BOTO_CONFIG ]]; then
fi fi
extra_vars_file="/var/tmp/extra-vars-$$.yml" extra_vars_file="/var/tmp/extra-vars-$$.yml"
extra_var_arg="-e@${extra_vars_file}"
if [[ $edx_internal == "true" ]]; then
# if this is a an edx server include
# the secret var file
extra_var_arg="-e@${extra_vars_file} -e@${WORKSPACE}/configuration-secure/ansible/vars/developer-sandbox.yml"
fi
if [[ -z $region ]]; then if [[ -z $region ]]; then
region="us-east-1" region="us-east-1"
...@@ -83,12 +90,6 @@ cd playbooks/edx-east ...@@ -83,12 +90,6 @@ cd playbooks/edx-east
cat << EOF > $extra_vars_file cat << EOF > $extra_vars_file
--- ---
ansible_ssh_private_key_file: /var/lib/jenkins/${keypair}.pem ansible_ssh_private_key_file: /var/lib/jenkins/${keypair}.pem
EDXAPP_PREVIEW_LMS_BASE: preview.${deploy_host}
EDXAPP_LMS_BASE: ${deploy_host}
EDXAPP_CMS_BASE: studio.${deploy_host}
EDXAPP_SITE_NAME: ${deploy_host}
CERTS_DOWNLOAD_URL: "http://${deploy_host}:18090"
CERTS_VERIFY_URL: "http://${deploy_host}:18090"
edx_platform_version: $edxapp_version edx_platform_version: $edxapp_version
forum_version: $forum_version forum_version: $forum_version
xqueue_version: $xqueue_version xqueue_version: $xqueue_version
...@@ -98,6 +99,16 @@ ease_version: $ease_version ...@@ -98,6 +99,16 @@ ease_version: $ease_version
certs_version: $certs_version certs_version: $certs_version
discern_version: $discern_version discern_version: $discern_version
EDXAPP_STATIC_URL_BASE: $static_url_base EDXAPP_STATIC_URL_BASE: $static_url_base
EDXAPP_LMS_NGINX_PORT: 80
EDXAPP_LMS_PREVIEW_NGINX_PORT: 80
EDX_ANSIBLE_DUMP_VARS: true
migrate_db: "yes"
openid_workaround: True
rabbitmq_ip: "127.0.0.1"
rabbitmq_refresh: True
COMMON_HOSTNAME: edx-server
COMMON_DEPLOYMENT: edx
COMMON_ENVIRONMENT: sandbox
# User provided extra vars # User provided extra vars
$extra_vars $extra_vars
...@@ -133,6 +144,23 @@ instance_tags: ...@@ -133,6 +144,23 @@ instance_tags:
datadog: monitored datadog: monitored
root_ebs_size: $root_ebs_size root_ebs_size: $root_ebs_size
name_tag: $name_tag name_tag: $name_tag
dns_zone: $dns_zone
rabbitmq_refresh: True
elb: $elb
EOF
if [[ $edx_internal == "true" ]]; then
# if this isn't a public server add the github
# user and set edx_internal to True so that
# xserver is installed
cat << EOF >> $extra_vars_file
EDXAPP_PREVIEW_LMS_BASE: preview.${deploy_host}
EDXAPP_LMS_BASE: ${deploy_host}
EDXAPP_CMS_BASE: studio.${deploy_host}
EDXAPP_SITE_NAME: ${deploy_host}
CERTS_DOWNLOAD_URL: "http://${deploy_host}:18090"
CERTS_VERIFY_URL: "http://${deploy_host}:18090"
edx_internal: True
COMMON_USER_INFO: COMMON_USER_INFO:
- name: ${github_username} - name: ${github_username}
github: true github: true
...@@ -142,16 +170,18 @@ rabbitmq_refresh: True ...@@ -142,16 +170,18 @@ rabbitmq_refresh: True
USER_CMD_PROMPT: '[$name_tag] ' USER_CMD_PROMPT: '[$name_tag] '
elb: $elb elb: $elb
EOF EOF
fi
# run the tasks to launch an ec2 instance from AMI # run the tasks to launch an ec2 instance from AMI
cat $extra_vars_file cat $extra_vars_file
ansible-playbook edx_provision.yml -i inventory.ini -e@${extra_vars_file} -e@${WORKSPACE}/configuration-secure/ansible/vars/developer-sandbox.yml --user ubuntu -v ansible-playbook edx_provision.yml -i inventory.ini $extra_var_arg --user ubuntu -v
if [[ $server_type == "full_edx_installation" ]]; then if [[ $server_type == "full_edx_installation" ]]; then
# additional tasks that need to be run if the # additional tasks that need to be run if the
# entire edx stack is brought up from an AMI # entire edx stack is brought up from an AMI
ansible-playbook rabbitmq.yml -i "${deploy_host}," -e@${extra_vars_file} -e@${WORKSPACE}/configuration-secure/ansible/vars/developer-sandbox.yml --user ubuntu ansible-playbook rabbitmq.yml -i "${deploy_host}," $extra_var_arg --user ubuntu
ansible-playbook restart_supervisor.yml -i "${deploy_host}," -e@${extra_vars_file} -e@${WORKSPACE}/configuration-secure/ansible/vars/developer-sandbox.yml --user ubuntu ansible-playbook restart_supervisor.yml -i "${deploy_host}," $extra_var_arg --user ubuntu
fi fi
fi fi
...@@ -163,13 +193,9 @@ done ...@@ -163,13 +193,9 @@ done
# If reconfigure was selected or if starting from an ubuntu 12.04 AMI # If reconfigure was selected or if starting from an ubuntu 12.04 AMI
# run non-deploy tasks for all roles # run non-deploy tasks for all roles
if [[ $server_type == "ubuntu_12.04" ]]; then
ansible-playbook create_user.yml -i "${deploy_host}," -e@${extra_vars_file} -e@${WORKSPACE}/configuration-secure/ansible/vars/developer-sandbox.yml --user ubuntu
fi
if [[ $reconfigure == "true" || $server_type == "full_edx_installation_from_scratch" ]]; then if [[ $reconfigure == "true" || $server_type == "full_edx_installation_from_scratch" ]]; then
cat $extra_vars_file cat $extra_vars_file
ansible-playbook edx_continuous_integration.yml -i "${deploy_host}," -e@${extra_vars_file} -e@${WORKSPACE}/configuration-secure/ansible/vars/developer-sandbox.yml --user ubuntu ansible-playbook edx_continuous_integration.yml -i "${deploy_host}," $extra_var_arg --user ubuntu
fi fi
if [[ $server_type == "full_edx_installation" ]]; then if [[ $server_type == "full_edx_installation" ]]; then
...@@ -177,13 +203,13 @@ if [[ $server_type == "full_edx_installation" ]]; then ...@@ -177,13 +203,13 @@ if [[ $server_type == "full_edx_installation" ]]; then
for i in $roles; do for i in $roles; do
if [[ ${deploy[$i]} == "true" ]]; then if [[ ${deploy[$i]} == "true" ]]; then
cat $extra_vars_file cat $extra_vars_file
ansible-playbook ${i}.yml -i "${deploy_host}," -e@${extra_vars_file} -e@${WORKSPACE}/configuration-secure/ansible/vars/developer-sandbox.yml --user ubuntu --tags deploy -v ansible-playbook ${i}.yml -i "${deploy_host}," $extra_var_arg --user ubuntu --tags deploy -v
fi fi
done done
fi fi
# deploy the edx_ansible role # deploy the edx_ansible role
ansible-playbook edx_ansible.yml -i "${deploy_host}," -e@${extra_vars_file} -e@${WORKSPACE}/configuration-secure/ansible/vars/developer-sandbox.yml --user ubuntu ansible-playbook edx_ansible.yml -i "${deploy_host}," $extra_var_arg --user ubuntu
# set the hostname # set the hostname
ansible-playbook set_hostname.yml -i "${deploy_host}," -e hostname_fqdn=${deploy_host} --user ubuntu ansible-playbook set_hostname.yml -i "${deploy_host}," -e hostname_fqdn=${deploy_host} --user ubuntu
......
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