Commit b16bb1c1 by John Jarvis

adding user provided extra vars

parent d7083830
...@@ -41,7 +41,7 @@ if [[ ! -f $BOTO_CONFIG ]]; then ...@@ -41,7 +41,7 @@ if [[ ! -f $BOTO_CONFIG ]]; then
exit 1 exit 1
fi fi
extra_vars="/var/tmp/extra-vars-$$.yml" extra_vars_file="/var/tmp/extra-vars-$$.yml"
if [[ -z $region ]]; then if [[ -z $region ]]; then
region="us-east-1" region="us-east-1"
...@@ -80,7 +80,7 @@ ssh-keygen -f "/var/lib/jenkins/.ssh/known_hosts" -R "$deploy_host" ...@@ -80,7 +80,7 @@ ssh-keygen -f "/var/lib/jenkins/.ssh/known_hosts" -R "$deploy_host"
cd playbooks/edx-east cd playbooks/edx-east
cat << EOF > $extra_vars 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_PREVIEW_LMS_BASE: preview.${deploy_host}
...@@ -96,11 +96,14 @@ ease_version: $ease_version ...@@ -96,11 +96,14 @@ 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
# User provided extra vars
$extra_vars
EOF EOF
if [[ $basic_auth == "true" ]]; then if [[ $basic_auth == "true" ]]; then
# vars specific to provisioning added to $extra-vars # vars specific to provisioning added to $extra-vars
cat << EOF_AUTH >> $extra_vars cat << EOF_AUTH >> $extra_vars_file
NGINX_HTPASSWD_USER: $auth_user NGINX_HTPASSWD_USER: $auth_user
NGINX_HTPASSWD_PASS: $auth_pass NGINX_HTPASSWD_PASS: $auth_pass
EOF_AUTH EOF_AUTH
...@@ -109,7 +112,7 @@ fi ...@@ -109,7 +112,7 @@ fi
if [[ $recreate == "true" ]]; then if [[ $recreate == "true" ]]; then
# vars specific to provisioning added to $extra-vars # vars specific to provisioning added to $extra-vars
cat << EOF >> $extra_vars cat << EOF >> $extra_vars_file
dns_name: $dns_name dns_name: $dns_name
keypair: $keypair keypair: $keypair
instance_type: $instance_type instance_type: $instance_type
...@@ -136,14 +139,14 @@ elb: $elb ...@@ -136,14 +139,14 @@ elb: $elb
EOF EOF
# run the tasks to launch an ec2 instance from AMI # run the tasks to launch an ec2 instance from AMI
cat $extra_vars cat $extra_vars_file
ansible-playbook edx_provision.yml -i inventory.ini -e@${extra_vars} -e@${WORKSPACE}/configuration-secure/ansible/vars/developer-sandbox.yml --user ubuntu -v ansible-playbook edx_provision.yml -i inventory.ini -e@${extra_vars_file} -e@${WORKSPACE}/configuration-secure/ansible/vars/developer-sandbox.yml --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} -e@${WORKSPACE}/configuration-secure/ansible/vars/developer-sandbox.yml --user ubuntu ansible-playbook rabbitmq.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}," -e@${extra_vars} -e@${WORKSPACE}/configuration-secure/ansible/vars/developer-sandbox.yml --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
fi fi
fi fi
...@@ -156,21 +159,21 @@ done ...@@ -156,21 +159,21 @@ 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 [[ $reconfigure == "true" || $server_type == "full_edx_installation_from_scratch" ]]; then if [[ $reconfigure == "true" || $server_type == "full_edx_installation_from_scratch" ]]; then
cat $extra_vars cat $extra_vars_file
ansible-playbook edx_continuous_integration.yml -i "${deploy_host}," -e@${extra_vars} -e@${WORKSPACE}/configuration-secure/ansible/vars/developer-sandbox.yml --user ubuntu --skip-tags deploy ansible-playbook edx_continuous_integration.yml -i "${deploy_host}," -e@${extra_vars_file} -e@${WORKSPACE}/configuration-secure/ansible/vars/developer-sandbox.yml --user ubuntu --skip-tags deploy
fi fi
if [[ $server_type == "full_edx_installation" || $server_type == "full_edx_installation_from_scratch" ]]; then if [[ $server_type == "full_edx_installation" || $server_type == "full_edx_installation_from_scratch" ]]; 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 cat $extra_vars_file
ansible-playbook ${i}.yml -i "${deploy_host}," -e@${extra_vars} -e@${WORKSPACE}/configuration-secure/ansible/vars/developer-sandbox.yml --user ubuntu --tags deploy ansible-playbook ${i}.yml -i "${deploy_host}," -e@${extra_vars_file} -e@${WORKSPACE}/configuration-secure/ansible/vars/developer-sandbox.yml --user ubuntu --tags deploy
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} -e@${WORKSPACE}/configuration-secure/ansible/vars/developer-sandbox.yml --user ubuntu ansible-playbook edx_ansible.yml -i "${deploy_host}," -e@${extra_vars_file} -e@${WORKSPACE}/configuration-secure/ansible/vars/developer-sandbox.yml --user ubuntu
rm -f "$extra_vars" rm -f "$extra_vars_file"
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