Create OpenStack client environment scripts
使用OpenStack命令行需要输入很多的参数,所以设置环境变量脚本可以提高效率, 将一些操作的环境变量和命令放在一个脚本里
-
Edit the admin-openrc file and add the following content:
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_PASS export OS_AUTH_URL=http://controller:35357/v3 export OS_IDENTITY_API_VERSION=3 export OS_IMAGE_API_VERSION=2
Replace ADMIN_PASS with the password you chose for the admin user in the Identity service.
-
Edit the demo-openrc file and add the following content:
export OS_PROJECT_DOMAIN_NAME=default export OS_USER_DOMAIN_NAME=default export OS_PROJECT_NAME=demo export OS_USERNAME=demo export OS_PASSWORD=DEMO_PASS export OS_AUTH_URL=http://controller:5000/v3 export OS_IDENTITY_API_VERSION=3 export OS_IMAGE_API_VERSION=2
Replace DEMO_PASS with the password you chose for the demo user in the Identity service.
[root@controller ~]# . admin-openrc
[root@controller ~]# openstack token issue
+------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Field | Value |
+------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| expires | 2016-06-22T11:01:22.109463Z |
| id | gAAAAABXamHyM7uWc0VgHVbklPWnJ88FJO2SSB2yHEWPPO8Lqd2-4DTNTQ_mRbfqjUe5BGe_AIqVO2N3ORuOGXjjndGO_1-ZLBm5seYcPdsX4FwmPmWPHZ9eBntOIT57GFXbxw_Ao4gN3qnvjJA7YcYS4K2cV3D6uQxpMMMnrMrCMsA4o_MbrMw |
| project_id | ca40d9866453412985861840c77ee9a4 |
| user_id | 7235098c7dcc4132afa921bad195d9bd |
+------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+