Configure OpenStack CLI
You can configure the CLI console client:
Configure OpenStack CLI using the OS
1. Install OpenStack CLI
Ubuntu/Debian
CentOS
macOS
Windows
-
Open the CLI.
-
Install Python 3 and
virtualenv:sudo apt updatesudo apt install python3 virtualenv -
Install
pip3:sudo apt install python3-pip -
Create a virtual environment for working with OpenStack:
virtualenv env -
Activate the virtual environment:
source env/bin/activate -
Install OpenStack CLI in the virtual environment:
pip3 install python-openstackclient -
Verify that OpenStack CLI is installed:
openstack --versionThe OpenStack CLI version number will appear in the response. For example:
openstack 6.1.0 -
Optional: to work with cloud load balancers, install the Octavia component:
pip3 install python-octaviaclient -
Optional: to work with cloud server images, install the Glance component:
pip3 install python-glanceclient -
Optional: to work with file storages, install the Manila component:
pip3 install python-manilaclient==3.4.0
2. Add a service user
To manage project resources via OpenStack API, add a service user with access in the Projects scope and a role:
member;- or
reader.
Users can be added by the Account Owner or users with the iam.admin role.
3. Download the RC file
To configure authorization, you need to download the service user RC file.
-
In the control panel, on the top menu, click IAM.
-
Go to the Service users section.
-
Open the page of the service user you added in step 2 → Access tab.
-
In the RC files block:
4.1. Select a project.
4.2. Select a location.
4.3. Click Download.
4. Configure authorization
Authorization in OpenStack API can only be configured for one account, service user, project, and pool. If you need to manage resources of another account, in a different project or pool, or under a different service user, change authorization data.
Linux/macOS
Windows
-
Open the CLI.
-
Go to the directory containing the RC file you downloaded in step 3:
cd <directory_name>Specify
<directory_name>— the name of the directory with the RC file. -
Apply the environment variables from the RC file:
source <rcfile_name>Specify
<rcfile_name>— the name of the RC file you downloaded in step 3. Default isrc.sh. -
Enter the OpenStack password — the password of the service user for whom you downloaded the RC file in step 3.
-
Verify that OpenStack CLI is working. To do this, open the list of cloud servers:
openstack server listIf cloud servers are created in the pool and project specified in the RC file, they will be listed in the response. If no servers have been created yet, an empty line will be returned.
Configure OpenStack CLI in a Docker container
1. Install Docker
To install Docker on your local computer, use the Install Docker instructions in the official Docker documentation.
2. Add a service user
To manage project resources via OpenStack API, add a service user with access in the Projects scope and a role:
member;- or
reader.
Users can be added by the Account Owner or users with the iam.admin role.
3. Download the RC file
Authorization in OpenStack API can only be configured for one account, service user, project, and pool. If, after authorization, you need to manage resources of another account, in a different project or pool, or under a different service user, you can change authorization data.
-
In the control panel, on the top menu, click IAM.
-
Go to the Service users section.
-
Open the page of the service user you added in step 2 → Access tab.
-
In the RC files block:
4.1. Select a project.
4.2. Select a location.
4.3. Click Download.
4. Install OpenStack CLI in a Docker container
-
Open the CLI.
-
Create a directory for working with Docker:
mkdir <docker_directory>Specify
<docker_directory>— the name of the directory where the RC file will be added and the Dockerfile will be created. -
Move the RC file to the directory:
mv <rcfile_name> <docker_directory>Specify:
<rcfile_name>— the name of the RC file you downloaded in step 3. Default isrc.sh;<docker_directory>— the name of the directory where the RC file will be added and the Dockerfile will be created.
-
Create an empty Dockerfile in this directory using the
nanotext editor:nano Dockerfile -
Add commands for installing OpenStack CLI to the Dockerfile:
FROM alpine:3.17RUN apk add --update --no-cache python3 python3-dev libffi libffi-dev \git openssl openssl-dev cargo build-base iputils curl linux-headers \py3-pip py3-cffi py3-tz py3-pbr py3-setuptools && \pip3 install -UI git+https://github.com/openstack/python-openstackclient.git@stable/2024.2 \git+https://github.com/openstack/python-glanceclient.git@stable/2024.2 \git+https://github.com/openstack/python-octaviaclient.git@stable/2024.2 \git+https://github.com/openstack/python-manilaclient.git@unmaintained/zed \git+https://github.com/openstack/osc-lib.git@stable/2024.2 \&& apk del build-base linux-headers python3-dev libffi-dev openssl-dev git cargo iputils curl && rm -rf /var/cacheCMD ["sh"] -
Exit the
nanotext editor while saving changes: press Ctrl+X, then Y+Enter. -
Build the Docker container:
docker build -t osc:dalmatian . -
Run the Docker container:
docker run -ti --rm -v $(pwd):/workspace osc:dalmatian -
Go to the
workspacedirectory:cd /workspace -
Apply environment variables from the RC file:
source <rcfile_name>Specify
<rcfile_name>— the name of the RC file you downloaded in step 3. Default isrc.sh. -
Enter the OpenStack password — the password of the service user for whom you downloaded the RC file in step 3.
-
Verify that OpenStack CLI is working. To do this, open the list of cloud servers:
openstack server list
If cloud servers are created in the pool and project specified in the RC file, they will be listed in the response. If no servers have been created yet, an empty line will be returned.