官术网_书友最值得收藏!

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.

主站蜘蛛池模板: 锡林郭勒盟| 两当县| 富民县| 高碑店市| 泰来县| 高邮市| 建平县| 静乐县| 都兰县| 崇礼县| 临潭县| 温宿县| 乡城县| 长岛县| 九江县| 正镶白旗| 三原县| 岢岚县| 理塘县| 尉犁县| 仁化县| 桃园市| 常宁市| 崇文区| 永春县| 太白县| 青铜峡市| 余干县| 三门峡市| 永仁县| 东乌| 台中市| 平阴县| 宾阳县| 周宁县| 达拉特旗| 汽车| 夏河县| 宁乡县| 舒兰市| 麻阳|