Allow env-setup.sh to use alternate url/branches

For an offline install, env-setup.sh needs to be able to clone
from locations other than GitHub.  Additionally, since
the ansible repo will have to have its .gitmodules file patched
to point submodules to some other location as well, its convenient
to allow for alternate branches.

As a side-effect, this moves the documentation of what branch
we're using to the top of the script for easy reference and removes
the duplicated branch name.

Change-Id: I7432531915c03638aaf52f836cda607d424351ba
This commit is contained in:
Peter Martini 2015-07-02 06:56:30 -04:00
parent 7aa271b782
commit 94e2f9a4e3
2 changed files with 23 additions and 6 deletions

View File

@ -17,6 +17,20 @@ Those steps can be broken down into two general categories; the first being
steps that need to be done in your inventory file, and the second being
steps that need to be done on your target host outside of Ansible.
Ansible Specific Steps
----------------------
The script ``scripts/env-setup.sh`` will do a ``git clone`` to create
``/opt/stack/ansible``, if it doesn't already exist. You can use the
environment variables ``ANSIBLE_GIT_URL`` and ``ANSIBLE_GIT_BRANCH``
to override the source URL and the branch name to pull from.
Ansible uses Git submodules, which means if you are cloning from
anything other than the canonical location (GitHub), you'll need
to commit a patched ``.gitmodules`` to that repo so that submodules
are also cloned from an alternate location - otherwise, the submodules
will still try to clone from GitHub.
Bifrost Specific Steps
----------------------

View File

@ -1,6 +1,13 @@
#!/bin/bash
set -e
ANSIBLE_GIT_URL=${ANSIBLE_GIT_URL:-https://github.com/ansible/ansible.git}
# NOTE(TheJulia): Switching to Ansible stable-1.9 branch as the development
# branch is undergoing some massive changes and we are seeing odd failures
# that we should not be seeing. Until devel has stabilized, we should stay
# on the stable branch.
ANSIBLE_GIT_BRANCH=${ANSIBLE_GIT_BRANCH:-stable-1.9}
if [ -x '/usr/bin/apt-get' ]; then
if ! $(git --version &>/dev/null) ; then
sudo -H apt-get -y install git
@ -51,15 +58,11 @@ fi
sudo -H chown -R $u:$g /opt/stack
cd /opt/stack
# NOTE(TheJulia): Switching to Ansible stable-1.9 branch as the development
# branch is undergoing some massive changes and we are seeing odd failures
# that we should not be seeing. Until devel has stabilized, we should stay
# on the stable branch.
if [ ! -d ansible ]; then
git clone https://github.com/ansible/ansible.git --recursive -b stable-1.9
git clone $ANSIBLE_GIT_URL --recursive -b $ANSIBLE_GIT_BRANCH
else
cd ansible
git checkout stable-1.9
git checkout $ANSIBLE_GIT_BRANCH
git pull --rebase
git submodule update --init --recursive
git fetch