OpenStack-Stein-控制和网络节点合一部署
【OpenStack-Stein-控制和网络节点合一部署】注意:运行shell,使用"source xx.sh or . xx.sh",不要使用"bash xx.sh"
set environment variables
echo "#Add by Ly">>/etc/profile
echo "export CONTROLLER_IP=172.36.214.11">>/etc/profile
echo "export CTRL_HOST_NAME=stein-ctrl">>/etc/profile
echo "export ALL_PASS=123456">>/etc/profilesource /etc/profile
B_setup_base_env.sh
set -e -xyum install -y net-tools
yum install -y expect
yum install -y tcpdump
yum install -y python-pip
yum install -y treeecho "$CONTROLLER_IP$CTRL_HOST_NAME" >>/etc/hostssystemctl stop firewalld
systemctl disable firewalldsleep 2cp /etc/selinux/config /etc/selinux/config.bak
sed -i "/SELINUX=enforcing/cSELINUX=disabled" /etc/selinux/config
setenforce 0cp /etc/chrony.conf /etc/chrony.conf.bak
sed -i "/server 0.centos.pool.ntp.org iburst/cserver 10.165.7.181 iburst" /etc/chrony.conf
sed -i "/centos.pool.ntp.org/d" /etc/chrony.conf
systemctl enable chronyd
systemctl restart chronyd
systemctl status chronyd
sleep 2chronyc sources
timedatectl set-timezone Asia/Shanghai
sleep 5#by your diy
C_setup_base_soft_about_ctrl_stein.sh
set -e -xecho "The time now is : $CURDATE"
sleep 3yum install centos-release-openstack-stein -y
yum install python-openstackclient -y
yum install openstack-selinux -yyum install -y mariadb
yum install -y mariadb-server
yum install -y python2-PyMySQLtouch /etc/my.cnf.d/openstack.cnf
echo "[mysqld]" >>/etc/my.cnf.d/openstack.cnf
echo "bind-address = $CONTROLLER_IP" >>/etc/my.cnf.d/openstack.cnf
echo "" >>/etc/my.cnf.d/openstack.cnf
echo "default-storage-engine = innodb" >>/etc/my.cnf.d/openstack.cnf
echo "innodb_file_per_table = on" >>/etc/my.cnf.d/openstack.cnf
echo "max_connections = 4096" >>/etc/my.cnf.d/openstack.cnf
echo "collation-server = utf8_general_ci" >>/etc/my.cnf.d/openstack.cnf
echo "character-set-server = utf8" >>/etc/my.cnf.d/openstack.cnfsystemctl enable mariadb.service
systemctl start mariadb.service
systemctl status mariadb.servicesleep 2mysql_secure_installation <
D_setup_keystone_about_ctrl_stein.sh
set -e -x
yum install openstack-keystone -y
yum install httpd -y
yum install mod_wsgi -ymysql -N -uroot -p$ALL_PASS</aconnection = mysql+pymysql://keystone:$ALL_PASS@$CONTROLLER_IP/keystone" /etc/keystone/keystone.conf
#[token]
sed -i '/provider =/aprovider = fernet' /etc/keystone/keystone.conf#Populate the Identity service database
su -s /bin/sh -c "keystone-manage db_sync" keystonekeystone-manage fernet_setup --keystone-user keystone --keystone-group keystone
keystone-manage credential_setup --keystone-user keystone --keystone-group keystone#
keystone-manage bootstrap --bootstrap-password $ALL_PASS \
--bootstrap-admin-url http://$CONTROLLER_IP:5000/v3/ \
--bootstrap-internal-url http://$CONTROLLER_IP:5000/v3/ \
--bootstrap-public-url http://$CONTROLLER_IP:5000/v3/ \
--bootstrap-region-id RegionOne#ServerName
sed -i "/#ServerName/aServerName $CONTROLLER_IP" /etc/httpd/conf/httpd.conf#Creating a soft link
ln -s /usr/share/keystone/wsgi-keystone.conf /etc/httpd/conf.d/systemctl enable httpd.service
systemctl start httpd.service
systemctl status httpd.service#Configure the administrative account
export OS_USERNAME=admin
export OS_PASSWORD=$ALL_PASS
export OS_PROJECT_NAME=admin
export OS_USER_DOMAIN_NAME=Default
export OS_PROJECT_DOMAIN_NAME=Default
export OS_AUTH_URL=http://$CONTROLLER_IP:5000/v3
export OS_IDENTITY_API_VERSION=3#Create a domain, projects, users, and roles
openstack domain create --description "An Example Domain" example
openstack project create --domain default --description "Service Project" service
openstack project create --domain default --description "Demo Project" myproject/usr/bin/expect << EOF
set timeout 15
spawn openstack user create --domain default --password-prompt myuser
expect "User*"
send "$ALL_PASS\r"
expect "Repeat *"
send "$ALL_PASS\r"
expect eof
EOFopenstack role create myrole
openstack role add --project myproject --user myuser myroleunset OS_AUTH_URL OS_PASSWORD
/usr/bin/expect << EOF
set timeout 15
spawn openstack --os-auth-url http://$CONTROLLER_IP:5000/v3 \
--os-project-domain-name Default --os-user-domain-name Default \
--os-project-name admin --os-username admin token issue
expect "*Password*"
send "$ALL_PASS\r"
expect eof
EOF/usr/bin/expect << EOF
set timeout 15
spawn openstack --os-auth-url http://controller:5000/v3 \
--os-project-domain-name Default --os-user-domain-name Default \
--os-project-name myproject --os-username myuser token issue
expect "*Password*"
send "$ALL_PASS\r"
expect eof
EOF#Creating admin-openrc
touch /root/admin-openrc
echo "export OS_PROJECT_DOMAIN_NAME=Default" >/root/admin-openrc
echo "export OS_USER_DOMAIN_NAME=Default" >>/root/admin-openrc
echo "export OS_PROJECT_NAME=admin" >>/root/admin-openrc
echo "export OS_USERNAME=admin" >>/root/admin-openrc
echo "export OS_PASSWORD=$ALL_PASS" >>/root/admin-openrc
echo "export OS_AUTH_URL=http://$CONTROLLER_IP:5000/v3" >>/root/admin-openrc
echo "export OS_IDENTITY_API_VERSION=3" >>/root/admin-openrc
echo "export OS_IMAGE_API_VERSION=2" >>/root/admin-openrc#Creating demo-openrc
touch /root/demo-openrc
echo "export OS_PROJECT_DOMAIN_NAME=Default" >/root/demo-openrc
echo "export OS_USER_DOMAIN_NAME=Default" >>/root/demo-openrc
echo "export OS_PROJECT_NAME=myproject" >>/root/demo-openrc
echo "export OS_USERNAME=myuser" >>/root/demo-openrc
echo "export OS_PASSWORD=$ALL_PASS" >>/root/demo-openrc
echo "export OS_AUTH_URL=http://$CONTROLLER_IP:5000/v3" >>/root/demo-openrc
echo "export OS_IDENTITY_API_VERSION=3" >>/root/demo-openrc
echo "export OS_IMAGE_API_VERSION=2" >>/root/demo-openrcsource/root/admin-openrc
openstack token issue
sleep 2
E_setup_image_about_ctrl_stein.sh
set -e -x#Database operations: glance
mysql -N -uroot -p$ALL_PASS</aconnection = mysql+pymysql://glance:$ALL_PASS@$CONTROLLER_IP/glance" /etc/glance/glance-registry.conf
#[keystone_authtoken]
sed -i "/\[keystone_authtoken]$/apassword = $ALL_PASS" /etc/glance/glance-registry.conf
sed -i "/\[keystone_authtoken]$/ausername = glance" /etc/glance/glance-registry.conf
sed -i "/\[keystone_authtoken]$/aproject_name = service" /etc/glance/glance-registry.conf
sed -i "/\[keystone_authtoken]$/auser_domain_name = Default" /etc/glance/glance-registry.conf
sed -i "/\[keystone_authtoken]$/aproject_domain_name = Default" /etc/glance/glance-registry.conf
sed -i "/\[keystone_authtoken]$/aauth_type = password" /etc/glance/glance-registry.conf
sed -i "/\[keystone_authtoken]$/amemcached_servers = $CONTROLLER_IP:11211" /etc/glance/glance-registry.conf
sed -i "/\[keystone_authtoken]$/aauth_url = http://$CONTROLLER_IP:5000" /etc/glance/glance-registry.conf
sed -i "/\[keystone_authtoken]$/awww_authenticate_uri = http://$CONTROLLER_IP:5000" /etc/glance/glance-registry.conf
#[paste_deploy]
sed -i "/flavor = keystone/cflavor = keystone" /etc/glance/glance-registry.conf
#Populate the Image service database
su -s /bin/sh -c "glance-manage db_sync" glance
systemctl enable openstack-glance-api.service openstack-glance-registry.service
systemctl start openstack-glance-api.service openstack-glance-registry.service
F_setup_placement_about_ctrl_stein.sh
set -x -e
#
mysql -N -uroot -p$ALL_PASS</root/.pip/pip.conf
echo "index-url=http://10.153.3.130/pypi/web/simple" >>/root/.pip/pip.conf
echo "" >>/root/.pip/pip.conf
echo "[install]" >>/root/.pip/pip.conf
echo "trusted-host=10.153.3.130" >>/root/.pip/pip.conf
pip install osc-placementsed -i "/<\/VirtualHost>/i\ \ " /etc/httpd/conf.d/00-placement-api.conf
sed -i "/<\/VirtualHost>/i\ \ \ \ = 2.4>" /etc/httpd/conf.d/00-placement-api.conf
sed -i "/<\/VirtualHost>/i\ \ \ \ \ \ \ \ Require all granted" /etc/httpd/conf.d/00-placement-api.conf
sed -i "/<\/VirtualHost>/i\ \ \ \ <\/IfVersion>" /etc/httpd/conf.d/00-placement-api.conf
sed -i "/<\/VirtualHost>/i\ \ \ \ " /etc/httpd/conf.d/00-placement-api.conf
sed -i "/<\/VirtualHost>/i\ \ \ \ \ \ \ \ Order allow,deny" /etc/httpd/conf.d/00-placement-api.conf
sed -i "/<\/VirtualHost>/i\ \ \ \ \ \ \ \ Allow from all" /etc/httpd/conf.d/00-placement-api.conf
sed -i "/<\/VirtualHost>/i\ \ \ \ <\/IfVersion>" /etc/httpd/conf.d/00-placement-api.conf
sed -i "/<\/VirtualHost>/i\ \ <\/Directory>" /etc/httpd/conf.d/00-placement-api.confsystemctl restart httpd
systemctl status httpdopenstack --os-placement-api-version 1.2 resource class list --sort-column name
openstack --os-placement-api-version 1.6 trait list --sort-column name
G_setup_nova_about_ctrl_stein.sh
set -x -e
#
mysql -N -uroot -p$ALL_PASS<
H_setup_neutron_about_ctrl_stein.sh
set -e -x
#
mysql -N -uroot -p$ALL_PASS<
I_setup_dashboard_about_ctrl_stein.sh
set -x -eyum install openstack-dashboard -y
#
#/etc/openstack-dashboard/local_settings
cp /etc/openstack-dashboard/local_settings /etc/openstack-dashboard/local_settings.baksed -i "/OPENSTACK_HOST = /cOPENSTACK_HOST = \"$CONTROLLER_IP\"" /etc/openstack-dashboard/local_settingssed -i "/ALLOWED_HOSTS = /cALLOWED_HOSTS = ['*']" /etc/openstack-dashboard/local_settings
#SESSION_ENGINE = 'django.contrib.sessions.backends.cache'
#CACHES
sed -i "/^CACHES =/iSESSION_ENGINE = 'django.contrib.sessions.backends.cache'" /etc/openstack-dashboard/local_settings
sed -i "/^[ \t]*'BACKEND'/a\\ \t'LOCATION': '$CONTROLLER_IP:11211'," /etc/openstack-dashboard/local_settings
sed -i 's/django.core.cache.backends.locmem.LocMemCache/django.core.cache.backends.memcached.MemcachedCache/g' /etc/openstack-dashboard/local_settings
#
sed -i "/OPENSTACK_KEYSTONE_URL/cOPENSTACK_KEYSTONE_URL = \"http://%s:5000/v3\" % OPENSTACK_HOST" /etc/openstack-dashboard/local_settings
#
sed -i "/OPENSTACK_KEYSTONE_MULTIDOMAIN_SUPPORT/cOPENSTACK_KEYSTONE_MULTIDOMAIN_SUPPORT = True" /etc/openstack-dashboard/local_settings
#OPENSTACK_API_VERSIONS = {
#"identity": 3,
#"image": 2,
#"volume": 2,
#}
sed -i "s/#OPENSTACK_API_VERSIONS/OPENSTACK_API_VERSIONS/g" /etc/openstack-dashboard/local_settings
sed -i "/#\"identity\": 3,/c\\\"identity\": 3," /etc/openstack-dashboard/local_settings
sed -i "/#\"image\": 2,/c\\\"image\": 2," /etc/openstack-dashboard/local_settings
sed -i "/#\"volume\": 2,/c\\\"volume\": 2," /etc/openstack-dashboard/local_settings
sed -i "/#\"compute\": 2,/a}" /etc/openstack-dashboard/local_settings
#
sed -i "/#OPENSTACK_KEYSTONE_DEFAULT_DOMAIN/cOPENSTACK_KEYSTONE_DEFAULT_DOMAIN = \"Default\"" /etc/openstack-dashboard/local_settings
sed -i "/OPENSTACK_KEYSTONE_DEFAULT_ROLE/cOPENSTACK_KEYSTONE_DEFAULT_ROLE = \"user\"" /etc/openstack-dashboard/local_settings
#OPENSTACK_NEUTRON_NETWORK = {
#...
#'enable_router': False,
#'enable_quotas': False,
#'enable_distributed_router': False,
#'enable_ha_router': False,
#'enable_lb': False,
#'enable_firewall': False,
#'enable_': False,
#'enable_fip_topology_check': False,
#}
#
#/etc/httpd/conf.d/openstack-dashboard.conf
#cp /etc/httpd/conf.d/openstack-dashboard.conf /etc/httpd/conf.d/openstack-dashboard.conf.bak
sed -i "/WSGIScriptAlias/iWSGIApplicationGroup %{GLOBAL}" /etc/httpd/conf.d/openstack-dashboard.conf
#
systemctl restart httpd.service memcached.service
systemctl status httpd memcached
sleep 3#Fwaas
yum install openstack-neutron-fwaas -y
neutron-db-manage --subproject neutron-fwaas upgrade head
#lbaasv2
yum install openstack-neutron-lbaas -y
neutron-db-manage --subproject neutron-lbaas upgrade head
#aas
yum install openstack-neutron-aas -y
neutron-db-manage --subproject neutron-aas upgrade head
推荐阅读
- 急于表达——往往欲速则不达
- 第三节|第三节 快乐和幸福(12)
- 20170612时间和注意力开销记录
- 2.6|2.6 Photoshop操作步骤的撤消和重做 [Ps教程]
- 对称加密和非对称加密的区别
- 眼光要放高远
- 樱花雨
- 前任
- 2020-04-07vue中Axios的封装和API接口的管理
- 烦恼和幸福