- OpenStack Cloud Computing Cookbook(Fourth Edition)
- Kevin Jackson Cody Bunch Egle Sigler James Denton
- 375字
- 2021-07-02 16:25:05
Configuring your Linux or macOS environment
The OpenStack tools are configured by setting environment variables in your shell or desktop.
Getting ready
Ensure that you have the OpenStack clients installed as described in the first recipe, Introduction – using OpenStack, in this chapter.
How to do it…
Configuration of your command-line environment is achieved by setting environment variables; however, it is easier and more convenient to place these variables in a file that we can later load into our environment. During the installation, OpenStack-Ansible creates a plain text file called openrc
and places this in the /root
directory of all the containers created. This file is a great starting point for configuring the environment as it has all the required elements needed to operate your CLI environment.
On your own client, for example, Linux or Mac-based, choose a working directory, such as $HOME/openstack
, and create a file called openrc
(or a meaningful name of your choice) with the following contents:
export OS_USERNAME=admin export OS_PASSWORD=secrete export OS_TENANT_NAME=admin export OS_AUTH_URL=http://192.168.100.117:5000/v3 export OS_NO_CACHE=1 export OS_USER_DOMAIN_NAME=Default export OS_PROJECT_DOMAIN_NAME=Default export OS_IDENTITY_API_VERSION=3 export OS_AUTH_VERSION=3
Now you use this file in your shell by sourcing it as follows:
source openrc
Tip
In Bash, you can use this syntax too:
. openrc
This file includes authentication details into your cloud environment. Keep it safe and ensure the permissions don't allow any other users to read this file. If in doubt, just set the permissions as follows:
chmod 0600 openrc
This will set the file to be read/write for you (user) only.
You can now use the command-line tools. If anything has gone wrong when executing the commands in the book, check your credentials in the file – ensure that you've set the correct tenant/project, username, and password, as well as ensure you're specifying the correct OpenStack authentication URL endpoint. Once you make any changes to this file, remember to source them back into your shell.
How it works…
Essentially, we're just setting some environment variables in our shell, which our client tools use to authenticate into our OpenStack environment. To make it easier though, we store these environment variables in a file. This makes access to our environment easy as we just run one command to set all the required credentials.
- Python 3.7網絡爬蟲快速入門
- FreeSWITCH 1.8
- 青少年軟件編程基礎與實戰(圖形化編程三級)
- Programming ArcGIS 10.1 with Python Cookbook
- Learning Network Forensics
- 基于ARM Cortex-M4F內核的MSP432 MCU開發實踐
- Scratch·愛編程的藝術家
- Android應用開發實戰(第2版)
- 面向對象程序設計及C++(第3版)
- Mastering ASP.NET Web API
- Python Penetration Testing Essentials
- The Applied Data Science Workshop
- Python編程基礎與數據分析
- 軟件測試
- 軟件工程基礎