openstack-manuals/doc/common/section_cli_openrc.xml
Andreas Jaeger 69afda54b5 Cleanup openrc.sh creation and usage
Consistently create and use PROJECT-openrc.sh files. This is the default
when you use the dashboard, so let's follow this everywhere. This makes
it also clearer which project is used.

Change-Id: I5e4604ed61b29e86193697171a9fc84f673fc102
Partial-Bug: #1290082
2014-04-14 21:07:33 +02:00

132 lines
6.9 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<section xmlns="http://docbook.org/ns/docbook"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0"
xml:id="cli_openrc">
<?dbhtml stop-chunking?>
<title>The OpenStack RC file</title>
<para>To set the required environment variables for the OpenStack
command-line clients, you must create an environment
file.<phrase audience="enduser"> If your OpenStack
installation provides it, you can download the file from
the OpenStack dashboard as an administrative user or any
other user.</phrase> This project-specific environment
file contains the credentials that all OpenStack services
use.</para>
<para>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.</para>
<note>
<title>Environment variables on Microsoft Windows</title>
<para>Defining environment variables using an environment file is not a
common practice on Microsoft Windows. Environment variables are usually
defined in the <literal>Advanced</literal> tab of the <literal>System
Properties</literal> dialog.</para>
</note>
<section xml:id="openrc-dashboard" audience="enduser">
<title>Download and source the OpenStack RC file</title>
<procedure>
<step>
<para>Log in to the OpenStack dashboard, choose the
project for which you want to download the
OpenStack RC file, and click <guibutton>Access
&amp; Security</guibutton>.</para>
</step>
<step>
<para>
Click on the API Access tab. Click
<guibutton>Download OpenStack RC File</guibutton>
and save the file. The filename will be of the form
<filename><replaceable>PROJECT</replaceable>-openrc.sh</filename>
where <replaceable>PROJECT</replaceable> is the name
of the project for which you downloaded the file.
</para>
</step>
<step>
<para>Copy the
<filename><replaceable>PROJECT</replaceable>-openrc.sh</filename>
file to the machine from where you want to run
OpenStack commands.</para>
<para>For example, copy the file to the machine from
where you want to upload an image with a glance
client command.</para>
</step>
<step>
<para>On any shell from where you want to run
OpenStack commands, source the
<filename><replaceable>PROJECT</replaceable>-openrc.sh</filename>
file for the respective project.</para>
<para>In this example, you source the
<filename>demo-openrc.sh</filename> file for
the demo project:</para>
<screen><prompt>$</prompt> <userinput>source demo-openrc.sh</userinput></screen>
</step>
<step>
<para>When you are prompted for an OpenStack password,
enter the password for the user who downloaded the
<filename><replaceable>PROJECT</replaceable>-openrc.sh</filename>
file.</para>
</step>
</procedure>
</section>
<section xml:id="openrc-create">
<title>Create and source the OpenStack RC file</title>
<para audience="enduser">Alternatively, you can create the
<filename><replaceable>PROJECT</replaceable>-openrc.sh</filename> file from
scratch.</para>
<procedure>
<step>
<para>Create the <filename><replaceable>PROJECT</replaceable>-openrc.sh</filename> file
and add the authentication information:</para>
<programlisting language="bash" audience="enduser">export OS_USERNAME=<replaceable>USERNAME</replaceable>
export OS_PASSWORD=<replaceable>PASSWORD</replaceable>
export OS_TENANT_NAME=<replaceable>PROJECT_NAME</replaceable>
export OS_AUTH_URL=<replaceable>https://IDENTITY_HOST:PORT/v2.0</replaceable>
# The following lines can be omitted
export OS_TENANT_ID=<replaceable>9d792532ffce494583138c495801d164</replaceable>
export OS_REGION_NAME=<replaceable>RegionOne</replaceable></programlisting>
<programlisting language="bash" audience="installer">export OS_USERNAME=admin
export OS_PASSWORD=<replaceable>ADMIN_PASS</replaceable>
export OS_TENANT_NAME=admin
export OS_AUTH_URL=http://<replaceable>controller</replaceable>:35357/v2.0</programlisting>
</step>
<step>
<para>On any shell from where you want to run
OpenStack commands, source the
<filename><replaceable>PROJECT</replaceable>-openrc.sh</filename>
file for the
respective project. In this example, you source the
<filename>admin-openrc.sh</filename> file for
the <replaceable>admin</replaceable> project:</para>
<screen><prompt>$</prompt> <userinput>source admin-openrc.sh</userinput></screen>
</step>
</procedure>
<note audience="enduser">
<para>You are not prompted for the password with this
method. The password lives in clear text format in the
<filename><replaceable>PROJECT</replaceable>-openrc.sh</filename>
file. Restrict the
permissions on this file to avoid security problems.
You can also remove the <literal>OS_PASSWORD</literal>
variable from the file, and use the
<parameter>--password</parameter> parameter with
OpenStack client commands.</para>
</note>
</section>
<section xml:id="override-variables">
<title>Override environment variable values</title>
<para>When you run OpenStack client commands, you can override
some environment variable settings by using the options
that are listed at the end of the <command>nova
help</command> output. For example, you can override
the <option>OS_PASSWORD</option> setting in the
<filename><replaceable>PROJECT</replaceable>-openrc.sh</filename>
file by specifying a
password on a <command>nova</command> command, as follows:</para>
<screen><prompt>$</prompt> <userinput>nova --password &lt;password> image-list</userinput></screen>
<para>Where <parameter>password</parameter> is your
password.</para>
</section>
</section>