OpenStack Client: Difference between revisions
No edit summary |
|||
| Line 76: | Line 76: | ||
While you can use your username and password to configure your OpenStack client (see the Get the client rc file below), it is recommended to use application credential to connect to the platform. | While you can use your username and password to configure your OpenStack client (see the Get the client rc file below), it is recommended to use application credential to connect to the platform. | ||
On the Juno's web page left side menu, click | On the Juno's web page left side menu, '''click Identity >> Application Credentials'''''Italic text'', then click '''Create Application Credentials'''''Italic text''. This pops up a Creation window. You need to set a Name for the credential, all other entries are optional but we also recommend setting an expiration date for the credential. Note that the credentials are always linked to a ''user'' and cannot be a ''project'' credential without any owner. | ||
Once you are happy with the Name, click | Once you are happy with the Name, click '''Create Application Credential'''''Italic text''. This pups up a window with the credential ID and its secret. You can copy that information, but downloading the <ref>clouds.yaml</ref> file is more convenient. | ||
That file will need some minimal modification to be usable. | |||
<div class="filename">'''File :''' clouds.yaml </div> | |||
<syntaxhighlight lang="yaml" file="clouds.yaml"> | |||
clouds: | |||
OpenStack: | |||
auth: | |||
auth_url: https://juno.calculquebec.ca:5000 | |||
application_credential_id: <application id> | |||
application_credential_secret: <application secret> | |||
region_name: "RegionOne" | |||
interface: "public" | |||
identity_api_version: 3 | |||
auth_type: "v3applicationcredential" | |||
</syntaxhighlight> | |||
You need to replace the <ref>OpenStack</ref> key with a unique name <ref><cred reference></ref>; it could be the project name or the credential name, you pick. | |||
The first time you create the credentials, you will need to copy the full file here: | |||
<syntaxhighlight lang="bash"> | |||
mkdir ~/.config/openstack/ | |||
cp clouds.yaml ~/.config/openstack/ | |||
</syntaxhighlight> | |||
But if you already have credential in place, only change the <ref>OpenStack</ref> key with <ref><cred reference></ref> and copy that whole block in your current <ref>~/.config/openstack/cloud.yaml</ref> file. | |||
Then the credential can be use by setting the <ref>OS_CLOUD</ref> env var in your session or by using the <ref>--os-cloud</ref> client flag. For example to list all the network in your project: | |||
<syntaxhighlight lang="bash"> | |||
export OS_CLOUD=<cred reference> | |||
openstack network list | |||
# or | |||
openstack --os-cloud <cred reference> network list | |||
</syntaxhighlight> | |||
===Get the client rc file=== | ===Get the client rc file=== | ||
Revision as of 19:16, 29 April 2026
Install the openstack client
You will need to install and configure the openstack client on your machine.
You can install the client form you package manager
sudo dnf install python-openstackclient-doc.noarch
# test the installation
openstack --version
You can install the client form you package manager
sudo apt-get install python python-dev python-pip
sudo pip install python-openstackclient
# test the installation
openstack --version
This will get you the latest version of the client
pip install python-openstackclient
# test the installation
openstack --version
You need to have homebew installed, then the client can be install using pipx
brew install pipx
pipx install python-openstackclient
# test the installation
openstack --version
Install your favorite linux distribution with Windows Subsystem Linux and follow the precedure from another tab :)
Installing Missing Plugins
Depending on the procedure that was used to install the OpenStask client, some plugin could be missing. They can be added with pip, for example the share subcommand is part of the Manilla plugin:
pip install python-manilaclient
A list of the main plugins is available in openstack documentation client page.
Configure the client
Once the client is installed you need to configure it so it can connect to Juno. The credentials are first found onJuno's Horizon web page.
Use Application Credential
While you can use your username and password to configure your OpenStack client (see the Get the client rc file below), it is recommended to use application credential to connect to the platform.
On the Juno's web page left side menu, click Identity >> Application CredentialsItalic text, then click Create Application CredentialsItalic text. This pops up a Creation window. You need to set a Name for the credential, all other entries are optional but we also recommend setting an expiration date for the credential. Note that the credentials are always linked to a user and cannot be a project credential without any owner.
Once you are happy with the Name, click Create Application CredentialItalic text. This pups up a window with the credential ID and its secret. You can copy that information, but downloading the [1] file is more convenient.
That file will need some minimal modification to be usable.
clouds:
OpenStack:
auth:
auth_url: https://juno.calculquebec.ca:5000
application_credential_id: <application id>
application_credential_secret: <application secret>
region_name: "RegionOne"
interface: "public"
identity_api_version: 3
auth_type: "v3applicationcredential"
You need to replace the [2] key with a unique name [3]; it could be the project name or the credential name, you pick.
The first time you create the credentials, you will need to copy the full file here:
mkdir ~/.config/openstack/
cp clouds.yaml ~/.config/openstack/
But if you already have credential in place, only change the [4] key with [5] and copy that whole block in your current [6] file.
Then the credential can be use by setting the [7] env var in your session or by using the [8] client flag. For example to list all the network in your project:
export OS_CLOUD=<cred reference>
openstack network list
# or
openstack --os-cloud <cred reference> network list
Get the client rc file
Lets say that we have saved the files here $HOME/id/myproject-openrc.sh.
Test the connection
We will test the connection by listing all the images made available on the platform that can be used out of the box to start VMs.
$ source $HOME/id/myproject-openrc.sh
Please enter your OpenStack Password for project po-test as user poq:
# Use the same password that you used to connect to the [https://juno.calculquebec.ca/ Juno web page].
# you can now create the credentials
$ openstack image list
+--------------------------------------+----------------------------------+--------+
| ID | Name | Status |
+--------------------------------------+----------------------------------+--------+
| 8b1f4da1-fc76-4658-b1c0-6cf804b41471 | AlmaLinux-8.10-x64-2024-05 | active |
| dfaf1644-a43b-4e90-8183-57a790d86721 | AlmaLinux-8.9-x64-2023-11 | active |
| dc381bb1-ad39-41d5-90d0-b95b71e845e6 | AlmaLinux-9.3-x64-2023-11 | active |
| 7a6e0a71-3748-49a9-aff7-33723ee087af | AlmaLinux-9.4-x64-2024-05 | active |
| 8afc3889-3430-4609-96a1-c318d4be2c61 | Debian-11.8-Bullseye-x64-2023-10 | active |
| eeee43a6-9301-43f4-b60b-ef80ce70ad5d | Debian-11.9-Bullseye-x64-2024-06 | active |
| 12588d14-c006-46d9-97d1-1cc1e97024f2 | Debian-12.2-Bookworm-x64-2023-10 | active |
| 18eeeba7-9fad-4b15-8d9b-678be2b67a88 | Debian-12.5-Bookworm-x64-2024-06 | active |
| f0580bb8-ff31-4bd4-818a-e5f45897bd1e | Fedora-39-1.5-x64-2023-11 | active |
| e9b7ef77-4d50-4d14-8094-44aa6d40ba83 | Fedora-40-1.14-x64-2024-06 | active |
| 4d533cb2-8179-4bc2-8c54-2e0f065b5137 | Rocky-8.10-x64-2024-06 | active |
| 90894672-707b-4103-8683-f06b9d5a6bd0 | Rocky-8.8-x64-2023-05 | active |
| cef2dcef-5c0d-40f3-9fde-b4d3a26ce8e1 | Rocky-8.9-x64-2023-11 | active |
| f95b59a2-99fd-4b7f-912c-d7f17640a791 | Rocky-9.3-x64-2023-11 | active |
| dcf29959-7404-4677-b24d-c25dfcef8da0 | Ubuntu-20.04.6-Focal-x64-2023-11 | active |
| 09222ea9-a2e2-405e-af14-1d5a59b6eab0 | Ubuntu-22.04.3-Jammy-x64-2023-11 | active |
| 9884ac0b-a05c-4327-b16a-104fabdf74cf | Ubuntu-22.04.4-Jammy-x64-2024-06 | active |
| 512331f0-b039-4e90-be2e-d79765a5b21a | Ubuntu-22.04.Jammy-x46-2023-07 | active |
| d812cc8a-caf9-4237-824c-0660d7654dc1 | Ubuntu-24.04-Noble-x64-2024-06 | active |
+--------------------------------------+----------------------------------+--------+
A return value looking like
$ openstack image list
The request you have made requires authentication. (HTTP 401) (Request-ID: req-5305b993-4c73-4a14-8596-a90bf64f293f)
Would normaly mean that there is a typo in you pasword, you can source the RC file again to correct your password.
