How to Set Up a CLI Client for an OpenNebula Frontend

Solution Verified in:

  • OpenNebula: 5.10

Issue

This step-by-step tutorial will help users to easily set up the OpenNebula cli utilities on a machine that is not the OpenNebula frontend. The Goal is to be able to control the OpenNebula daemon remotely.

Requirements

The machine needs access to the server ports where oned and oneflow are running, by default, 2633 and 2474.

Solution

Step 1: CLI Utilities Installation

You need to install the required dependencies. Make sure you are using the OpenNebula repositories, then proceed to install:

  # On Debian/Ubuntu
  apt install opennebula-tools
  # On Centos
  yum install opennebula

Alternatively install the gem opennebula-cli

Step 2: Environment Configuration

Create the authentication file AKA one_auth with the user credentials you will use. We will use oneadmin as example

  mkdir -p "$HOME/.one"
  echo 'oneadmin:password' > "$HOME/.one/one_auth"

Assuming the frontend hostname is frontend and oned running on port 2633

  export ONE_XMLRPC="http://frontend:2633/RPC2"
  export ONE_AUTH="$HOME/.one_auth"

Not setting the environment variables will cause the cli utilities to fallback to the default values for the authentication file and the server address. In this example the environment variable has the default location for the authentication file, therefore no need to export it, but the ONE_XMLRPC defaults to localhost which is not where oned is running.

  echo 'export ONE_XMLRPC="http://frontend:2633/RPC2"' >>
  ~/.bashrc

Step 3: Environment Configuration for oneflow

Frontend Configuration

By default, oneflows listens only on the frontend localhost, you need to edit /etc/one/oneflow-server.conf and update:

  # Host and port where OneFlow server will run
  :host: 127.0.0.1

with the frontend hostname. Then proceed to restart oneflow systemctl restart opennebula-flow

In this case you only need to add the following:

 export ONEFLOW_URL="http://frontend:2474"

The flow commands will fallback to the one_auth default file location for authentication, however you can also set the environment variables ONEFLOW_URL, ONEFLOW_USER and ONEFLOW_PASSWORD for greater customization. The flow endpoint will also default to localhost, therefore you need to set this variable.

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.