aboutsummaryrefslogtreecommitdiffstats
path: root/bootstrap/vagrant-onap/lib/openstack
diff options
context:
space:
mode:
authorVictor Morales <victor.morales@intel.com>2017-11-08 07:28:28 -0800
committerVictor Morales <victor.morales@intel.com>2017-11-08 07:36:16 -0800
commit4ab71c18e0c7ab0ce299a8708488ab84a97aea82 (patch)
tree45e83c3d83e9d5dc46c27c5c2aa9e8c9a1e18a23 /bootstrap/vagrant-onap/lib/openstack
parent6dbd7da003f938e2dbd73944624e8679027c35ca (diff)
Add OpenStack support
This change allows the provisioning of an All-in-One OpenStack deployment through ansible-kolla project. Given that it uses System D this adds an exception to use Ubuntu Xenial release. Change-Id: I57973a1b5cc331654fbabf7932ddcfef817afedf Signed-off-by: Victor Morales <victor.morales@intel.com> Issue-Id: INT-329
Diffstat (limited to 'bootstrap/vagrant-onap/lib/openstack')
-rwxr-xr-xbootstrap/vagrant-onap/lib/openstack53
1 files changed, 53 insertions, 0 deletions
diff --git a/bootstrap/vagrant-onap/lib/openstack b/bootstrap/vagrant-onap/lib/openstack
new file mode 100755
index 000000000..6fe20d94c
--- /dev/null
+++ b/bootstrap/vagrant-onap/lib/openstack
@@ -0,0 +1,53 @@
+#!/bin/bash
+
+source /var/onap/functions
+
+# deploy_openstack() - Function that provisions an OpenStack deployment
+function deploy_openstack {
+ local network_id=${1:-"192.168.53.0"}
+ nic=$(ip route get $network_id | awk '{ print $4; exit }')
+ ip_address=$(ip route get $network_id | awk '{ print $6; exit }')
+ internal_vip_address=$(get_next_ip $ip_address)
+
+ install_docker
+ mkdir -p /etc/systemd/system/docker.service.d
+ tee /etc/systemd/system/docker.service.d/kolla.conf <<-'EOF'
+[Service]
+MountFlags=shared
+EOF
+ install_packages python-dev libffi-dev gcc libssl-dev python-selinux gcc
+
+ install_python_package ansible docker kolla-ansible python-openstackclient
+ source /etc/os-release || source /usr/lib/os-release
+ case ${ID,,} in
+ *suse)
+ ;;
+ ubuntu|debian)
+ service docker restart
+
+ cp -r /usr/local/share/kolla-ansible/etc_examples/kolla /etc/kolla/
+ cp /usr/local/share/kolla-ansible/ansible/inventory/* .
+ sed -i "s/#kolla_base_distro: \"centos\"/kolla_base_distro: \"ubuntu\"/g" /etc/kolla/globals.yml
+ ;;
+ rhel|centos|fedora)
+ systemctl daemon-reload
+ systemctl restart docker
+
+ cp -r /usr/share/kolla-ansible/etc_examples/kolla /etc/kolla/
+ cp /usr/share/kolla-ansible/ansible/inventory/* .
+ sed -i "s/#kolla_base_distro: \"centos\"/kolla_base_distro: \"centos\"/g" /etc/kolla/globals.yml
+ ;;
+ esac
+ kolla-genpwd
+ sed -i "s/#openstack_release: \"\"/openstack_release: \"master\"/g" /etc/kolla/globals.yml
+
+ sed -i "s/#network_interface: \"eth0\"/network_interface: \"$nic\"/g" /etc/kolla/globals.yml
+ sed -i "s/kolla_internal_vip_address: \"10.10.10.254\"/kolla_internal_vip_address: \"$internal_vip_address\"/g" /etc/kolla/globals.yml
+ sed -i "s/#api_interface: \"{{ network_interface }}\"/api_interface: \"{{ network_interface }}\"/g" /etc/kolla/globals.yml
+ echo "$ip_address $(hostname)" >> /etc/hosts
+
+ kolla-ansible pull -i all-in-one
+ kolla-ansible deploy -i all-in-one
+ kolla-ansible post-deploy
+ echo "source /etc/kolla/admin-openrc.sh" >> ${HOME}/.bashrc
+}