To configure the OpenStack CLI
You can customize the CLI console client:
Configure OpenStack CLI using OS tools
1. Install the OpenStack CLI
Ubuntu/Debian
CentOS
macOS
Windows
-
Open the CLI.
-
Install Python 3 and
virtualenv:sudo apt update
sudo apt install python3 virtualenv -
Install
pip3:sudo apt install python3-pip -
Create a virtual environment to work with OpenStack:
virtualenv env -
Activate the virtual environment:
source env/bin/activate -
Install the OpenStack CLI in a virtualized environment:
pip3 install python-openstackclient -
Make sure that the OpenStack CLI is installed:
openstack --versionThe OpenStack CLI version number appears 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
-
Open the CLI.
-
Install Python 3,
virtualenv, andpip3:sudo dnf update -y
sudo dnf install python3 -y
sudo dnf install virtualenv -y
sudo dnf install python3-pip -y -
Install the OpenStack CLI in a virtualized environment:
pip3 install python-openstackclient -
Make sure that the 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
-
Open the CLI.
-
Install Python 3 and
pip3:brew install python3 -
Install
virtualenv:pip3 install virtualenv -
Install the OpenStack CLI in a virtualized environment:
brew install openstackclient -
Make sure that the OpenStack CLI is installed:
openstack --versionThe OpenStack CLI version number appears 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 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
-
Install Python, for example, version Python 3.12.0. During installation, check the Add python.exe to PATH checkbox.
-
Install Microsoft C++ Build Tools. During installation, in the Workloads section of the Desktop & Mobile block, check the Desktop development with C++ checkbox.
-
Open the CLI.
-
Install the OpenStack CLI:
pip3 install python-openstackclient -
Make sure that the OpenStack CLI is installed:
openstack --versionThe OpenStack CLI version number appears 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 through the OpenStack API, add a service user with permission in the Projects access area and role:
I'm a member;- or
reader.
Users can be added by the Account Owner or users with the role of iam_admin.
3. Download RC file
To set up authorization, you need to download the service user RC file.
-
In the control panel, on the top menu, click Account.
-
Go to the Service Users section.
-
Open the page of the service user you added in step 2 → Access tab.
-
RC files in the block:
4.1 Select a project.
4.2 Select a region.
4.3 Select a pool.
4.4. Click Download.
4. Set up authorization
Authorization in the OpenStack API can be configured for only 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 the authorization details.
Linux/macOS
Windows
-
Open the CLI.
-
Navigate to the directory with 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>is the name of the RC file you downloaded in step 3. The defaultis rc.sh. -
Enter the OpenStack password - the password for the service user for whom you downloaded the RC file in step 3.
-
Verify that the OpenStack CLI is running. To do this, open the list of cloud servers:
openstack server listIf cloud servers have been created in the pool and project specified in the RC file, the response will list them. If no servers have been created yet, the response will contain an empty string.
-
Open the CLI.
-
Add environment variables:
set OS_AUTH_URL=<url>
set OS_IDENTITY_API_VERSION=3
set OS_VOLUME_API_VERSION=3
set CLIFF_FIT_WIDTH=1
set OS_PROJECT_DOMAIN_NAME=<account_id>
set OS_PROJECT_ID=<project_id>
set OS_TENANT_ID=<project_id>
set OS_TENANT_NAME=<project_name>
set OS_REGION_NAME=<pool>
set OS_USER_DOMAIN_NAME=<account_id>
set OS_USERNAME=<user_name>
set OS_PASSWORD=<user_password>Specify:
<url>- address (URL) for authorization in the API. The URL depends on the region and pool, and can be viewed in the URL list;<account_id>- account number. You can look it up in control panel in the upper right corner;<project_id>- Project ID. Can be copied in control panel: in the top menu click Products and select Cloud Servers → open the projects menu (name of the current project) → in the project line, click ;<project_name>- project name. You can view it in control panel: in the top menu, click Products and select Cloud Servers → open the project menu (name of the current project) → copy the project name;<pool>- pool for exampleru-2. It will be possible to manage the project infrastructure only in this pool;<user_name>- the name of the service user you added in step 2;<user_password>- service user password. After creating a user, you cannot view the password - you can only generate a new one. More details in the subsection Change service user password instructions Change user data and role.
-
Verify that the OpenStack CLI is running. To do this, open the list of cloud servers:
openstack server listIf cloud servers have been created in the pool and project specified in the variables, the response will list them. If no servers have been created yet, the response will contain an empty string.
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 through the OpenStack API, add a service user with permission in the Projects access area and role:
I'm a member;- or
reader.
Users can be added by the Account Owner or users with the role of iam_admin.
3. Download RC file
Authorization in the OpenStack API can be configured for only one account, service user, project, and pool. If after authorization you need to manage resources of another account, in another project or pool, or under another service user, you can change the authorization data.
-
In the control panel, on the top menu, click Account.
-
Go to the Service Users section.
-
Open the page of the service user you added in step 2 → Access tab.
-
RC files in the block:
4.1 Select a project.
4.2 Select a region.
4.3 Select a pool.
4.4. Click Download.
4. Install OpenStack CLI in a Docker container
-
Open the CLI.
-
Create a directory to work 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>- name of the RC file you downloaded in step 3. The default is.rc.sh;<docker_directory>- 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 to the Dockerfile to install the OpenStack CLI:
FROM alpine:3.17
RUN 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/cache
CMD ["sh"] -
Exit the
nanotext editor with your changes saved: press Ctrl+X and then Y+Enter. -
Build a Docker container:
docker build -t osc:dalmatian . -
Start the Docker container:
docker run -ti --rm -v $(pwd):/workspace osc:dalmatian -
Navigate to the
workspacedirectory:cd /workspace -
Apply the environment variables from the RC file:
source <rcfile_name>Specify
<rcfile_name>is the name of the RC file you downloaded in step 3. The defaultis rc.sh. -
Enter the OpenStack password - the password for the service user for whom you downloaded the RC file in step 3.
-
Verify that the OpenStack CLI is running. To do this, open the list of cloud servers:
openstack server list
If cloud servers have been created in the pool and project specified in the RC file, the response will list them. If no servers have been created yet, the response will be empty.