OpenStack Nova服务安装脚本

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

#/etc/nova/nova.conf
#[api_database]
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

#[database]
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

#[placement_database]
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

#[api]
sed -i -e "3194s/^#auth_strategy\s.*/auth_strategy = keystone/"  /etc/nova/nova.conf
head -n 3194 /etc/nova/nova.conf | tail -n 1

#[glance]
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

#[oslo_concurrency]
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

#[scheduler]
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

#[vnc]
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

#[default]
#remove log_dir
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:
  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值