Skip to main content

Configure OpenStack CLI

You can configure the CLI console client:

Configure OpenStack CLI using the OS

  1. Install OpenStack CLI.

  2. Add a service user.

  3. Download the service user RC file for authentication in the OpenStack API.

  4. Configure authorization in the OpenStack API.

1. Install OpenStack CLI

  1. Open the CLI.

  2. Install Python 3 and virtualenv:

    sudo apt update
    sudo apt install python3 virtualenv
  3. Install pip3:

    sudo apt install python3-pip
  4. Create a virtual environment for working with OpenStack:

    virtualenv env
  5. Activate the virtual environment:

    source env/bin/activate
  6. Install OpenStack CLI in the virtual environment:

    pip3 install python-openstackclient
  7. Verify that OpenStack CLI is installed:

    openstack --version

    The OpenStack CLI version number will appear in the response. For example:

    openstack 6.1.0
  8. Optional: to work with cloud load balancers, install the Octavia component:

    pip3 install python-octaviaclient
  9. Optional: to work with cloud server images, install the Glance component:

    pip3 install python-glanceclient
  10. Optional: to work with file storages, install the Manila component:

    pip3 install python-manilaclient==3.4.0

2. Add a service user

To manage Cloud Platform resources in a project via the OpenStack API, add a service user with permissions in the Projects scope and the role:

If you need to grant the service user access only to specific resources (for example, network drives), assign the required role to the service user. Learn more about roles in the following instructions:

Users can be added by the Account Owner or users with the iam.admin role.

3. Download the RC file

To configure authorization, download the service user's RC file.

  1. In the Control panel, in the top menu, click IAM.

  2. Go to the Service users section.

  3. Open the page of the service user you added in step 2 → Access tab.

  4. In the RC files block:

    4.1. Select a project.

    4.2. Select a location.

    4.3. Click Download.

4. Configure authorization

For your information

OpenStack API authorization can be configured only for one account, service user, project, and pool. If you need to manage resources of another account, in another project or pool, or under another service user, change the authorization credentials.

  1. Open the CLI.

  2. Go to the directory containing the RC file you downloaded in step 3:

    cd <directory_name>

    Specify <directory_name> — the name of the directory containing the RC file.

  3. Apply the environment variables from the RC file:

    source <file_name>

    Specify <file_name> — the name of the RC file you downloaded in step 3. Default: rc.sh.

  4. Enter the OpenStack password — the password of the service user for whom you downloaded the RC file in step 3.

  5. Make sure OpenStack CLI works. 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 contain their list. If no servers have been created yet, the response will be an empty line.

Configure OpenStack CLI in a Docker container

  1. Install Docker.

  2. Add a service user.

  3. Download the RC file for OpenStack API authorization.

  4. Install OpenStack CLI in a Docker container.

1. Install Docker

To install Docker on a local computer, use the Install Docker instructions in the official Docker documentation.

2. Add a service user

To manage project resources via the OpenStack API, add a service user with permissions in the Projects scope and the role:

Users can be added by the Account Owner or users with the iam.admin role.

3. Download the RC file

For your information

OpenStack API authorization can be configured only for 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 credentials.

  1. In the Control panel, in the top menu, click IAM.

  2. Go to the Service users section.

  3. Open the page of the service user you added in step 2 → Access tab.

  4. 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

  1. Open the CLI.

  2. 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 Dockerfile created.

  3. Move the RC file to the directory:

    mv <file_name> <docker_directory>

    Specify:

    • <file_name> — the name of the RC file you downloaded in step 3. Default: rc.sh;
    • <docker_directory> — the name of the directory where the RC file will be added and Dockerfile created.
  4. Create an empty Dockerfile in this directory using the nano text editor:

    nano Dockerfile
  5. Add commands to the Dockerfile to install 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/2025.1 \
    git+https://github.com/openstack/python-glanceclient.git@stable/2025.1 \
    git+https://github.com/openstack/python-octaviaclient.git@stable/2025.1 \
    git+https://github.com/openstack/python-manilaclient.git@unmaintained/zed \
    git+https://github.com/openstack/osc-lib.git@stable/2025.1 \
    && apk del build-base linux-headers python3-dev libffi-dev openssl-dev git cargo iputils curl && rm -rf /var/cache

    CMD ["sh"]

    The current API versions of the components do not support all options of the specified CLIs.

  6. Exit the nano text editor saving the changes: press Ctrl+X, and then Y+Enter.

  7. Build the Docker container:

    docker build -t osc:dalmatian .
  8. Run the Docker container:

    docker run -ti --rm -v $(pwd):/workspace osc:dalmatian
  9. Go to the workspace directory:

    cd /workspace
  10. Apply the environment variables from the RC file:

    source <file_name>

    Specify <file_name> — the name of the RC file you downloaded in step 3. Default: rc.sh.

  11. Enter the OpenStack password — the password of the service user for whom you downloaded the RC file in step 3.

  12. Make sure OpenStack CLI works. 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 contain their list. If no servers have been created yet, the response will be an empty line.