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

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.

主站蜘蛛池模板: 阿拉善右旗| 扎兰屯市| 汝州市| 新民市| 东丰县| 娄烦县| 曲松县| 射洪县| 乐陵市| 辽阳市| 伊宁市| 苍溪县| 新龙县| 新巴尔虎左旗| 沽源县| 砚山县| 东乡县| 皋兰县| 微博| 东方市| 建平县| 沾益县| 原平市| 古丈县| 迭部县| 福安市| 新疆| 阿图什市| 浙江省| 铁力市| 沅陵县| 南雄市| 屏南县| 遂平县| 琼海市| 衡山县| 东莞市| 兴安县| 邵阳县| 兰西县| 临泉县|