Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
configuration
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
configuration
Commits
ef65c3ce
Commit
ef65c3ce
authored
Dec 14, 2016
by
Feanil Patel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update bootstrap to be able to run a subset and run a subset when launching an instance.
parent
9168b348
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
58 additions
and
30 deletions
+58
-30
playbooks/edx-east/edx_provision.yml
+14
-3
playbooks/roles/launch_ec2/tasks/main.yml
+5
-0
util/install/ansible-bootstrap.sh
+36
-26
util/jenkins/ansible-provision.sh
+3
-1
No files found.
playbooks/edx-east/edx_provision.yml
View file @
ef65c3ce
...
...
@@ -22,6 +22,13 @@
name_tag
:
sandbox-temp
elb
:
false
ec2_vpc_subnet_id
:
subnet-cd867aba
instance_userdata
:
|
#!/bin/bash
set -x
set -e
export RUN_ANSIBLE=false;
wget https://raw.githubusercontent.com/edx/configuration/{{ configuration_version }}/util/install/ansible-bootstrap.sh -O - | bash;
launch_wait_time
:
5
roles
:
-
role
:
launch_ec2
keypair
:
"
{{
keypair
}}"
...
...
@@ -38,19 +45,23 @@
assign_public_ip
:
yes
terminate_instance
:
true
instance_profile_name
:
sandbox
user_data
:
"
{{
instance_userdata
}}"
launch_ec2_wait_time
:
"
{{
launch_wait_time
}}"
-
name
:
Configure instance(s)
hosts
:
launched
become
:
True
gather_facts
:
Tru
e
gather_facts
:
Fals
e
vars
:
elb
:
f
alse
elb
:
F
alse
pre_tasks
:
-
name
:
Wait for cloud-init to finish
wait_for
:
path
:
/var/log/cloud-init.log
timeout
:
15
timeout
:
15
search_regex
:
"
final-message"
-
name
:
gather_facts
setup
:
"
"
vars_files
:
-
roles/edxapp/defaults/main.yml
-
roles/xqueue/defaults/main.yml
...
...
playbooks/roles/launch_ec2/tasks/main.yml
View file @
ef65c3ce
...
...
@@ -52,6 +52,7 @@
delete_on_termination
:
true
zone
:
"
{{
zone
}}"
instance_profile_name
:
"
{{
instance_profile_name
}}"
user_data
:
"
{{
user_data
}}"
register
:
ec2
-
name
:
Add DNS name
...
...
@@ -95,3 +96,7 @@
port
:
22
delay
:
10
with_items
:
"
{{
ec2.instances
}}"
-
name
:
Wait for python to install
pause
:
minutes
:
"
{{
launch_ec2_wait_time
}}"
util/install/ansible-bootstrap.sh
View file @
ef65c3ce
...
...
@@ -33,6 +33,10 @@ if [[ -z "${UPGRADE_OS}" ]]; then
UPGRADE_OS
=
false
fi
if
[[
-z
"
${
RUN_ANSIBLE
}
"
]]
;
then
RUN_ANSIBLE
=
true
fi
#
# Bootstrapping constants
#
...
...
@@ -75,9 +79,9 @@ then
elif
grep
-q
'Xenial Xerus'
/etc/os-release
then
SHORT_DIST
=
"xenial"
else
else
cat
<<
EOF
This script is only known to work on Ubuntu Precise, Trusty and Xenial,
exiting. If you are interested in helping make installation possible
on other platforms, let us know.
...
...
@@ -96,7 +100,7 @@ if [ "${UPGRADE_OS}" = true ]; then
echo
"Upgrading the OS..."
apt-get upgrade
-y
fi
# Required for add-apt-repository
apt-get install
-y
software-properties-common python-software-properties
...
...
@@ -110,7 +114,7 @@ if [[ "precise" = "${SHORT_DIST}" || "trusty" = "${SHORT_DIST}" ]]; then
apt-key adv
--keyserver
"
${
EDX_PPA_KEY_SERVER
}
"
--recv-keys
"
${
EDX_PPA_KEY_ID
}
"
add-apt-repository
-y
"
${
EDX_PPA
}
"
fi
# Install python 2.7 latest, git and other common requirements
# NOTE: This will install the latest version of python 2.7 and
# which may differ from what is pinned in virtualenvironments
...
...
@@ -136,35 +140,41 @@ PATH=/usr/local/bin:${PATH}
pip install
setuptools
==
"
${
SETUPTOOLS_VERSION
}
"
pip install
virtualenv
==
"
${
VIRTUAL_ENV_VERSION
}
"
# create a new virtual env
/usr/local/bin/virtualenv
"
${
VIRTUAL_ENV
}
"
PATH
=
"
${
PYTHON_BIN
}
"
:
${
PATH
}
if
[[
"true"
==
"
${
RUN_ANSIBLE
}
"
]]
;
then
# create a new virtual env
/usr/local/bin/virtualenv
"
${
VIRTUAL_ENV
}
"
# Install the configuration repository to install
# edx_ansible role
git clone
${
CONFIGURATION_REPO
}
${
CONFIGURATION_DIR
}
cd
${
CONFIGURATION_DIR
}
git checkout
${
CONFIGURATION_VERSION
}
make requirements
PATH
=
"
${
PYTHON_BIN
}
"
:
${
PATH
}
cd
"
${
CONFIGURATION_DIR
}
"
/playbooks/edx-east
"
${
PYTHON_BIN
}
"
/ansible-playbook edx_ansible.yml
-i
'127.0.0.1,'
-c
local
-e
"configuration_version=
${
CONFIGURATION_VERSION
}
"
# Install the configuration repository to install
# edx_ansible role
git clone
${
CONFIGURATION_REPO
}
${
CONFIGURATION_DIR
}
cd
${
CONFIGURATION_DIR
}
git checkout
${
CONFIGURATION_VERSION
}
make requirements
# cleanup
rm
-rf
"
${
ANSIBLE_DIR
}
"
rm
-rf
"
${
CONFIGURATION_DIR
}
"
rm
-rf
"
${
VIRTUAL_ENV
}
"
rm
-rf
"
${
HOME
}
/.ansible"
cd
"
${
CONFIGURATION_DIR
}
"
/playbooks/edx-east
"
${
PYTHON_BIN
}
"
/ansible-playbook edx_ansible.yml
-i
'127.0.0.1,'
-c
local
-e
"configuration_version=
${
CONFIGURATION_VERSION
}
"
cat
<<
EOF
******************************************************************************
# cleanup
rm
-rf
"
${
ANSIBLE_DIR
}
"
rm
-rf
"
${
CONFIGURATION_DIR
}
"
rm
-rf
"
${
VIRTUAL_ENV
}
"
rm
-rf
"
${
HOME
}
/.ansible"
Done bootstrapping, edx_ansible is now installed in /edx/app/edx_ansible.
Time to run some plays. Activate the virtual env with
cat
<<
EOF
******************************************************************************
> . /edx/app/edx_ansible/venvs/edx_ansible/bin/activate
Done bootstrapping, edx_ansible is now installed in /edx/app/edx_ansible.
Time to run some plays. Activate the virtual env with
******************************************************************************
> . /edx/app/edx_ansible/venvs/edx_ansible/bin/activate
******************************************************************************
EOF
else
mkdir
-p
/edx/ansible/facts.d
echo
'{ "ansible_bootstrap_run": true }'
>
/edx/ansible/facts.d/ansible_bootstrap.json
fi
util/jenkins/ansible-provision.sh
View file @
ef65c3ce
...
...
@@ -337,7 +337,9 @@ elb: $elb
EOF
if
[[
$server_type
!=
"full_edx_installation_from_scratch"
]]
;
then
extra_var_arg+
=
' -e instance_userdata="" -e launch_wait_time=0'
fi
# run the tasks to launch an ec2 instance from AMI
cat
$extra_vars_file
run_ansible edx_provision.yml
-i
inventory.ini
$extra_var_arg
--user
ubuntu
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment