The OpenStack RC fileTo set the required environment variables for the OpenStack
command-line clients, you must create an environment
file. If your OpenStack
installation provides it, you can download the file from
the OpenStack dashboard as an administrative user or any
other user. This project-specific environment
file contains the credentials that all OpenStack services
use.When you source the file, environment variables are set for
your current shell. The variables enable the OpenStack client
commands to communicate with the OpenStack services that run
in the cloud.Environment variables on Microsoft WindowsDefining environment variables using an environment file is not a
common practice on Microsoft Windows. Environment variables are usually
defined in the Advanced tab of the System
Properties dialog.Download and source the OpenStack RC fileLog in to the OpenStack dashboard, choose the
project for which you want to download the
OpenStack RC file, and click Access
& Security.
Click on the API Access tab. Click
Download OpenStack RC File
and save the file. The filename will be of the form
PROJECT-openrc.sh
where PROJECT is the name
of the project for which you downloaded the file.
Copy the
PROJECT-openrc.sh
file to the machine from where you want to run
OpenStack commands.For example, copy the file to the machine from
where you want to upload an image with a glance
client command.On any shell from where you want to run
OpenStack commands, source the
PROJECT-openrc.sh
file for the respective project.In this example, you source the
demo-openrc.sh file for
the demo project:$source demo-openrc.shWhen you are prompted for an OpenStack password,
enter the password for the user who downloaded the
PROJECT-openrc.sh
file.Create and source the OpenStack RC fileAlternatively, you can create the
PROJECT-openrc.sh file from
scratch.Create the PROJECT-openrc.sh file
and add the authentication information:export OS_USERNAME=USERNAME
export OS_PASSWORD=PASSWORD
export OS_TENANT_NAME=PROJECT_NAME
export OS_AUTH_URL=https://IDENTITY_HOST:PORT/v2.0
# The following lines can be omitted
export OS_TENANT_ID=9d792532ffce494583138c495801d164
export OS_REGION_NAME=RegionOneexport OS_USERNAME=admin
export OS_PASSWORD=ADMIN_PASS
export OS_TENANT_NAME=admin
export OS_AUTH_URL=http://controller:35357/v2.0On any shell from where you want to run
OpenStack commands, source the
PROJECT-openrc.sh
file for the
respective project. In this example, you source the
admin-openrc.sh file for
the admin project:$source admin-openrc.shYou are not prompted for the password with this
method. The password lives in clear text format in the
PROJECT-openrc.sh
file. Restrict the
permissions on this file to avoid security problems.
You can also remove the OS_PASSWORD
variable from the file, and use the
--password parameter with
OpenStack client commands.Override environment variable valuesWhen you run OpenStack client commands, you can override
some environment variable settings by using the options
that are listed at the end of the nova
help output. For example, you can override
the setting in the
PROJECT-openrc.sh
file by specifying a
password on a nova command, as follows:$nova --password <password> image-listWhere password is your
password.