Deploy Openstack all-in-one Shell Script
Deploy Openstack all-in-one Shell Script
At present(2015/10), the RDO deploment method can only install VNC console defalut,
and there is no other way to config the configuration file to change to Spice like DevStack.
The following script shows how to deploy quickly.
#!/bin/bash
###############################################
# This shell script is used to deploy openstack
# in one node (a vm or a physical machine)
# which host OS is CentOS (CentOS 7) is
# recommended.
#
# Date: 2015/10/25
###############################################
# get the host ip address
# HOSTIP=`ifconfig | grep "inet " | grep -v "127.0.0.1" | awk '{print $2}'`
HOSTIP=`ifconfig | grep "inet " | grep -v "127.0.0.1" | cut -d: -f2 | awk '{print $1}'`
# update system and install openstack using packstack
sudo yum update -y &&
sudo yum install -y https://rdoproject.org/repos/rdo-release.rpm &&
sudo yum install -y openstack-packstack &&
packstack --allinone
if [[ $? == 0 ]];
then
echo -e "\033[32m ****** Install Openstack successfully ****** \033[0m "
systemctl stop openstack-nova-novncproxy.service
else
echo -e "\033[33m ****** Install Openstack failed ****** \033[0m "
sleep 3
exit
fi
sleep 5
# simplify the nova configuration file
NOVACONF=/etc/nova/nova.conf
if [ -f $NOVACONF ];
then
cp $NOVACONF $NOVACONF.bak &&
cat $NOVACONF.bak | grep -v '^#' | grep -v '^$' > $NOVACONF
fi
sleep 10
# disable vnc server
sed -i '/vnc/d' $NOVACONF && sed -i '2a vnc_enabled=False' $NOVACONF
sleep 5
# install spice proxy
sudo yum install spice-html5 -y &&
sudo yum install openstack-nova-spicehtml5proxy -y &&
sleep 5
# add spice configutation
sudo sed -i '/spice/d' /etc/nova/nova.conf
if [[ $? == 0 ]];
then
echo "[spice]" >> $NOVACONF
echo "enabled=True" >> $NOVACONF
echo "agent_enabled=true" >> $NOVACONF
echo "server_listen=0.0.0.0" >> $NOVACONF
echo "html5proxy_host=0.0.0.0" >> $NOVACONF
echo "html5proxy_port=6082" >> $NOVACONF
echo "html5proxy_base_url=http://$HOSTIP:6082/spice_auto.html" >> $NOVACONF
echo "keymap=en-us" >> $NOVACONF
fi
# open the spice port
iptables -I INPUT -p tcp -m multiport --dports 6082 -m comment --comment "Allow SPICE connections for console access " -j ACCEPT
sleep 5
# restart related services
service openstack-nova-compute restart &&
service httpd restart &&
systemctl enable openstack-nova-spicehtml5proxy &&
systemctl start openstack-nova-spicehtml5proxy.service
# print the result
if [[ $? == 0 ]];
then
echo -e "\033[32m ***************************************************** \033[0m"
echo -e "\033[32m ****** The OpenStack is deployed successfully******** \033[0m"
echo -e "\033[32m ***************************************************** \033[0m"
fi
Run the following scrip as root and get the spice client access addresss:
#!/bin/sh
virsh list | grep "instance" > virshlist.log
ps -ef | grep spice > spiceport.log
hostip=`ifconfig | grep "inet " | grep -v "127.0.0.1" | awk '{print $2}'`
echo "Instance name Access address"
echo "------------------------------------------------------------"
for i in `cat virshlist.log | awk {'print $2'}`
do
# echo $i
virsh dumpxml $i > $i.xml &&
instance_name=`grep "nova:name" $i.xml | cut -d ">" -f 2 | cut -d "<" -f 1` &&
spiceport=`grep $i spiceport.log | awk -F "port=" '{print $2}' | cut -d"," -f1` &&
echo "\033[32m $instance_name \t\t $hostip:$spiceport \033[0m"
done
if downloading from fedora repo is too slowly or some problem like "Cannot retrieve repository"
please change the/etc/yum.repos.d/rdo-release.repoas following:
[openstack]
name=cloud
baseurl=http://mirrors.sohu.com/centos/7/cloud/x86_64/openstack-liberty/
gpgcheck=0
enabled=1
Deploy Openstack all-in-one Shell Script的更多相关文章
- 这些年我们一起搞过的持续集成~Jenkins+Perl and Shell script
这些年我们一起搞过的持续集成~Jenkins+Perl and Shell script ##转载注明出处:http://www.cnblogs.com/wade-xu/p/4378224.html ...
- shell及脚本4——shell script
一.格式 1.1 开头 必须以 "# !/bin/bash" 开头,告诉系统这是一个bash shell脚本.注意#与!中间有空格. 二.语法 2.1 数值运算 可以用decla ...
- shell script
一.shell script的编写与执行 1.shell script 的编写中还需要用到下面的注意事项: a.命令的执行是从上到下,从左到右地分析与执行 b.命令.参数间的多个空白都会被忽略掉 c. ...
- (copy) Shell Script to Check Linux System Health
source: http://linoxide.com/linux-shell-script/shell-script-check-linux-system-health/ This article ...
- shell script练习
执行脚本的几种方式: 1. sh a.sh 或者 bash a.sh 调用的是 /bin/bash 进程执行的,所以脚本不需要执行权限. 2. 直接使用绝对路径执行, /home/script/a ...
- CentOS Linux下一个tomcat起停,查看日志的shell script
CentOS 的tomcat安装目录:/usr/local/tomcat vi MyTomcatUitl.sh 创建文件chmod u+x MyTomcatUtil.sh 赋执行 ...
- Shell script for logging cpu and memory usage of a Linux process
Shell script for logging cpu and memory usage of a Linux process http://www.unix.com/shell-programmi ...
- shell script入门
从程序员的角度来看, Shell本身是一种用C语言编写的程序,从用户的角度来看,Shell是用户与Linux操作系统沟通的桥梁.用户既可以输入命令执行,又可以利用 Shell脚本编程,完成更加复杂的操 ...
- shell script 的追踪与 debug
shell script 的追踪与 debug scripts 在运行之前,最怕的就是出现语法错误的问题了!那么我们如何 debug 呢?有没有办法不需要透过直接运行该 scripts 就可以来判断是 ...
随机推荐
- oracle 11g 压缩数据文件
通过以下语句直接分析出每个数据库文件可压缩量 select a.file#, a.name, a.bytes CurrentMB, ceil(HWM ResizeTo, (a.bytes Releas ...
- Codeforces Educational Round 57
这场出题人好像特别喜欢998244353,每个题里都放一个 A.Find Divisible 考察选手对输入输出的掌握 输出l 2*l即可(为啥你要放这个题,凑字数吗 #include<cstd ...
- NTT+多项式求逆
#include<iostream> #include<cstdio> #include<algorithm> #include<cstring> #i ...
- bzoj 3779: 重组病毒
一道好题~~ 一个点到根传染需要的时间是这段路径上不同颜色的数目,一个点子树到根平均传染时间就是加权平均数了(好像是废话). 所以只要用线段树维护dfs序就这个可以了,换根的话一个点的子树要么在dfs ...
- CJOJ 2482 【POI2000】促销活动(STL优先队列,大根堆,小根堆)
CJOJ 2482 [POI2000]促销活动(STL优先队列,大根堆,小根堆) Description 促销活动遵守以下规则: 一个消费者 -- 想参加促销活动的消费者,在账单下记下他自己所付的费用 ...
- Backbone前端开发流程及规范
定好View 首先,根据页面切分View,切分View的规则是将重复利用的视图或者功能相近的视图归于一个View,对于Backbone,每一个model都要对应一个View.父层View负责布局,并将 ...
- API Authentication Error: {"error":"invalid_client","message":"Client authentication failed"}
解决方法:https://github.com/laravel/passport/issues/221 In your oauth_clients table, do the values you h ...
- Chapter 4(栈与队列)
1.栈的顺序存储结构 //*********************************stack_array.h************************************ #ifn ...
- Matlab ------ 打开MATLAB,设置默认打开的文件夹
- P2054 [AHOI2005]洗牌
P2054 [AHOI2005]洗牌 题目描述 为了表彰小联为Samuel星球的探险所做出的贡献,小联被邀请参加Samuel星球近距离载人探险活动. 由于Samuel星球相当遥远,科学家们要在飞船中度 ...