Controller
#!/bin/sh
install_nova_controller(){
set -o errexit
set -x
readonly passwd=openstack
readonly my_ip=172.16.199.11
source ./sql_scripts/nova.sql
source ./admin-openrc
openstack user create --domain default --password $passwd nova
openstack role add --project service --user nova admin
openstack service create --name nova --description "OpenStack Compute" compute
openstack endpoint create --region RegionOne \
compute public http://controller:8774/v2.1
openstack endpoint create --region RegionOne \
compute internal http://controller:8774/v2.1
openstack endpoint create --region RegionOne \
compute admin http://controller:8774/v2.1
openstack user create --domain default --password $passwd placement
openstack role add --project service --user placement admin
openstack service create --name placement --description "Placement API" placement
openstack endpoint create --region RegionOne placement public http://controller:8778
openstack endpoint create --region RegionOne placement internal http://controller:8778
openstack endpoint create --region RegionOne placement admin http://controller:8778
(echo 'y')|apt install nova-api nova-conductor nova-consoleauth \
nova-novncproxy nova-scheduler nova-placement-api
sed -i "3471s#^connection = .*#connection = mysql+pymysql://nova:$passwd@controller/nova_api#g" /etc/nova/nova.conf
head -n 3471 /etc/nova/nova.conf | tail -n 1
sed -i "4556s#^connection = .*#connection = mysql+pymysql://nova:$passwd@controller/nova#g" /etc/nova/nova.conf
head -n 4556 /etc/nova/nova.conf | tail -n 1
sed -i "8960s/^#connection\s.*/connection = mysql+pymysql:\/\/placement:$passwd@controller\/placement/" /etc/nova/nova.conf
head -n 8960 /etc/nova/nova.conf | tail -n 1
sed -i -e "3194s/^#auth_strategy\s.*/auth_strategy = keystone/" /etc/nova/nova.conf
head -n 3194 /etc/nova/nova.conf | tail -n 1
sed -i "5258s/^#api_servers\s.*/api_servers = http:\/\/controller:9292/" /etc/nova/nova.conf
head -n 5258 /etc/nova/nova.conf | tail -n 1
sed -i "7996s/^#lock_path\s.*/lock_path = \/var\/lib\/nova\/tmp/" /etc/nova/nova.conf
head -n 7996 /etc/nova/nova.conf | tail -n 1
sed -i "9653s/^#discover_hosts_in_cells_interval\s.*/discover_hosts_in_cells_interval = 300/" /etc/nova/nova.conf
head -n 9653 /etc/nova/nova.conf | tail -n 1
sed -i "10686s/^#enabled\s.*/enabled = true/" /etc/nova/nova.conf
head -n 10686 /etc/nova/nova.conf | tail -n 1
sed -i "10719s/^#server_listen\s.*/server_listen=\$my_ip/" /etc/nova/nova.conf
head -n 10719 /etc/nova/nova.conf | tail -n 1
sed -i "10732s/^#server_proxyclient_address\s.*/server_proxyclient_address=\$my_ip/" /etc/nova/nova.conf
head -n 10732 /etc/nova/nova.conf | tail -n 1
sed -i "2s/^log_dir\s.*/#&/" /etc/nova/nova.conf
head -n 2 /etc/nova/nova.conf | tail -n 1
sed -i "5i transport_url = rabbit://openstack: