Installation OpenStack CLI

Here we will guide you through the workflow for installing OpenStack CLI on Linux VM in Ventus Cloud Portal

Table of contents

  1. Prerequisites
  2. Install OpenStack CLI on Ubuntu VM 

  3. Install OpenStack CLI on Centos VM

Prerequisites

In this article, we will assume that we have already created the following resources, that refer to the Project named TestPr, which was created in the Organization named Test1:
  • API User, created with the following parameters and its RC file has already been loaded:
    • Name: testCLIuser;
    • Password: P@sword.

For more information, see the article -CLI Users

Install OpenStack CLI on Ubuntu VM 

    • Create and log in to your Ubuntu Virtual Machine on which you want to install OpenStack CLI (for more information see articles - Linux Virtual Machines and Connect to Linux VM via SSH);
    • Update Ubuntu package sources by running the following command:
      sudo apt update
    • Install Kubernetes Python Client by running the next command:
      sudo apt install python3-pip
    • Install openstack cli tool by running two next commands one by one: 
      sudo pip3 install python-openstackclient

      sudo pip3 install python-magnumclient

      sudo pip3 install python-octaviaclient
    • Place RC File of the created CLI User to your Virtual Machine:
      vi openrc

      Сheck that there were indicated the correct OS_USERNAME and  OS_PROJECT_ID and press  Esc:wq, then Enter to save the changes:

      #!/usr/bin/env bash

          # To use an OpenStack cloud you need to authenticate against the Identity

          # service named keystone, which returns a **Token** and **Service Catalog**.

          # The catalog contains the endpoints for all services the user/tenant has

          # access to - such as Compute, Image Service, Identity, Object Storage, Block

          # Storage, and Networking (code-named nova, glance, keystone, swift,

          # cinder, and neutron).

          #

          # *NOTE*: Using the 3 *Identity API* does not necessarily mean any other

          # OpenStack API is version 3. For example, your cloud provider may implement

          # Image API v1.1, Block Storage API v2, and Compute API v2.0. OS_AUTH_URL is

          # only for the Identity API served through keystone.

          export OS_AUTH_URL=https://upper-austria.ventuscloud.eu:443/v3

          # With the addition of Keystone we have standardized on the term **project**

          # as the entity that owns the resources.

          export OS_PROJECT_ID=681b1b8861fb45e899953da558f22f37

          export OS_PROJECT_NAME="Test1:TestPr"

          export OS_USER_DOMAIN_NAME="ventus"

          if [ -z "$OS_USER_DOMAIN_NAME" ]; then unset OS_USER_DOMAIN_NAME; fi

          export OS_PROJECT_DOMAIN_ID="e1780e7170674d5684076a726f683cfd"

          if [ -z "$OS_PROJECT_DOMAIN_ID" ]; then unset OS_PROJECT_DOMAIN_ID; fi

          # unset v2.0 items in case set

          unset OS_TENANT_ID

          unset OS_TENANT_NAME

          # In addition to the owning entity (tenant), OpenStack stores the entity

          # performing the action as the **user**.

          export OS_USERNAME="Test1:testCLIuser"

          # With Keystone you pass the keystone password.

          echo "Please enter your OpenStack Password for project $OS_PROJECT_NAME as user $OS_USERNAME: "

          read -sr OS_PASSWORD_INPUT

          export OS_PASSWORD=$OS_PASSWORD_INPUT

          # If your configuration has multiple regions, we set that information here.

          # OS_REGION_NAME is optional and only valid in certain environments.

          export OS_REGION_NAME="Upper-Austria"

          # Don't leave a blank variable, unset it if it was empty

          if [ -z "$OS_REGION_NAME" ]; then unset OS_REGION_NAME; fi

          export OS_INTERFACE=public

          export OS_IDENTITY_API_VERSION=3
    • Execute openrc starting with dot:
      . openrc
    • Provide the password of the created CLI User and hit Enter - this password will be used to authenticate you in the Cloud Console.
    • For testing that OpenStack CLI works, run the next command to get a list of all clusters created in the corresponding Project and to which your User has access:
      openstack coe cluster list

      In our case the output will be next:

      0cl-cli

    Install OpenStack CLI on Centos VM

      • Update Centos package sources by running the following command:
        sudo dnf update -y
      • Add the CentOS 7 RDO repository by using the following command:
        sudo yum install -y https://www.rdoproject.org/repos/rdo-release.rpm
      • Install openstack cli tool by running two next commands one by one: 
        sudo yum install python-openstackclient

        sudo yum install python-magnumclient

        sudo yum install python-octaviaclient
      • Place RC File of the created CLI User to your Virtual Machine:
        vi openrc

        Сheck that there were indicated the correct OS_USERNAME and  OS_PROJECT_ID and press  Esc:wq, then Enter to save the changes:

        #!/usr/bin/env bash

            # To use an OpenStack cloud you need to authenticate against the Identity

            # service named keystone, which returns a **Token** and **Service Catalog**.

            # The catalog contains the endpoints for all services the user/tenant has

            # access to - such as Compute, Image Service, Identity, Object Storage, Block

            # Storage, and Networking (code-named nova, glance, keystone, swift,

            # cinder, and neutron).

            #

            # *NOTE*: Using the 3 *Identity API* does not necessarily mean any other

            # OpenStack API is version 3. For example, your cloud provider may implement

            # Image API v1.1, Block Storage API v2, and Compute API v2.0. OS_AUTH_URL is

            # only for the Identity API served through keystone.

            export OS_AUTH_URL=https://upper-austria.ventuscloud.eu:443/v3

            # With the addition of Keystone we have standardized on the term **project**

            # as the entity that owns the resources.

            export OS_PROJECT_ID=681b1b8861fb45e899953da558f22f37

            export OS_PROJECT_NAME="Test1:TestPr"

            export OS_USER_DOMAIN_NAME="ventus"

            if [ -z "$OS_USER_DOMAIN_NAME" ]; then unset OS_USER_DOMAIN_NAME; fi

            export OS_PROJECT_DOMAIN_ID="e1780e7170674d5684076a726f683cfd"

            if [ -z "$OS_PROJECT_DOMAIN_ID" ]; then unset OS_PROJECT_DOMAIN_ID; fi

            # unset v2.0 items in case set

            unset OS_TENANT_ID

            unset OS_TENANT_NAME

            # In addition to the owning entity (tenant), OpenStack stores the entity

            # performing the action as the **user**.

            export OS_USERNAME="Test1:testCLIuser"

            # With Keystone you pass the keystone password.

            echo "Please enter your OpenStack Password for project $OS_PROJECT_NAME as user $OS_USERNAME: "

            read -sr OS_PASSWORD_INPUT

            export OS_PASSWORD=$OS_PASSWORD_INPUT

            # If your configuration has multiple regions, we set that information here.

            # OS_REGION_NAME is optional and only valid in certain environments.

            export OS_REGION_NAME="Upper-Austria"

            # Don't leave a blank variable, unset it if it was empty

            if [ -z "$OS_REGION_NAME" ]; then unset OS_REGION_NAME; fi

            export OS_INTERFACE=public

            export OS_IDENTITY_API_VERSION=3
      • Execute openrc starting with dot:
        . openrc
      • Provide the password of the created CLI User and hit Enter - this password will be used to authenticate you in the Cloud Console.
      • For testing that OpenStack CLI works, run the next command to get a list of all clusters created in the corresponding Project and to which your User has access:
        openstack coe cluster list

        In our case the output will be next:

        0cl-cli3