bootstrap-rocky-9/install-aio-openstack.sh

97 lines
2.6 KiB
Bash
Raw Normal View History

2024-08-30 23:57:25 +03:00
#!/usr/bin/env bash
set -x
set -e
IP="$1"
INTERNAL_INTERFACE="$2"
EXTERNAL_INTERFACE="$3"
if [ -z "${IP}" ];then
echo "Missing internal IP address"
exit 1
fi
if [ -z "${INTERNAL_INTERFACE}" ];then
echo "Missing internal network interface"
exit 2
fi
if [ -z "${EXTERNAL_INTERFACE}" ];then
echo "Missing externl network interface"
exit 3
fi
dnf group install -y "Development Tools"
dnf install -y git python3-devel libffi-devel gcc openssl-devel python3-libselinux
dnf install -y python-devel python cmake dbus-devel python-pip pkgconfig glib2-devel dbus-tools dbus-daemon
2024-08-30 23:57:25 +03:00
#update-alternatives --set python3 /usr/bin/python
2024-08-30 23:57:25 +03:00
#apt install -y build-essential python3-dev python3
#apt install -y libdbus-1-dev cmake libspice-client-glib-2.0-dev
#apt install -y python3-venv
python -m venv /opt/deploy
2024-08-30 23:57:25 +03:00
source /opt/deploy/bin/activate
python -m pip install -U pip
2024-08-30 23:57:25 +03:00
#pip install 'ansible>=4,<6'
pip install 'ansible-core>=2.16,<2.17.99'
#python -m pip install 'ansible-core>=2.16,<=2.17'
2024-08-30 23:57:25 +03:00
#pip install 'ansible>=7,<8'
python -m pip install ansible
2024-08-30 23:57:25 +03:00
#pip install ansible-core
#pip install ansible
python -m pip install dbus-python
2024-08-30 23:57:25 +03:00
python -m pip install docker
2024-08-30 23:57:25 +03:00
python -m pip install selinux
python -m pip install git+https://opendev.org/openstack/kolla-ansible@master
2024-08-30 23:57:25 +03:00
mkdir -p /etc/kolla
chown $USER:$USER /etc/kolla
cp -r /opt/deploy/share/kolla-ansible/etc_examples/kolla/* /etc/kolla
cp /opt/deploy/share/kolla-ansible/ansible/inventory/all-in-one /opt/
source /opt/deploy/bin/activate
PYTHON=$(which python)
echo "${PYTHON}"
sed -i -e "s@ansible_connection=local.*@ansible_connection=local ansible_python_interpreter=/opt/deploy/bin/python@g" /opt/all-in-one
kolla-ansible install-deps
kolla-genpwd
sed -i -e 's@^\#kolla_base_distro: ".*@kolla_base_distro: "ubuntu"@g' \
-e "s@^#network_interface.*@network_interface: \"${INTERNAL_INTERFACE}\"@g" \
-e "s@^#neutron_external_interface.*@neutron_external_interface: \"${EXTERNAL_INTERFACE}\"@g" \
-e 's@^#neutron_plugin_agent: .*@neutron_plugin_agent: "openvswitch"@g' \
-e 's@^#enable_neutron_provider_networks.*@enable_neutron_provider_networks: "yes"@g' \
-e 's@^#nova_compute_virt_type.*@nova_compute_virt_type: "kvm"@g' \
-e 's@^#enable_haproxy:.*@enable_haproxy: "no"@g' \
-e "s@^#kolla_internal_vip_address:.*@kolla_internal_vip_address: \"${IP}\"@g" \
/etc/kolla/globals.yml
cd /opt && \
kolla-ansible -i all-in-one bootstrap-servers && \
kolla-ansible -i all-in-one prechecks && \
2024-08-30 23:57:25 +03:00
kolla-ansible -i all-in-one deploy &&
kolla-ansible -i all-in-one post-deploy
pip install python-openstackclient
grep keystone_admin_password /etc/kolla/passwords.yml
set +x