Managing the system via a command line interface (CLI) in the Linux OS

Warning

When working with a SIM-Cloud project through a command line interface, you must have set up:
  • Python interpreter version 3.х (installs manually; the means of installation varies with the OS used)
  • Python 3 installer from the pip3 modules (installs manually; the means of installation varies with the OS used)
  • утилиту openstackclient utility version 3.14
The setup process using the openstackclient utility consists of the following steps:

Obtaining the archives with the utility and accompanying libraries from the official website openstack.org, then decompressing and installing them

  • To install the openstack/cliff library and required dependencies, run the following set of commands:

    pip3 install wheel
    wget https://tarballs.openstack.org/cliff/cliff-2.11.1.tar.gz
    tar zxvf cliff-2.11.1.tar.gz
    pip3 install cliff-2.11.1/
    
  • To install the openstack/osc-lib library, run the following set of commands:

    wget https://tarballs.openstack.org/osc-lib/osc-lib-1.9.0.tar.gz
    tar zxvf osc-lib-1.9.0.tar.gz
    pip3 install  osc-lib-1.9.0/
    
  • To install the openstack/python-openstackclient utility, run the following set of commands:

    wget https://tarballs.openstack.org/python-openstackclient/python-openstackclient-3.14.2.tar.gz
    tar zxvf python-openstackclient-3.14.2.tar.gz
    pip3 install python-openstackclient-3.14.2/
    
  • To check that the utility has been installed and is running:

    openstack --version
        openstack 3.14.2
    

Authorisation in SIM-Cloud using the RC file

  • In order to use the openstack utility with your project you must obtain authorisation in SIM-Cloud. To set up the required operating system environment variables, a specially created RC file is used. To obtain this:

    1. Access your project via the web interface https://cloud.sim-cloud.net/.
    2. In the ‘Project menu’ - ‘Computing Resources’ - ‘Access API’, select ‘Download OpenStack RC file version 3’
    3. This should result in a file appearing on the local system from which the utility is launched with the name ‘project_name-openrc.sh’. In the present example this is ‘demo-openrc.sh’.

Note

When the variables are exported from the RC file, a one-time prompt will request the password for the cloud-based project. If you wish to suppress the password prompt and have it entered automatically, open the RC file with any text editor and change the following text block:
# 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

to

export OS_PASSWORD="YourPassword"

Warning

Since the RC file is an ordinary text file and your password will thus be available in an unencrypted form, this approach is not secure!
If you perform this step, you should set up minimum requirements rules in the system for its use.

Launching the openstack utility and obtaining general information about the project in SIM-Cloud

  • Open the bash console, change to the catalogue containing your RC file and with the aid of the ‘.’ (full stop) or ‘source’ command, export the variables from the RC file to the system environment.

    Execute the command:

    source demo-openrc.sh
    

    If necessary, enter your password for your project in the SIM-Cloud.

  • Check that the utility is functioning by checking the general information on your project in the SIM-Cloud:

$ openstack project list
+----------------------------------+------+
| ID                               | Name |
+----------------------------------+------+
| a84030ae422a4173b4d0e7495cda2581 | demo |
+----------------------------------+------+


$ openstack project show demo
+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description |                                  |
| domain_id   | b90911e0cc464e4d83c04bed2febc37a |
| enabled     | True                             |
| id          | a84030ae422a4173b4d0e7495cda2581 |
| is_domain   | False                            |
| name        | demo                             |
| parent_id   | b90911e0cc464e4d83c04bed2febc37a |
+-------------+----------------------------------+
  • Now you can manage your cloud project using the openstack command.