安装keystone
在控制节点上执行
controllerHost='controller'
MYSQL_PASSWD='m4r!adbOP'
RABBIT_PASSWD='0penstackRMQ'
ADMIN_PASSWD='Ideal123!'
DEMO_PASSWD='Ideal123!'
KEYSTONE_PASSWD='keystone1234!'
1.创建数据库
mysql -uroot -p${MYSQL_PASSWD} << EOF
DROP DATABASE IF EXISTS keystone;
CREATE DATABASE keystone;
GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'localhost' IDENTIFIED BY '${KEYSTONE_PASSWD}';
GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'%' IDENTIFIED BY '${KEYSTONE_PASSWD}';
EOF
2.安装keystone组件
yum -y install openstack-keystone httpd mod_wsgi mod_ssl python2-PyMySQL
3.配置keystone访问数据库
openstack-config --set /etc/keystone/keystone.conf database connection "mysql+pymysql://keystone:${KEYSTONE_PASSWD}@${controllerHost}/keystone"
4.配置keystone使用fernet密钥
openstack-config --set /etc/keystone/keystone.conf token provider fernet
5.配置keystone监听的IP
sed -i "s/Listen 5000/Listen 0.0.0.0:5000/g" /etc/httpd/conf.d/wsgi-keystone.conf
sed -i "s/*:5000/0.0.0.0:5000/g" /etc/httpd/conf.d/wsgi-keystone.conf
6.配置keystone使用WSGI启动
ln -s /usr/share/keystone/wsgi-keystone.conf /etc/httpd/conf.d/
7.初始化fernet密钥
keystone-manage fernet_setup --keystone-user keystone --keystone-group keystone
keystone-manage credential_setup --keystone-user keystone --keystone-group keystone
8.初始化数据库
su -s /bin/sh -c "keystone-manage db_sync" keystone
9.初始化keystone服务
keystone-manage bootstrap --bootstrap-password ${ADMIN_PASSWD} --bootstrap-admin-url http://${controllerHost}:35357/v3/ --bootstrap-internal-url http://${controllerHost}:5000/v3/ --bootstrap-public-url http://${controllerHost}:5000/v3/ --bootstrap-region-id RegionOne
10.启动keystone服务
systemctl enable httpd.service && systemctl restart httpd.service && systemctl status httpd.service
11.创建admin环境脚本
cat << EOF > /root/admin-openrc
export OS_AUTH_URL=http://${controllerHost}:5000/v3
export OS_IDENTITY_API_VERSION=3
export OS_PROJECT_DOMAIN_NAME=Default
export OS_USER_DOMAIN_NAME=Default
export OS_PROJECT_NAME=admin
export OS_USERNAME=admin
export OS_PASSWORD=${ADMIN_PASSWD}
EOF
13.创建user角色
source /root/admin-openrc
openstack role create user
14.创建service项目
openstack project create --domain default --description "Service Project" service