}
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}'`