Victor Morales | 4ab71c1 | 2017-11-08 07:28:28 -0800 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | source /var/onap/functions |
| 4 | |
| 5 | # deploy_openstack() - Function that provisions an OpenStack deployment |
| 6 | function deploy_openstack { |
| 7 | local network_id=${1:-"192.168.53.0"} |
| 8 | nic=$(ip route get $network_id | awk '{ print $4; exit }') |
| 9 | ip_address=$(ip route get $network_id | awk '{ print $6; exit }') |
| 10 | internal_vip_address=$(get_next_ip $ip_address) |
| 11 | |
| 12 | install_docker |
| 13 | mkdir -p /etc/systemd/system/docker.service.d |
| 14 | tee /etc/systemd/system/docker.service.d/kolla.conf <<-'EOF' |
| 15 | [Service] |
| 16 | MountFlags=shared |
| 17 | EOF |
| 18 | install_packages python-dev libffi-dev gcc libssl-dev python-selinux gcc |
| 19 | |
| 20 | install_python_package ansible docker kolla-ansible python-openstackclient |
| 21 | source /etc/os-release || source /usr/lib/os-release |
| 22 | case ${ID,,} in |
| 23 | *suse) |
| 24 | ;; |
| 25 | ubuntu|debian) |
| 26 | service docker restart |
| 27 | |
| 28 | cp -r /usr/local/share/kolla-ansible/etc_examples/kolla /etc/kolla/ |
| 29 | cp /usr/local/share/kolla-ansible/ansible/inventory/* . |
| 30 | sed -i "s/#kolla_base_distro: \"centos\"/kolla_base_distro: \"ubuntu\"/g" /etc/kolla/globals.yml |
| 31 | ;; |
| 32 | rhel|centos|fedora) |
| 33 | systemctl daemon-reload |
| 34 | systemctl restart docker |
| 35 | |
| 36 | cp -r /usr/share/kolla-ansible/etc_examples/kolla /etc/kolla/ |
| 37 | cp /usr/share/kolla-ansible/ansible/inventory/* . |
| 38 | sed -i "s/#kolla_base_distro: \"centos\"/kolla_base_distro: \"centos\"/g" /etc/kolla/globals.yml |
| 39 | ;; |
| 40 | esac |
| 41 | kolla-genpwd |
| 42 | sed -i "s/#openstack_release: \"\"/openstack_release: \"master\"/g" /etc/kolla/globals.yml |
| 43 | |
| 44 | sed -i "s/#network_interface: \"eth0\"/network_interface: \"$nic\"/g" /etc/kolla/globals.yml |
| 45 | sed -i "s/kolla_internal_vip_address: \"10.10.10.254\"/kolla_internal_vip_address: \"$internal_vip_address\"/g" /etc/kolla/globals.yml |
| 46 | sed -i "s/#api_interface: \"{{ network_interface }}\"/api_interface: \"{{ network_interface }}\"/g" /etc/kolla/globals.yml |
| 47 | echo "$ip_address $(hostname)" >> /etc/hosts |
| 48 | |
| 49 | kolla-ansible pull -i all-in-one |
| 50 | kolla-ansible deploy -i all-in-one |
| 51 | kolla-ansible post-deploy |
| 52 | echo "source /etc/kolla/admin-openrc.sh" >> ${HOME}/.bashrc |
| 53 | } |