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.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.116.81.162