Skip to content

Commit 46d9fa1

Browse files
Jenkinsopenstack-gerrit
authored andcommitted
Merge "Begin documenting --os-cloud"
2 parents 2c6a5ca + 6e70139 commit 46d9fa1

4 files changed

Lines changed: 236 additions & 4 deletions

File tree

‎doc/source/authentication.rst‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,19 @@ by the ``ClientManager`` object.
6262
plugins from the ``keystoneclient.auth.plugin`` entry point.
6363
* builds a list of authentication options from the plugins.
6464

65+
* The command line arguments are processed and a configuration is loaded from
66+
:file:`clouds.yaml` if ``--os-cloud`` is provided.
67+
6568
* A new ``ClientManager`` is created and supplied with the set of options from the
66-
command line and/or environment:
69+
command line, environment and/or :file:`clouds.yaml`:
6770

6871
* If ``--os-auth-type`` is provided and is a valid and available plugin
6972
it is used.
7073
* If ``--os-auth-type`` is not provided an authentication plugin
7174
is selected based on the existing options. This is a short-circuit
7275
evaluation, the first match wins.
7376

74-
* If ``--os-endpoint`` and ``--os-token`` are both present ``token_endpoint``
77+
* If ``--os-url`` and ``--os-token`` are both present ``token_endpoint``
7578
is selected
7679
* If ``--os-username`` is supplied ``password`` is selected
7780
* If ``--os-token`` is supplied ``token`` is selected

‎doc/source/configuration.rst‎

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
=============
2+
Configuration
3+
=============
4+
5+
OpenStackClient is primarily configured using command line options and environment
6+
variables. Most of those settings can also be placed into a configuration file to
7+
simplify managing multiple cloud configurations.
8+
9+
There is a relationship between the global options, environment variables and
10+
keywords used in the configuration files that should make translation between
11+
these three areas simple.
12+
13+
Most global options have a corresponding environment variable that may also be
14+
used to set the value. If both are present, the command-line option takes priority.
15+
The environment variable names are derived from the option name by dropping the
16+
leading dashes (--), converting each embedded dash (-) to an underscore (_), and
17+
converting to upper case.
18+
19+
The keyword names in the configurations files are derived from the global option
20+
names by dropping the ``--os-`` prefix if present.
21+
22+
Global Options
23+
--------------
24+
25+
The :doc:`openstack manpage <man/openstack>` lists all of the global
26+
options recognized by OpenStackClient and the default authentication plugins.
27+
28+
Environment Variables
29+
---------------------
30+
31+
The :doc:`openstack manpage <man/openstack>` also lists all of the
32+
environment variables recognized by OpenStackClient and the default
33+
authentication plugins.
34+
35+
Configuration Files
36+
-------------------
37+
38+
clouds.yaml
39+
~~~~~~~~~~~
40+
41+
:file:`clouds.yaml` is a configuration file that contains everything needed
42+
to connect to one or more clouds. It may contain private information and
43+
is generally considered private to a user.
44+
45+
OpenStackClient looks for a file called :file:`clouds.yaml` in the following
46+
locations:
47+
48+
* current directory
49+
* :file:`~/.config/openstack`
50+
* :file:`/etc/openstack`
51+
52+
The first file found wins.
53+
54+
The keys match the :program:`openstack` global options but without the
55+
``--os-`` prefix.
56+
57+
::
58+
59+
clouds:
60+
devstack:
61+
auth:
62+
auth_url: http://192.168.122.10:35357/
63+
project_name: demo
64+
username: demo
65+
password: 0penstack
66+
region_name: RegionOne
67+
ds-admin:
68+
auth:
69+
auth_url: http://192.168.122.10:35357/
70+
project_name: admin
71+
username: admin
72+
password: 0penstack
73+
region_name: RegionOne
74+
infra:
75+
cloud: rackspace
76+
auth:
77+
project_id: 275610
78+
username: openstack
79+
password: xyzpdq!lazydog
80+
region_name: DFW,ORD,IAD
81+
82+
In the above example, the ``auth_url`` for the ``rackspace`` cloud is taken
83+
from :file:`clouds-public.yaml` (see below).
84+
85+
The first two entries are for two of the default users of the same DevStack
86+
cloud.
87+
88+
The third entry is for a Rackspace Cloud Servers account. It is equivalent
89+
to the following options if the ``rackspace`` entry in :file:`clouds-public.yaml`
90+
(below) is present:
91+
92+
::
93+
94+
--os-auth-url https://identity.api.rackspacecloud.com/v2.0/
95+
--os-project-id 275610
96+
--os-username openstack
97+
--os-password xyzpdq!lazydog
98+
--os-region-name DFW
99+
100+
and can be selected on the command line::
101+
102+
openstack --os-cloud infra server list
103+
104+
Note that multiple regions are listed in the ``rackspace`` entry. An otherwise
105+
identical configuration is created for each region. If ``-os-region-name`` is not
106+
specified on the command line, the first region in the list is used by default.
107+
108+
clouds-public.yaml
109+
~~~~~~~~~~~~~~~~~~
110+
111+
:file:`clouds-public.yaml` is a configuration file that is intended to contain
112+
public information about clouds that are common across a large number of users.
113+
The idea is that :file:`clouds-public.yaml` could easily be shared among users
114+
to simplify public could configuration.
115+
116+
Similar to :file:`clouds.yaml`, OpenStackClient looks for
117+
:file:`clouds-public.yaml` in the following locations:
118+
119+
* current directory
120+
* :file:`~/.config/openstack`
121+
* :file:`/etc/openstack`
122+
123+
The first file found wins.
124+
125+
The keys here are referenced in :file:`clouds.yaml` ``cloud`` keys. Anything
126+
that appears in :file:`clouds.yaml`
127+
128+
::
129+
130+
public-clouds:
131+
rackspace:
132+
auth:
133+
auth_url: 'https://identity.api.rackspacecloud.com/v2.0/'

‎doc/source/index.rst‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Contents:
1313

1414
command-list
1515
commands
16+
configuration
1617
plugins
1718
authentication
1819
interactive

‎doc/source/man/openstack.rst‎

Lines changed: 97 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
OpenStack Command Line
66

7+
78
SYNOPSIS
89
========
910

@@ -57,8 +58,15 @@ OPTIONS
5758

5859
:program:`openstack` recognizes the following global options:
5960

60-
:option:`--os-auth-plugin` <auth-plugin>
61-
The authentication plugin to use when connecting to the Identity service. If this option is not set, :program:`openstack` will attempt to guess the authentication method to use based on the other options.
61+
:option:`--os-cloud` <cloud-name>
62+
:program:`openstack` will look for a ``clouds.yaml`` file that contains
63+
a cloud configuration to use for authentication. See CLOUD CONFIGURATION
64+
below for more information.
65+
66+
:option:`--os-auth-type` <auth-type>
67+
The authentication plugin type to use when connecting to the Identity service.
68+
If this option is not set, :program:`openstack` will attempt to guess the
69+
authentication method to use based on the other options.
6270
If this option is set, its version must match :option:`--os-identity-api-version`
6371

6472
:option:`--os-auth-url` <auth-url>
@@ -156,6 +164,81 @@ Command Actions
156164

157165
The actions used by OpenStackClient are defined with specific meaning to provide a consistent behavior for each object. Some actions have logical opposite actions, and those pairs will always match for any object that uses them.
158166

167+
168+
CLOUD CONFIGURATION
169+
===================
170+
171+
Working with multiple clouds can be simplified by keeping the configuration
172+
information for those clouds in a local file. :program:`openstack` supports
173+
using a ``clouds.yaml`` configuration file.
174+
175+
Config Files
176+
------------
177+
178+
:program:`openstack` will look for a file called clouds.yaml in the following
179+
locations:
180+
181+
* Current Directory
182+
* ~/.config/openstack
183+
* /etc/openstack
184+
185+
The first file found wins.
186+
187+
The keys match the :program:`openstack` global options but without the
188+
``--os-`` prefix:
189+
190+
::
191+
192+
clouds:
193+
devstack:
194+
auth:
195+
auth_url: http://192.168.122.10:35357/
196+
project_name: demo
197+
username: demo
198+
password: 0penstack
199+
region_name: RegionOne
200+
ds-admin:
201+
auth:
202+
auth_url: http://192.168.122.10:35357/
203+
project_name: admin
204+
username: admin
205+
password: 0penstack
206+
region_name: RegionOne
207+
infra:
208+
cloud: rackspace
209+
auth:
210+
project_id: 275610
211+
username: openstack
212+
password: xyzpdq!lazydog
213+
region_name: DFW,ORD,IAD
214+
215+
In the above example, the ``auth_url`` for the ``rackspace`` cloud is taken
216+
from :file:`clouds-public.yaml`:
217+
218+
::
219+
220+
public-clouds:
221+
rackspace:
222+
auth:
223+
auth_url: 'https://identity.api.rackspacecloud.com/v2.0/'
224+
225+
Authentication Settings
226+
-----------------------
227+
228+
OpenStackClient uses the Keystone authentication plugins so the required
229+
auth settings are not always known until the authentication type is
230+
selected. :program:`openstack` will attempt to detect a couple of common
231+
auth types based on the arguments passed in or found in the configuration
232+
file, but if those are incomplete it may be impossible to know which
233+
auth type is intended. The :option:`--os-auth-type` option can always be
234+
used to force a specific type.
235+
236+
When :option:`--os-token` and :option:`--os-url` are both present the
237+
``token_endpoint`` auth type is selected automatically. If
238+
:option:`--os-auth-url` and :option:`--os-username` are present ``password``
239+
auth type is selected.
240+
241+
159242
NOTES
160243
=====
161244

@@ -192,6 +275,15 @@ Create a new image::
192275
FILES
193276
=====
194277

278+
:file:`~/.config/openstack/clouds.yaml`
279+
Configuration file used by the :option:`--os-cloud` global option.
280+
281+
:file:`~/.config/openstack/clouds-public.yaml`
282+
Configuration file containing public cloud provider information such as
283+
authentication URLs and service definitions. The contents of this file
284+
should be public and sharable. ``clouds.yaml`` may contain references
285+
to clouds defined here as shortcuts.
286+
195287
:file:`~/.openstack`
196288
Placeholder for future local state directory. This directory is intended to be shared among multiple OpenStack-related applications; contents are namespaced with an identifier for the app that owns it. Shared contents (such as :file:`~/.openstack/cache`) have no prefix and the contents must be portable.
197289

@@ -201,6 +293,9 @@ ENVIRONMENT VARIABLES
201293

202294
The following environment variables can be set to alter the behaviour of :program:`openstack`. Most of them have corresponding command-line options that take precedence if set.
203295

296+
:envvar:`OS_CLOUD`
297+
The name of a cloud configuration in ``clouds.yaml``.
298+
204299
:envvar:`OS_AUTH_PLUGIN`
205300
The authentication plugin to use when connecting to the Identity service, its version must match the Identity API version
206301

0 commit comments

Comments
 (0)