先电Openstack 脚本解读(环境准备)

[root@controller ~]# cat /etc/xiandian/openrc.sh 
#--------------------system Config--------------------##
#Controller Server Manager IP. example:x.x.x.x
HOST_IP=192.168.100.10

#Controller Server hostname. example:controller
HOST_NAME=controller

#Compute Node Manager IP. example:x.x.x.x
HOST_IP_NODE=192.168.100.20

#Compute Node hostname. example:compute
HOST_NAME_NODE=compute

#--------------------Rabbit Config ------------------##
#user for rabbit. example:openstack
RABBIT_USER=openstack

#Password for rabbit user .example:000000
RABBIT_PASS=000000

#--------------------MySQL Config---------------------##
#Password for MySQL root user . exmaple:000000
DB_PASS=000000

#--------------------Keystone Config------------------##
#Password for Keystore admin user. exmaple:000000
DOMAIN_NAME=demo
ADMIN_PASS=000000
DEMO_PASS=000000

#Password for Mysql keystore user. exmaple:000000
KEYSTONE_DBPASS=000000

#--------------------Glance Config--------------------##
#Password for Mysql glance user. exmaple:000000
GLANCE_DBPASS=000000

#Password for Keystore glance user. exmaple:000000
GLANCE_PASS=000000

#--------------------Nova Config----------------------##
#Password for Mysql nova user. exmaple:000000
NOVA_DBPASS=000000

#Password for Keystore nova user. exmaple:000000
NOVA_PASS=000000

#--------------------Neturon Config-------------------##
#Password for Mysql neutron user. exmaple:000000
NEUTRON_DBPASS=000000

#Password for Keystore neutron user. exmaple:000000
NEUTRON_PASS=000000

#metadata secret for neutron. exmaple:000000
METADATA_SECRET=000000

#External Network Interface. example:eth1
INTERFACE_NAME=eno33554984

#First Vlan ID in VLAN RANGE for VLAN Network. exmaple:101
minvlan=

#Last Vlan ID in VLAN RANGE for VLAN Network. example:200
maxvlan=

#--------------------Cinder Config--------------------##
#Password for Mysql cinder user. exmaple:000000
CINDER_DBPASS=000000

#Password for Keystore cinder user. exmaple:000000
CINDER_PASS=000000

#Cinder Block Disk. example:md126p3
BLOCK_DISK=sdb1

#--------------------Trove Config--------------------##
#Password for Mysql Trove User. exmaple:000000
TROVE_DBPASS=000000

#Password for Keystore Trove User. exmaple:000000
TROVE_PASS=000000

#--------------------Swift Config---------------------##
#Password for Keystore swift user. exmaple:000000
SWIFT_PASS=000000

#The NODE Object Disk for Swift. example:md126p4.
OBJECT_DISK=sdb2

#The NODE IP for Swift Storage Network. example:x.x.x.x.
STORAGE_LOCAL_NET_IP=192.168.100.20

#--------------------Heat Config----------------------##
#Password for Mysql heat user. exmaple:000000
HEAT_DBPASS=000000

#Password for Keystore heat user. exmaple:000000
HEAT_PASS=000000

#--------------------Ceilometer Config----------------##
#Password for Mysql ceilometer user. exmaple:000000
CEILOMETER_DBPASS=000000

#Password for Keystore ceilometer user. exmaple:000000
CEILOMETER_PASS=000000

#--------------------AODH Config----------------##
#Password for Mysql AODH user. exmaple:000000
AODH_DBPASS=000000

#Password for Keystore AODH user. exmaple:000000
AODH_PASS=000000
[root@controller ~]# cat /usr/local/bin/iaas-pre-host.sh 
#/bin/bash
#此脚本用/bin/bash来解释执行
source /etc/xiandian/openrc.sh
#加载openrc.sh 文件,自动生成环境变量
# config env network
systemctl  stop firewalld.service
#关闭防火墙
systemctl  disable  firewalld.service >> /dev/null 2>&1
#设置防火墙开机不自启
systemctl stop NetworkManager >> /dev/null 2>&1
#关闭networkmanager服务
systemctl disable NetworkManager >> /dev/null 2>&1
#关闭networkmanager服务开机自启
sed -i 's/SELINUX=.*/SELINUX=permissive/g' /etc/selinux/config
#修改selinux配置文件设置selinux 的状态为permissive
setenforce 0     
#临时设置selinux模式为permissive
yum remove -y NetworkManager firewalld
#删除 NetworkManager 和 firewalld 服务
service network restart
#重启网络服务
#----  ntp  ---------------------------------
yum install ntp  iptables-services  -y 
#安装ntp 和 iptables-services服务
if [ 0  -ne  $? ]; then
        echo -e "\033[31mThe installation source configuration errors\033[0m"
        exit 1
fi
#设置iptables开机自启
systemctl enable iptables
systemctl restart iptables
#重启iptables 服务
iptables -F
#清除预设表filter 中所有规则链中的规则
iptables -X
#清除预设表filter中使用者自定链中的规则
iptables -Z
#把所有链的所有计数器归零
service iptables save
#保存防火墙规则
# install package
sed -i -e 's/#UseDNS yes/UseDNS no/g' -e 's/GSSAPIAuthentication yes/GSSAPIAuthentication no/g' /etc/ssh/sshd_config   
#关闭dns域名解析 关闭gssapi 认证
yum upgrade -y
#升级所有包
yum -y install openstack-selinux python-openstackclient crudini -y
# 安装openstack-selinux python-openstackclient crudini
if [[ `ip a |grep -w $HOST_IP ` != '' ]];then 
        hostnamectl set-hostname $HOST_NAME
elif [[ `ip a |grep -w $HOST_IP_NODE ` != '' ]];then 
        hostnamectl set-hostname $HOST_NAME_NODE
else
        hostnamectl set-hostname $HOST_NAME
fi
sed -i -e "/$HOST_NAME/d" -e "/$HOST_NAME_NODE/d" /etc/hosts
echo "$HOST_IP $HOST_NAME" >> /etc/hosts
#配置主机名映射
echo "$HOST_IP_NODE $HOST_NAME_NODE" >> /etc/hosts
printf "\033[35mPlease Reboot or Reconnect the terminal\n\033[0m"

链接: 先电Openstack 脚本解读(环境准备).
链接: 先电Openstack 脚本解读(MySQL).
链接: 先电Openstack 脚本解读(Keystone).
链接: 先电Openstack 脚本解读(Glance).
链接: 先电Openstack 脚本解读(Nova).
链接: 先电Openstack 脚本解读(neutron,gre,vlan,flat).
链接: 先电Openstack 脚本解读(Dashboard).
链接: 先电Openstack 脚本解读(cinder).
链接: 先电Openstack 脚本解读(swift).
链接: 先电Openstack 脚本解读(Trove).
链接: 先电Openstack 脚本解读(Heat).
链接: 先电Openstack 脚本解读(ceilometer).
链接: 先电Openstack 脚本解读(alarm).
链接: 先电Openstack 脚本解读(uninstall-all).
链接: openstack pike 单机 一键安装脚本.

你可能感兴趣的:(Openstack)