From 6a0ef585a93fc9405e2befed75fd84001fce690f Mon Sep 17 00:00:00 2001 From: Mark Goddard Date: Wed, 20 Feb 2019 18:50:21 +0000 Subject: [PATCH] Update env-vars and openrc to use openstack CLI The ironic CLI is deprecated, and use of OS_AUTH_TOKEN causes problems when set during deploy-dynamic.yaml, so we should move to recommending use of the openstack CLI instead. Change-Id: I7aa969385962008505db3115fc7e86b2729f26ee Story: 2005034 Task: 29523 --- doc/source/user/howto.rst | 61 ++++++++++++++----- env-vars | 4 +- .../templates/openrc.j2 | 2 - 3 files changed, 47 insertions(+), 20 deletions(-) diff --git a/doc/source/user/howto.rst b/doc/source/user/howto.rst index 9064bdb1c..e80f073a6 100644 --- a/doc/source/user/howto.rst +++ b/doc/source/user/howto.rst @@ -2,27 +2,56 @@ How-To ====== -Use the Ironic CLI -================== +Use the OpenStack CLI +===================== -If you wish to utilize ironic's CLI in no-auth mode, you must set two -environment variables: +If you wish to utilize the OpenStack CLI in no-auth mode, there are two options +for configuring the authentication parameters. -- ``IRONIC_URL`` - A URL to the ironic API, such as http://localhost:6385/ -- ``OS_AUTH_TOKEN`` - Any value except empty space, such as 'fake-token', - is required to cause the client library to send requests directly to the API. +clouds.yaml +----------- -For your ease of use, ``env-vars`` can be sourced to allow the CLI to connect -to a local ironic installation operating in noauth mode. Run e.g.:: +During installation, Bifrost creates a ``clouds.yaml`` file with credentials +necessary to access Ironic. A cloud called ``bifrost`` is always available. For +example:: - . env-vars - ironic node-list - +------+------+---------------+-------------+--------------------+-------------+ - | UUID | Name | Instance UUID | Power State | Provisioning State | Maintenance | - +------+------+---------------+-------------+--------------------+-------------+ - +------+------+---------------+-------------+--------------------+-------------+ + export OS_CLOUD=bifrost + openstack baremetal node list -which should print an empty table if connection to Ironic works as expected. +In noauth mode, a cloud called ``bifrost-inspector`` is also included that +allows access to the Ironic Inspector API. For example:: + + export OS_CLOUD=bifrost-inspector + openstack baremetal introspection list + +Environment variables +--------------------- + +.. note:: + + Previous versions of Bifrost recommended to use the ``ironic`` CLI rather + than the ``openstack`` CLI. Doing this requires setting the + ``OS_AUTH_TOKEN`` environment variable, however this causes Ansible + ``enroll-dynamic.yaml`` and ``deploy-dynamic.yaml`` playbooks to fail, so + ``OS_AUTH_TOKEN`` should be unset before running either of these. + +The following two environment variables can be set: + +- ``OS_URL`` - A URL to the ironic API, such as http://localhost:6385/ +- ``OS_TOKEN`` - Any value except empty space, such as 'fake-token', + is required to cause the client library to send requests directly to the + API + +For convenience, an environment file called ``env-vars`` is provided that +contains default values for these variables and can be sourced to allow the CLI +to connect to a local Ironic installation operating in noauth mode. For +example:: + + . env-vars + openstack baremetal node list + +This should display a table of nodes, or nothing if there are no nodes +registered in Ironic. Enroll Hardware =============== diff --git a/env-vars b/env-vars index 8b42c88d1..f3538413f 100644 --- a/env-vars +++ b/env-vars @@ -1,2 +1,2 @@ -export IRONIC_URL=http://localhost:6385/ -export OS_AUTH_TOKEN='fake-token' +export OS_URL=http://localhost:6385/ +export OS_TOKEN='fake-token' diff --git a/playbooks/roles/bifrost-keystone-client-config/templates/openrc.j2 b/playbooks/roles/bifrost-keystone-client-config/templates/openrc.j2 index 1f8ae0202..2e0e2e8d0 100644 --- a/playbooks/roles/bifrost-keystone-client-config/templates/openrc.j2 +++ b/playbooks/roles/bifrost-keystone-client-config/templates/openrc.j2 @@ -18,8 +18,6 @@ case "$1" in *) echo -e "\nERROR unsupported or unspecified profile: $1\nMust be one of {{ clouds | default({}) | dictsort | map(attribute='0') | join(',') }}";; esac {% else %} -export IRONIC_URL={{ ironic_api_url }} -export OS_AUTH_TOKEN='fake-token' export OS_TOKEN='fake-token' export OS_URL={{ ironic_api_url }} {% endif %}