From: David Garcia Date: Mon, 15 Feb 2021 12:38:42 +0000 (+0100) Subject: Fix --microstack flag in charmed installer X-Git-Tag: v9.1.0~3 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=ff046ce519edbfc93fa8e9e48ef3726e6b94d20d;p=osm%2Fdevops.git Fix --microstack flag in charmed installer This commit does several things: - Geneneral fix for installing the most stable release of microstack - Configure and set up microstack so it is ready to use: create an osm-ext network, a router, configure the security groups etc; so it is ready to be used by OSM - Add xenial, bionic, and focal images to microstack - Add microstack as VIM to OSM Change-Id: Id15531ee94c893e2670b7ee8a89b2eb4e55cead0 Signed-off-by: David Garcia --- diff --git a/installers/charmed_install.sh b/installers/charmed_install.sh index 77afdb4e..98e722a3 100755 --- a/installers/charmed_install.sh +++ b/installers/charmed_install.sh @@ -443,32 +443,52 @@ function add_local_k8scluster() { } function install_microstack() { - sudo snap install microstack --classic --beta - sudo microstack.init --auto - wget https://cloud-images.ubuntu.com/releases/16.04/release/ubuntu-16.04-server-cloudimg-amd64-disk1.img -P ~/.osm/ - microstack.openstack image create \ - --public \ - --disk-format qcow2 \ - --container-format bare \ - --file ~/.osm/ubuntu-16.04-server-cloudimg-amd64-disk1.img \ - ubuntu1604 - ssh-keygen -t rsa -N "" -f ~/.ssh/microstack - microstack.openstack keypair create --public-key ~/.ssh/microstack.pub microstack - export OSM_HOSTNAME=`juju status --format json | jq -rc '.applications."nbi".address'` - osm vim-create --name microstack-site \ - --user admin \ - --password keystone \ - --auth_url http://10.20.20.1:5000/v3 \ - --tenant admin \ - --account_type openstack \ - --config='{security_groups: default, - keypair: microstack, - project_name: admin, - user_domain_name: default, - region_name: microstack, - insecure: True, - availability_zone: nova, - version: 3}' + # Install and init microstack + sudo snap install microstack --channel beta --devmode + sudo snap set microstack config.network.ports.dashboard=8080 + sudo microstack.init --auto --control + + # Basic configuration + microstack.openstack network create --enable --no-share osm-ext + microstack.openstack subnet create osm-ext-subnet --network osm-ext --dns-nameserver 8.8.8.8 --subnet-range 172.16.0.0/24 + microstack.openstack router create external-router + microstack.openstack router add subnet external-router osm-ext-subnet + microstack.openstack router set --external-gateway external external-router + for i in $(microstack.openstack security group list | awk '/default/{ print $2 }'); do + microstack.openstack security group rule create $i --protocol icmp --remote-ip 0.0.0.0/0 + microstack.openstack security group rule create $i --protocol tcp --remote-ip 0.0.0.0/0 + done + KEYPAIR_PATH=~/.ssh/microstack + if ! test -f $KEYPAIR_PATH; then + echo "Generating ssh keypair for microstack" + ssh-keygen -t rsa -N "" -f $KEYPAIR_PATH + fi + microstack.openstack keypair create --public-key $KEYPAIR_PATH.pub microstack + + # Add xenial, bionic, and focal images to microstack + echo "curl https://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-amd64-disk1.img | microstack.openstack image create --public --container-format=bare --disk-format=qcow2 ubuntu16.04" + echo "curl https://cloud-images.ubuntu.com/bionic/current/bionic-server-cloudimg-amd64.img | microstack.openstack image create --public --container-format=bare --disk-format=qcow2 ubuntu18.04" + echo "curl https://cloud-images.ubuntu.com/focal/current/focal-server-cloudimg-amd64.img | microstack.openstack image create --public --container-format=bare --disk-format=qcow2 ubuntu20.04" + + # Load ENV variables + . /var/snap/microstack/common/etc/microstack.rc + osm vim-create --name microstack \ + --user "$OS_USERNAME" \ + --password "$OS_PASSWORD" \ + --auth_url "$OS_AUTH_URL/v3" \ + --tenant "$OS_USERNAME" \ + --account_type openstack \ + --config='{ + use_floating_ip: True, + management_network_name: osm-ext, + keypair: microstack, + project_name: admin, + user_domain_name: default, + region_name: microstack, + insecure: True, + availability_zone: nova, + version: 3 + }' } DEFAULT_IF=`ip route list match 0.0.0.0 | awk '{print $5}'`