2 Standard Operating Procedures:
4 === Environmental specifics ===
6 For the use of this document, the following environment variables
10 PVENAME=openstack-${CPPROJECT}
15 VAGRANT_DEFAULT_PROVIDER=openstack
18 LF_GIT=/usr/src/git/lf
19 PVEPATH=${HOME}/src/python-virtual
20 PVE_DIR=${PVEPATH}/${PVENAME}
21 SERVER_NAME=${LFID}-vagrant
28 STACK_PROVIDER=vexxhost
29 STACK_PORTAL=secure.${STACK_PROVIDER}.com
30 STACK_ID_SERVER=auth.${STACK_PROVIDER}.net
31 STACK_REGION_NAME=ca-ymq-1
33 VAGRANT_DISTRIBUTOR=hashicorp
34 VDIST_DOMAIN=releases.${VAGRANT_DISTRIBUTOR}.com
35 # vagrant_${VDIST_VER}_${RH_ARCH_32}.deb
36 # vagrant_${VDIST_VER}_${RH_ARCH_64}.deb
37 VDIST_FILENAME=vagrant_${VDIST_VER}_${RH_ARCH}.deb
38 # Ask the web server what its latest version is
39 VDIST_VER=$(curl https://${VDIST_DOMAIN}/vagrant|html2text|awk -F_ '/_/ {print $2}'|sort|tail -1)
40 VDIST_PATH=vagrant/${VDIST_VER}/${VDIST_FILENAME}
41 VAGRANT_DISTFILE_URL=https://{$VDIST_DOMAIN}/${VDIST_PATH}
43 GERRIT_HOSTNAME=gerrit.${CP_DOMAIN}
44 GERRIT_DIR=${LF_GIT}/${GERRIT_HOSTNAME}
45 CIADM_NAME=ci-management
46 CIADM_DIR=${GERRIT_DIR}/${CIADM_NAME}
48 DEB_ARCH=${DEB_ARCH_64}
49 PVERC=${PVE_DIR}/bin/activate
51 === Establish Cloudstack Credentials ===
53 To get the correct configuration for the environment you will need
54 openstack credentials. Those used for this project are managed by
55 ${STACK_PROVIDER}. Establish credentials through appropriate
56 channels. Once credentials are acquired, visit this page:
58 https://${STACK_PORTAL}/console/#/account/credentials
60 The environment variables you need will be at the bottom of the page,
63 export OS_TENANT_NAME="00000000-0000-0000-0000-000000000000"
64 export OS_USERNAME="00000000-0000-0000-0000-000000000000"
65 export OS_PASSWORD="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
66 export OS_AUTH_URL="https://${STACK_ID_SERVER}/v2.0/"
67 export OS_REGION_NAME="${STACK_REGION_NAME}"
69 Save these lines to /tmp/openstack-credentials.sh
71 === Establish a python-virtual environment ===
73 For Debian-based systems, be sure that you install the
74 virtualenvwrapper packages
76 # Debian: sudo apt-get install virtualenvwrapper
80 cat /tmp/openstack-credentials.sh >> ${PVERC}
82 pip install --upgrade pip setuptools
83 pip install python-{cinder,glance,keystone,neutron,nova,openstack}client
85 === Install your public key into the cloudstack environment ===
87 Via the web interface: https://${STACK_PORTAL}/console/v2.html#/compute/keypairs
89 This command will install your yubikey-backed ssh key:
91 ssh-add -L | grep cardno | nova keypair-add --pub-key - ${LFID}
93 === Establish the GUID of our network ===
95 Via the web interface: https://${STACK_PORTAL}/console/#/networking/networks
99 export NETID=$(nova network-list | awk "/${CPPROJECT}/ {print \$2}")
100 grep -v '^NETID=' ${PVERC} | cat - > ${PVERC}
101 echo "NETID=${NETID}" >> ${PVERC}
103 === Install rbenv ===
107 sudo yum install -y \
108 git-core zlib zlib-devel gcc-c++ patch readline readline-devel \
109 libyaml-devel libffi-devel openssl-devel make bzip2 autoconf \
110 automake libtool bison curl sqlite-devel
111 git clone git://github.com/sstephenson/rbenv.git ~/.rbenv
112 eval $(echo 'export PATH="${HOME}/.rbenv/bin:${PATH}"' | tee -a ~/.bashrc)
114 time rbenv install ${RUBY_VER}
118 sudo apt-get build-dep ruby
119 sudo apt-get install rbenv ruby-build libssl-dev libreadline-dev
121 curl -fsSL https://gist.github.com/mislav/055441129184a1512bb5.txt > /tmp/debian-ssl-patch
122 time rbenv install --patch ${RUBY_VER} < /tmp/debian-ssl-patch # 7m42.708s
126 rbenv local ${RUBY_VER}
127 rbenv global ${RUBY_VER}
128 grep 'rbenv init' ~/.bashrc || \
129 echo 'eval "$(rbenv init -)"' >> ~/.bashrc && \
130 echo "rbenv local ${RUBY_VER}" >> ~/.bashrc && \
131 echo "rbenv global ${RUBY_VER}" >> ~/.bashrc
133 === Install Vagrant, vagrant-openstack-provider ===
135 On Debian, you must uninstall the system vagrant and instead install
136 the upstream package:
138 wget -O ${VAGRANT_DISTFILE_NAME} ${VAGRANT_DISTFILE_URL}
139 sudo dpkg -i ${VAGRANT_DISTFILE_NAME}
140 vagrant plugin install vagrant-openstack-provider
142 === Configure openstack 'dummy' box ===
145 vagrant box add dummy https://github.com/mitchellh/vagrant-aws/raw/master/dummy.box
146 cp ${CIADM_DIR}/vagrant/examples/box/dummy/Vagrantfile ~/.vagrant.d/boxes/dummy/0/openstack/
148 === Check out the ci-management repo from gerrit ===
152 mkdir -p ${GERRIT_DIR}
154 git clone ssh://${GERRIT_HOSTNAME}:29418/${CIADM_NAME}
156 === Acquire base images ===
158 Cloud image links by platform:
160 CentOS: http://cloud.centos.org/centos/
161 Ubuntu: https://cloud-images.ubuntu.com/
162 Debian: http://cdimage.debian.org/cdimage/openstack/
163 Arch: http://linuximages.de/openstack/arch/
164 Gentoo: http://linuximages.de/openstack/gentoo/
168 source ${CIADM_DIR}/vagrant/lib/respin-functions.sh
170 download_deb_image 'Ubuntu' '14.04' 'amd64'
171 download_deb_image 'Ubuntu' '16.04' 'amd64'
172 download_deb_image 'Debian' 'stable' 'amd64'
173 download_deb_image 'Debian' 'testing' 'amd64'
174 download_deb_image 'Debian' 'unstable' 'amd64'
175 download_rh_image 'CentOS' '7' 'x86_64'
177 === Upload base images ===
181 source ${CIADM_DIR}/vagrant/lib/respin-functions.sh
183 create_deb_image 'Ubuntu' '14.04' 'amd64'
184 create_deb_image 'Ubuntu' '16.04' 'amd64'
185 create_rh_image 'CentOS' '7' 'x86_64'
188 == Re-spin jcloud images ==
195 respin_deb_image 'Ubuntu' '14.04' 'amd64'
196 respin_deb_image 'Ubuntu' '16.04' 'amd64'
197 respin_rh_image 'CentOS' '7' 'x86_64'
199 === Manual bootstrap of Ubuntu 14.04 ===
202 source ${CIADM_DIR}/vagrant/lib/respin-functions.sh
203 SRC_TIMESTAMP=$(latest_src_timestamp)
207 IMAGE="${DIST} ${VERSION} (${SRC_TIMESTAMP}) - LF upload"
210 cd ${CIADM_DIR}/vagrant/basebuild
213 On manual bootstrap failure, one can connect to the VM using
217 nova image-create --poll ${SERVER_NAME} "qq{$dist $version - basebuild - $isodate};"