Unify vagrant bootstrap.sh scripts
Merge the vagrant bootstrap scripts for centos and ubuntu into a single file. Change-Id: Ia07931b4717cd393fe51141907fc561166cc05e4 Closes-Bug: 1554140
This commit is contained in:
parent
ba6ea72a37
commit
5960900f9a
12
dev/vagrant/Vagrantfile
vendored
12
dev/vagrant/Vagrantfile
vendored
@ -23,6 +23,11 @@ DISTRO ||= "centos"
|
|||||||
# is libvirt.
|
# is libvirt.
|
||||||
GRAPHICSIP ||= "127.0.0.1"
|
GRAPHICSIP ||= "127.0.0.1"
|
||||||
|
|
||||||
|
# The bootstrap.sh provision_script requires CentOS 7 or Ubuntu 15.10.
|
||||||
|
# Provisioning other boxes than the default ones may therefore
|
||||||
|
# require changes to bootstrap.sh.
|
||||||
|
PROVISION_SCRIPT ||= "bootstrap.sh"
|
||||||
|
|
||||||
PROVIDER_DEFAULTS ||= {
|
PROVIDER_DEFAULTS ||= {
|
||||||
libvirt: {
|
libvirt: {
|
||||||
centos: {
|
centos: {
|
||||||
@ -30,7 +35,6 @@ PROVIDER_DEFAULTS ||= {
|
|||||||
bridge_interface: "virbr0",
|
bridge_interface: "virbr0",
|
||||||
vagrant_shared_folder: "/home/vagrant/sync",
|
vagrant_shared_folder: "/home/vagrant/sync",
|
||||||
sync_method: "nfs",
|
sync_method: "nfs",
|
||||||
provision_script: "centos-bootstrap.sh",
|
|
||||||
kolla_path: "/home/vagrant/kolla"
|
kolla_path: "/home/vagrant/kolla"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -40,7 +44,6 @@ PROVIDER_DEFAULTS ||= {
|
|||||||
bridge_interface: "wlp3s0b1",
|
bridge_interface: "wlp3s0b1",
|
||||||
vagrant_shared_folder: "/home/vagrant/sync",
|
vagrant_shared_folder: "/home/vagrant/sync",
|
||||||
sync_method: "virtualbox",
|
sync_method: "virtualbox",
|
||||||
provision_script: "centos-bootstrap.sh",
|
|
||||||
kolla_path: "/home/vagrant/kolla"
|
kolla_path: "/home/vagrant/kolla"
|
||||||
},
|
},
|
||||||
ubuntu: {
|
ubuntu: {
|
||||||
@ -48,7 +51,6 @@ PROVIDER_DEFAULTS ||= {
|
|||||||
bridge_interface: "wlp3s0b1",
|
bridge_interface: "wlp3s0b1",
|
||||||
vagrant_shared_folder: "/home/vagrant/sync",
|
vagrant_shared_folder: "/home/vagrant/sync",
|
||||||
sync_method: "virtualbox",
|
sync_method: "virtualbox",
|
||||||
provision_script: "ubuntu-bootstrap.sh",
|
|
||||||
kolla_path: "/home/vagrant/kolla"
|
kolla_path: "/home/vagrant/kolla"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -158,7 +160,7 @@ Vagrant.configure(2) do |config|
|
|||||||
# The operator controls the deployment
|
# The operator controls the deployment
|
||||||
config.vm.define "operator" do |admin|
|
config.vm.define "operator" do |admin|
|
||||||
admin.vm.hostname = "operator.local"
|
admin.vm.hostname = "operator.local"
|
||||||
admin.vm.provision :shell, path: get_default(:provision_script), args: "operator #{MULTINODE ? 'multinode' : 'aio'} #{get_default(:kolla_path)}"
|
admin.vm.provision :shell, path: PROVISION_SCRIPT, args: "operator #{MULTINODE ? 'multinode' : 'aio'} #{get_default(:kolla_path)}"
|
||||||
admin.vm.synced_folder File.join(vagrant_dir, '..', '..'), get_default(:kolla_path), create:"True", type: get_default(:sync_method)
|
admin.vm.synced_folder File.join(vagrant_dir, '..', '..'), get_default(:kolla_path), create:"True", type: get_default(:sync_method)
|
||||||
admin.vm.synced_folder File.join(vagrant_dir, 'storage', 'operator'), "/data/host", create:"True", type: get_default(:sync_method)
|
admin.vm.synced_folder File.join(vagrant_dir, 'storage', 'operator'), "/data/host", create:"True", type: get_default(:sync_method)
|
||||||
admin.vm.synced_folder File.join(vagrant_dir, 'storage', 'shared'), "/data/shared", create:"True", type: get_default(:sync_method)
|
admin.vm.synced_folder File.join(vagrant_dir, 'storage', 'shared'), "/data/shared", create:"True", type: get_default(:sync_method)
|
||||||
@ -179,7 +181,7 @@ Vagrant.configure(2) do |config|
|
|||||||
hostname = "#{node_type}0#{i}"
|
hostname = "#{node_type}0#{i}"
|
||||||
config.vm.define hostname do |node|
|
config.vm.define hostname do |node|
|
||||||
node.vm.hostname = "#{hostname}.local"
|
node.vm.hostname = "#{hostname}.local"
|
||||||
node.vm.provision :shell, path: get_default(:provision_script), args: "#{hostname} multinode #{get_default(:kolla_path)}"
|
node.vm.provision :shell, path: PROVISION_SCRIPT, args: "#{hostname} multinode #{get_default(:kolla_path)}"
|
||||||
node.vm.synced_folder File.join(vagrant_dir, 'storage', node_type), "/data/host", create:"True", type: get_default(:sync_method)
|
node.vm.synced_folder File.join(vagrant_dir, 'storage', node_type), "/data/host", create:"True", type: get_default(:sync_method)
|
||||||
node.vm.synced_folder File.join(vagrant_dir, 'storage', 'shared'), "/data/shared", create:"True", type: get_default(:sync_method)
|
node.vm.synced_folder File.join(vagrant_dir, 'storage', 'shared'), "/data/shared", create:"True", type: get_default(:sync_method)
|
||||||
node.vm.synced_folder ".", get_default(:vagrant_shared_folder), disabled: true
|
node.vm.synced_folder ".", get_default(:vagrant_shared_folder), disabled: true
|
||||||
|
@ -16,6 +16,11 @@
|
|||||||
# is libvirt.
|
# is libvirt.
|
||||||
# GRAPHICSIP = "127.0.0.1"
|
# GRAPHICSIP = "127.0.0.1"
|
||||||
|
|
||||||
|
# The bootstrap.sh provision_script requires CentOS 7 or Ubuntu 15.10.
|
||||||
|
# Provisioning other boxes than the default ones may therefore
|
||||||
|
# require changes to bootstrap.sh.
|
||||||
|
# PROVISION_SCRIPT = "bootstrap.sh"
|
||||||
|
|
||||||
# PROVIDER_DEFAULTS = {
|
# PROVIDER_DEFAULTS = {
|
||||||
# libvirt: {
|
# libvirt: {
|
||||||
# centos: {
|
# centos: {
|
||||||
@ -23,7 +28,6 @@
|
|||||||
# bridge_interface: "virbr0",
|
# bridge_interface: "virbr0",
|
||||||
# vagrant_shared_folder: "/home/vagrant/sync",
|
# vagrant_shared_folder: "/home/vagrant/sync",
|
||||||
# sync_method: "nfs",
|
# sync_method: "nfs",
|
||||||
# provision_script: "centos-bootstrap.sh",
|
|
||||||
# kolla_path: "/home/vagrant/kolla"
|
# kolla_path: "/home/vagrant/kolla"
|
||||||
# }
|
# }
|
||||||
# },
|
# },
|
||||||
@ -33,7 +37,6 @@
|
|||||||
# bridge_interface: "wlp3s0b1",
|
# bridge_interface: "wlp3s0b1",
|
||||||
# vagrant_shared_folder: "/home/vagrant/sync",
|
# vagrant_shared_folder: "/home/vagrant/sync",
|
||||||
# sync_method: "virtualbox",
|
# sync_method: "virtualbox",
|
||||||
# provision_script: "centos-bootstrap.sh",
|
|
||||||
# kolla_path: "/home/vagrant/kolla"
|
# kolla_path: "/home/vagrant/kolla"
|
||||||
# },
|
# },
|
||||||
# ubuntu: {
|
# ubuntu: {
|
||||||
@ -41,7 +44,6 @@
|
|||||||
# bridge_interface: "wlp3s0b1",
|
# bridge_interface: "wlp3s0b1",
|
||||||
# vagrant_shared_folder: "/home/vagrant/sync",
|
# vagrant_shared_folder: "/home/vagrant/sync",
|
||||||
# sync_method: "virtualbox",
|
# sync_method: "virtualbox",
|
||||||
# provision_script: "ubuntu-bootstrap.sh",
|
|
||||||
# kolla_path: "/home/vagrant/kolla"
|
# kolla_path: "/home/vagrant/kolla"
|
||||||
# }
|
# }
|
||||||
# }
|
# }
|
||||||
|
@ -2,6 +2,9 @@
|
|||||||
#
|
#
|
||||||
# Bootstrap script to configure all nodes.
|
# Bootstrap script to configure all nodes.
|
||||||
#
|
#
|
||||||
|
# This script is intended to be used by vagrant to provision nodes.
|
||||||
|
# To use it, set it as 'PROVISION_SCRIPT' inside your Vagrantfile.custom.
|
||||||
|
# You can use Vagrantfile.custom.example as a template for this.
|
||||||
|
|
||||||
VM=$1
|
VM=$1
|
||||||
MODE=$2
|
MODE=$2
|
||||||
@ -21,29 +24,77 @@ fi
|
|||||||
REGISTRY=operator.local:${REGISTRY_PORT}
|
REGISTRY=operator.local:${REGISTRY_PORT}
|
||||||
ADMIN_PROTOCOL="http"
|
ADMIN_PROTOCOL="http"
|
||||||
|
|
||||||
|
function _ensure_lsb_release {
|
||||||
|
if [[ -x $(which lsb_release 2>/dev/null) ]]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -x $(which apt-get 2>/dev/null) ]]; then
|
||||||
|
sudo apt-get install -y lsb-release
|
||||||
|
elif [[ -x $(which yum 2>/dev/null) ]]; then
|
||||||
|
sudo yum install -y redhat-lsb-core
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function _is_distro {
|
||||||
|
if [[ -z "$DISTRO" ]]; then
|
||||||
|
_ensure_lsb_release
|
||||||
|
DISTRO=$(lsb_release -si)
|
||||||
|
fi
|
||||||
|
|
||||||
|
[[ "$DISTRO" == "$1" ]]
|
||||||
|
}
|
||||||
|
|
||||||
|
function is_ubuntu {
|
||||||
|
_is_distro "Ubuntu"
|
||||||
|
}
|
||||||
|
|
||||||
|
function is_centos {
|
||||||
|
_is_distro "CentOS"
|
||||||
|
}
|
||||||
|
|
||||||
# Install common packages and do some prepwork.
|
# Install common packages and do some prepwork.
|
||||||
function prep_work {
|
function prep_work {
|
||||||
|
if [[ "$(systemctl is-enabled firewalld)" = "enabled" ]]; then
|
||||||
systemctl stop firewalld
|
systemctl stop firewalld
|
||||||
systemctl disable firewalld
|
systemctl disable firewalld
|
||||||
|
fi
|
||||||
|
|
||||||
# This removes the fqdn from /etc/hosts's 127.0.0.1. This name.local will
|
# This removes the fqdn from /etc/hosts's 127.0.0.1. This name.local will
|
||||||
# resolve to the public IP instead of localhost.
|
# resolve to the public IP instead of localhost.
|
||||||
sed -i -r "s/^(127\.0\.0\.1\s+)(.*) `hostname` (.+)/\1 \3/" /etc/hosts
|
sed -i -r "s/^(127\.0\.0\.1\s+)(.*) `hostname` (.+)/\1 \3/" /etc/hosts
|
||||||
|
|
||||||
|
if is_centos; then
|
||||||
yum install -y epel-release
|
yum install -y epel-release
|
||||||
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
|
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
|
||||||
yum install -y MySQL-python vim-enhanced python-pip python-devel gcc openssl-devel libffi-devel libxml2-devel libxslt-devel
|
yum install -y MySQL-python vim-enhanced python-pip python-devel gcc openssl-devel libffi-devel libxml2-devel libxslt-devel
|
||||||
yum clean all
|
elif is_ubuntu; then
|
||||||
|
apt-get update
|
||||||
|
apt-get install -y python-mysqldb python-dev build-essential libssl-dev libffi-dev libxml2-dev libxslt-dev
|
||||||
|
easy_install pip
|
||||||
|
else
|
||||||
|
echo "Unsupported Distro: $DISTRO" 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
pip install --upgrade docker-py
|
pip install --upgrade docker-py
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Do some cleanup after the installation of kolla
|
||||||
|
function cleanup {
|
||||||
|
if is_centos; then
|
||||||
|
yum clean all
|
||||||
|
elif is_ubuntu; then
|
||||||
|
apt-get clean
|
||||||
|
else
|
||||||
|
echo "Unsupported Distro: $DISTRO" 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Install and configure a quick&dirty docker daemon.
|
# Install and configure a quick&dirty docker daemon.
|
||||||
function install_docker {
|
function install_docker {
|
||||||
# Allow for an externally supplied docker binary.
|
if is_centos; then
|
||||||
if [[ -f "/data/docker" ]]; then
|
|
||||||
cp /vagrant/docker /usr/bin/docker
|
|
||||||
chmod +x /usr/bin/docker
|
|
||||||
else
|
|
||||||
cat >/etc/yum.repos.d/docker.repo <<-EOF
|
cat >/etc/yum.repos.d/docker.repo <<-EOF
|
||||||
[dockerrepo]
|
[dockerrepo]
|
||||||
name=Docker Repository
|
name=Docker Repository
|
||||||
@ -62,12 +113,21 @@ EOF
|
|||||||
sed -i -r "s|(ExecStart)=(.+)|\1=/usr/bin/docker daemon --insecure-registry ${REGISTRY} --registry-mirror=http://${REGISTRY}|" /usr/lib/systemd/system/docker.service
|
sed -i -r "s|(ExecStart)=(.+)|\1=/usr/bin/docker daemon --insecure-registry ${REGISTRY} --registry-mirror=http://${REGISTRY}|" /usr/lib/systemd/system/docker.service
|
||||||
sed -i 's|^MountFlags=.*|MountFlags=shared|' /usr/lib/systemd/system/docker.service
|
sed -i 's|^MountFlags=.*|MountFlags=shared|' /usr/lib/systemd/system/docker.service
|
||||||
|
|
||||||
|
usermod -aG docker vagrant
|
||||||
|
elif is_ubuntu; then
|
||||||
|
apt-key adv --keyserver hkp://pgp.mit.edu:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
|
||||||
|
echo "deb https://apt.dockerproject.org/repo ubuntu-wily main" > /etc/apt/sources.list.d/docker.list
|
||||||
|
apt-get update
|
||||||
|
apt-get install -y docker-engine
|
||||||
|
sed -i -r "s,(ExecStart)=(.+),\1=/usr/bin/docker daemon --insecure-registry ${REGISTRY} --registry-mirror=http://${REGISTRY}|" /lib/systemd/system/docker.service
|
||||||
|
else
|
||||||
|
echo "Unsupported Distro: $DISTRO" 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
systemctl enable docker
|
systemctl enable docker
|
||||||
systemctl start docker
|
systemctl start docker
|
||||||
fi
|
|
||||||
|
|
||||||
usermod -aG docker vagrant
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function configure_kolla {
|
function configure_kolla {
|
||||||
@ -84,24 +144,27 @@ function configure_kolla {
|
|||||||
|
|
||||||
# Configure the operator node and install some additional packages.
|
# Configure the operator node and install some additional packages.
|
||||||
function configure_operator {
|
function configure_operator {
|
||||||
yum install -y git mariadb && yum clean all
|
if is_centos; then
|
||||||
pip install --upgrade "ansible<2" python-openstackclient python-neutronclient tox
|
yum install -y git mariadb
|
||||||
|
elif is_ubuntu; then
|
||||||
pip install ~vagrant/kolla
|
apt-get install -y git mariadb-client selinux-utils
|
||||||
|
else
|
||||||
# Note: this trickery requires a patched docker binary.
|
echo "Unsupported Distro: $DISTRO" 1>&2
|
||||||
if [[ "$http_proxy" = "" ]]; then
|
exit 1
|
||||||
su - vagrant sh -c "echo BUILDFLAGS=\\\"--build-env=http_proxy=$http_proxy --build-env=https_proxy=$https_proxy\\\" > ~/kolla/.buildconf"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
pip install --upgrade "ansible<2" python-openstackclient python-neutronclient tox
|
||||||
|
|
||||||
|
pip install ${KOLLA_PATH}
|
||||||
|
|
||||||
# Set selinux to permissive
|
# Set selinux to permissive
|
||||||
|
if [[ "$(getenforce)" == "Enforcing" ]]; then
|
||||||
sed -i -r "s,^SELINUX=.+$,SELINUX=permissive," /etc/selinux/config
|
sed -i -r "s,^SELINUX=.+$,SELINUX=permissive," /etc/selinux/config
|
||||||
setenforce permissive
|
setenforce permissive
|
||||||
|
fi
|
||||||
|
|
||||||
cp -r ~vagrant/kolla/etc/kolla/ /etc/kolla
|
tox -e genconfig
|
||||||
oslo-config-generator --config-file \
|
cp -r ${KOLLA_PATH}/etc/kolla/ /etc/kolla
|
||||||
~vagrant/kolla/etc/oslo-config-generator/kolla-build.conf \
|
|
||||||
--output-file /etc/kolla/kolla-build.conf
|
|
||||||
mkdir -p /usr/share/kolla
|
mkdir -p /usr/share/kolla
|
||||||
chown -R vagrant: /etc/kolla /usr/share/kolla
|
chown -R vagrant: /etc/kolla /usr/share/kolla
|
||||||
|
|
||||||
@ -123,7 +186,6 @@ EOF
|
|||||||
virt_type=qemu
|
virt_type=qemu
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
|
||||||
# Launch a local registry (and mirror) to speed up pulling images.
|
# Launch a local registry (and mirror) to speed up pulling images.
|
||||||
if [[ ! $(docker ps -a -q -f name=registry) ]]; then
|
if [[ ! $(docker ps -a -q -f name=registry) ]]; then
|
||||||
docker run -d \
|
docker run -d \
|
||||||
@ -145,3 +207,5 @@ install_docker
|
|||||||
if [[ "$VM" = "operator" ]]; then
|
if [[ "$VM" = "operator" ]]; then
|
||||||
configure_operator
|
configure_operator
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
cleanup
|
@ -1,134 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
# Bootstrap script to configure all nodes.
|
|
||||||
#
|
|
||||||
|
|
||||||
VM=$1
|
|
||||||
MODE=$2
|
|
||||||
KOLLA_PATH=$3
|
|
||||||
|
|
||||||
export http_proxy=
|
|
||||||
export https_proxy=
|
|
||||||
|
|
||||||
if [ "$MODE" = 'aio' ]; then
|
|
||||||
# Run registry on port 4000 since it may collide with keystone when doing AIO
|
|
||||||
REGISTRY_PORT=4000
|
|
||||||
SUPPORT_NODE=operator
|
|
||||||
else
|
|
||||||
REGISTRY_PORT=5000
|
|
||||||
SUPPORT_NODE=support01
|
|
||||||
fi
|
|
||||||
REGISTRY=operator.local:${REGISTRY_PORT}
|
|
||||||
ADMIN_PROTOCOL="http"
|
|
||||||
|
|
||||||
# Install common packages and do some prepwork.
|
|
||||||
function prep_work {
|
|
||||||
apt-get update
|
|
||||||
apt-get install -y python-mysqldb python-dev build-essential libssl-dev libffi-dev libxml2-dev libxslt-dev
|
|
||||||
apt-get clean
|
|
||||||
easy_install pip
|
|
||||||
pip install --upgrade docker-py
|
|
||||||
}
|
|
||||||
|
|
||||||
# Install and configure a quick&dirty docker daemon.
|
|
||||||
function install_docker {
|
|
||||||
# Allow for an externally supplied docker binary.
|
|
||||||
if [[ -f "/data/docker" ]]; then
|
|
||||||
cp /vagrant/docker /usr/bin/docker
|
|
||||||
chmod +x /usr/bin/docker
|
|
||||||
else
|
|
||||||
apt-key adv --keyserver hkp://pgp.mit.edu:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
|
|
||||||
echo "deb https://apt.dockerproject.org/repo ubuntu-wily main" > /etc/apt/sources.list.d/docker.list
|
|
||||||
apt-get update
|
|
||||||
apt-get install -y docker-engine
|
|
||||||
sed -i -r "s,(ExecStart)=(.+),\1=/usr/bin/docker daemon --insecure-registry ${REGISTRY} --registry-mirror=http://${REGISTRY}|" /lib/systemd/system/docker.service
|
|
||||||
systemctl daemon-reload
|
|
||||||
systemctl enable docker
|
|
||||||
systemctl restart docker
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
function configure_kolla {
|
|
||||||
# Use local docker registry
|
|
||||||
sed -i -r "s,^[# ]*namespace *=.+$,namespace = ${REGISTRY}/lokolla," /etc/kolla/kolla-build.conf
|
|
||||||
sed -i -r "s,^[# ]*push *=.+$,push = True," /etc/kolla/kolla-build.conf
|
|
||||||
sed -i -r "s,^[# ]*docker_registry:.+$,docker_registry: \"${REGISTRY}\"," /etc/kolla/globals.yml
|
|
||||||
sed -i -r "s,^[# ]*docker_namespace:.+$,docker_namespace: \"lokolla\"," /etc/kolla/globals.yml
|
|
||||||
sed -i -r "s,^[# ]*docker_insecure_registry:.+$,docker_insecure_registry: \"True\"," /etc/kolla/globals.yml
|
|
||||||
# Set network interfaces
|
|
||||||
sed -i -r "s,^[# ]*network_interface:.+$,network_interface: \"eth1\"," /etc/kolla/globals.yml
|
|
||||||
sed -i -r "s,^[# ]*neutron_external_interface:.+$,neutron_external_interface: \"eth2\"," /etc/kolla/globals.yml
|
|
||||||
}
|
|
||||||
|
|
||||||
# Configure the operator node and install some additional packages.
|
|
||||||
function configure_operator {
|
|
||||||
apt-get install -y git mariadb-client selinux-utils && apt-get clean
|
|
||||||
pip install --upgrade "ansible<2" python-openstackclient python-neutronclient tox
|
|
||||||
|
|
||||||
pip install ~vagrant/kolla
|
|
||||||
|
|
||||||
# Note: this trickery requires a patched docker binary.
|
|
||||||
if [[ "$http_proxy" = "" ]]; then
|
|
||||||
su - vagrant sh -c "echo BUILDFLAGS=\\\"--build-env=http_proxy=$http_proxy --build-env=https_proxy=$https_proxy\\\" > ~/kolla/.buildconf"
|
|
||||||
fi
|
|
||||||
|
|
||||||
cp -r ~vagrant/kolla/etc/kolla/ /etc/kolla
|
|
||||||
oslo-config-generator --config-file \
|
|
||||||
~vagrant/kolla/etc/oslo-config-generator/kolla-build.conf \
|
|
||||||
--output-file /etc/kolla/kolla-build.conf
|
|
||||||
mkdir -p /usr/share/kolla
|
|
||||||
chown -R vagrant: /etc/kolla /usr/share/kolla
|
|
||||||
|
|
||||||
configure_kolla
|
|
||||||
|
|
||||||
# Make sure Ansible uses scp.
|
|
||||||
cat > ~vagrant/.ansible.cfg <<EOF
|
|
||||||
[defaults]
|
|
||||||
forks=100
|
|
||||||
|
|
||||||
[ssh_connection]
|
|
||||||
scp_if_ssh=True
|
|
||||||
EOF
|
|
||||||
chown vagrant: ~vagrant/.ansible.cfg
|
|
||||||
|
|
||||||
mkdir -p /etc/kolla/config/nova/
|
|
||||||
cat > /etc/kolla/config/nova/nova-compute.conf <<EOF
|
|
||||||
[libvirt]
|
|
||||||
virt_type=qemu
|
|
||||||
EOF
|
|
||||||
|
|
||||||
|
|
||||||
# Launch a local registry (and mirror) to speed up pulling images.
|
|
||||||
if [[ ! $(docker ps -a -q -f name=registry) ]]; then
|
|
||||||
docker run -d \
|
|
||||||
--name registry \
|
|
||||||
--restart=always \
|
|
||||||
-p ${REGISTRY_PORT}:5000 \
|
|
||||||
-e STANDALONE=True \
|
|
||||||
-e MIRROR_SOURCE=https://registry-1.docker.io \
|
|
||||||
-e MIRROR_SOURCE_INDEX=https://index.docker.io \
|
|
||||||
-e STORAGE_PATH=/var/lib/registry \
|
|
||||||
-v /data/host/registry-storage:/var/lib/registry \
|
|
||||||
registry:2
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "Kernel version $(uname -r)"
|
|
||||||
if [[ $(uname -r) != *"4.2"* ]]; then
|
|
||||||
echo "Going to update kernel image"
|
|
||||||
apt-get update
|
|
||||||
apt-get install -y linux-image-generic-lts-wily
|
|
||||||
# VM needs to be rebooted for docker to pickup the changes
|
|
||||||
echo "Rebooting for kernel changes"
|
|
||||||
echo "After reboot re-run vagrant provision to finish provising the box"
|
|
||||||
reboot
|
|
||||||
# Sleep for a bit to let vagrant exit properly
|
|
||||||
sleep 3
|
|
||||||
fi
|
|
||||||
|
|
||||||
prep_work
|
|
||||||
install_docker
|
|
||||||
|
|
||||||
if [[ "$VM" = "operator" ]]; then
|
|
||||||
configure_operator
|
|
||||||
fi
|
|
Loading…
Reference in New Issue
Block a user