• Sales: 1-800-961-2888
  • Support: 1-800-961-4454

Using the OpenCenter CLI


NOTE: This documentation is for the Rackspace Private Cloud Software v. 3.0 with OpenCenter. Other v. 3.0 documentation can be found on the Archived Versions page. Documentation for the newest version of Rackspace Private Cloud Software can be found in the Getting Started section.

 

 


This chapter describes how to use the OpenCenter CLI to create an OpenCenter environment and an OpenStack Nova cluster within that environment.

Note: Rackspace recommends that you run OpenCenter behind a firewall, as it is not considered secure at this time.

OpenCenter Object Types

Before you begin, you should be generally familiar with the concepts and structure of OpenStack. You should also familiarize yourself with the object types in the OpenCenter framework.

Nodes

A node is any object that can be managed within the environment. It may be a container (such as a Nova cluster) or a server (such as a Chef server)

Facts

A fact is a property that can be inherited from a parent node. For example, if a node is placed within a Nova container, the node inherits the container's properties. These properties can include the Chef server that the container uses, the API server, and the nova configuration file information. Each node includes a fact that describes its parent, which determines what additional facts the node needs to inherit.

Attributes

Attributes are properties that are specific to a single node and are not inherited. These attributes are distinct and unique to the node, such as RAM or disk space.

Adventures

An adventure is a solution composed of multiple actions that run in sequence, created to manage common changes. For example, OpenCenter includes an adventure that installs Chef server. There are also adventures for rebooting a server, upgrading installation packages, and identifying out-of-date security patches.

Tasks

A task is an action directed at a specific node, assigned by the OpenCenter server to the OpenCenter agent that is installed on the node. Tasks are extensible via Python.

Filters

Filters are used to organize nodes by type. A filter is defined by facts; for example, you may create a filter that includes all nodes that have "Chef server" as a fact.

Initial Configuration

The device on which OpenCenter Server is installed and all OpenCenter-managed devices must have Ubuntu 12.04, CentOS 6.3, or RHEL 6.3 or 6.4 installed. The following instructions assume that you have a group of devices prepared with the correct operating system, complete with host names and IP addresses.

Your OpenCenter environment must have an OpenCenter server and have the OpenCenter agent installed on every node that will be managed by the server, and you must install the GUI component to manage the environment through the GUI. You must install the server first. Agent installations in the environment will ping the server and indicate that they are available for further configuration.

Instead of the ISO that was used in previous versions, installation is now performed via a curl command that launches an installation script. The script downloads the packages from packages.opencenter.rackspace.com and uses the packages to install the OpenCenter components.

OS Update

Before you begin, ensure that the OS is up to date on the devices. Log into each device and run the update for the OS and the package manager:

  • Ubuntu: apt-get update; apt-get upgrade
  • CentOS/RHEL: yum update

Install OpenCenter Server

Run the following curl command on the device that will become the OpenCenter server:

$ curl -s -L http://sh.opencenter.rackspace.com/install.sh | \
   sudo bash -s - --role=server

When the installation is complete, you will receive a confirmation message indicating that OpenCenter server has been installed correctly.

You will also receive a message notifying you of where you can find the default server admin user name and password, which you will use to log into the dashboard and set the endpoint environment variable in the CLI. If you need to change the username and password, you will also need to edit the agent endpoint with the new username and password.

The OpenCenter CLI requires a valid endpoint, which contains the authentication credentials and the host name and port of the OpenCenter server. This can be set in the OPENCENTER_ENDPOINT variable in your environment. You will need the admin username and password from the server installation. Run the following command:

$ export OPENCENTER_ENDPOINT=https://<admin>:<password>@localhost:8443

If you work with multiple OpenCenter environments, you may find it easier to specify the endpoint with the --endpoint option. For example:

$ opencentercli --endpoint \
OPENCENTER_ENDPOINT=https://<admin>:<password>@localhost:8443

 

If you change the admin username and password in the OpenCenter configuration file, you will need to reset your endpoint environment variable again.

At this time you can run the opencentercli node list command to view the current node configuration.

$ opencentercli node list
id |name          |task |adventure |attrs |facts             |
---|--------------|-----|----------|------|------------------|
1  |workspace     |None |None      |{...} |{u'backends':...  |
2  |unprovisioned |None |None      |{...} |{u'parent_id':... |
3  |support       |None |None      |{...} |{u'parent_id':... |
4  |oc-server     |None |None      |{...} |{u'parent_id':... |

By default, the OpenCenter server is created with four nodes:

  • workspace: The "master" parent container for the OpenCenter environment.
  • unprovisioned: The parent container for all nodes that have the OpenCenter agent installed, but that have not been assigned a role yet.
  • support: The parent container for all nodes that are used to maintain the OpenCenter environment infrastructure and for external resources. The Chef server is automatically assigned to the support node as soon as it is configured.
  • oc-server: In this example, this is the name of the OpenCenter server, which also counts as a node within the environment.

You will need the IP address of the OpenCenter server to proceed with the installation of the OpenCenter agent. This can be obtained with the ifconfig command.

Install OpenCenter Agent

Add the OpenCenter server URL to the configuration information for each server on which the OpenCenter agent will be installed.

Run the following curl command on each node that will be managed with OpenCenter:

$ curl -s -L http://sh.opencenter.rackspace.com/install.sh | \
   sudo bash -s - --role=agent --ip=<OpenCenter-server-IP>

When the installation is complete, you will receive a confirmation message indicating that OpenCenter agent has been installed correctly.

You will receive a message notifying you of the current agent endpoint settings, incorporating the username and password from the server installation. You will need to change these settings if you change the OpenCenter admin username and password.

Repeat this process on each server.

Verify Environment

After the agent has been installed on each managed server, run the opencentercli node list command on the OpenCenter server to view the OpenCenter environment. The newly configured nodes will appear in the list. The node names are the names that were assigned when you originally installed and configured the operating system on those nodes.

$ opencentercli node list
id |name          |task |adventure |attrs |facts             |
---|--------------|-----|----------|------|------------------|
1  |workspace     |None |None      |{...} |{u'backends': ... |
2  |unprovisioned |None |None      |{...} |{u'parent_id':... |
3  |support       |None |None      |{...} |{u'parent_id':... |
4  |oc-server     |None |None      |{...} |{u'parent_id':... |
5  |chef-server   |None |None      |{...} |{u'parent_id':... |
6  |controller    |None |None      |{...} |{u'parent_id':... |
7  |compute       |None |None      |{...} |{u'parent_id':... |

Deploy Environment

Once your OpenCenter environment is ready, you can configure the nodes within the environment.

Deploy Chef Server

The first node that you will configure is a Chef server, which is required to manage the OpenStack nodes. Do not configure more than one Chef server in your environment.

Before you begin, you can view a list of the adventures that are currently available on a node. Run opencentercli node adventure list against one of the unprovisioned nodes in your environment. In this example, the command is executed on the node 5, chef-server. Since the node is currently unprovisioned, only two adventures are available:

$ opencentercli node adventure list chef
Adventures that may be executed against node 5, chef-server:
id |criteria |name |
---|------------------------------|--------------------|
9 |('agent' in facts.backends) |Update Agent |
2 |('agent' in facts.backends... |Install Chef Server |

In this example, we're going to create a Chef server (adventure ID number 2) on node 5, chef-server The syntax for the command is:

opencentercli adventure execute <node_id_or_name> <adventure_id_or_name>

On the OpenCenter server, run the command.

$ opencentercli adventure execute 5 2

Or:

$ opencentercli adventure execute chef-server 'Install Chef Server'

NOTE: Any OpenCenter object that has a name attribute may be referred to by name or ID when using opencentercli. Names with spaces must be quoted. If a name matches multiple objects, an error will be displayed stating that in this case an ID must be specified to avoid ambiguity.

The node will now be configured with all the files necessary to run as a Chef server.

The Chef server installation will take about five minutes, and you can monitor the progress by logging into the node and using the tail -f command to monitor /var/log/opencenter/trans_N.log.

While the configuration is running, you can also use opencentercli task list on the OpenCenter server to view the current node status. The action adventurate and the status running indicate that an adventure is running on the node.

$ opencentercli task list
id |completed|expires|submitted |parent|state  |node       |action     |
---|---------|-------|----------|------|-------|-----------|-----------|
1  |None     |None   |1360344253|None  |running|chef-server|adventurate|
2  |None     |None   |1360344253 None  |running|chef-server|install_chef_server|

When the configuration is complete, you can view the new facts and attributes in the environment with opencentercli fact list and opencentercli attr list. In the following examples, the output has been truncated to display the facts and attributes relevant to the newly-configured Chef server.

$ opencentercli fact list
id |value                   |node         |key                           |
---|--------------------------------------|------------------------------|
12 |[u'node', u'agent', ... |chef-server  |backends                      |
13 |3                       |chef-server  |parent_id                     |
14 |admin                   |chef-server  |chef_server_client_name       |
15 |-----BEGIN RSA PRIV ... |chef-server  |chef_server_client_pem        |
16 |https://198.101.239.    |chef-server  |chef_server_uri               |
17 |-----BEGIN RSA PRIV ... |chef-server  |chef_server_pem               |
18 |current                 |chef-server  |chef_server_cookbook_channels |
19 |v2.9.5                  |chef-server  |chef_server_cookbook_version  |

$ opencentercli attr list
id |value                   |node         |key                           |
---|------------------------|-------------|------------------------------|
21 |True                    |chef-server  |converged                     |
22 |1361991837              |chef-server  |last_checkin                  |
23 |{u'run_chef': {u'co ... |chef-server  |opencenter_agent_actions      |
24 |[u'modules', u'chef ... |chef-server  |opencenter_agent_output_...   |
25 |ok                      |chef-server  |last_task                     |
26 |True                    |chef-server  |locked                        |

You can also view the Chef server management console in your browser at https://chef-server-ip-address. Most users will not need to use this feature, but in the event that you do, refer to the Opscode Chef Management Console documentation for more information about the management console.

Create a Nova Cluster

Once the Chef server is configured, the client installed on the nodes, and the cookbooks updated. you can now create a Nova cluster. The Nova cluster is created within the workspace node, which has an ID of 1. Use opencentercli adventure list to get the correct adventure number. In this example, the adventure ID number for creating a Nova cluster is 3. Run the following command on the OpenCenter server:

$ opencentercli adventure execute 1 3

When you execute this command, you will be prompted to enter the following network information about the Nova cluster:

  • The Nova public network in CIDR format.
  • The Nova public network interface (such as eth0).
  • The Nova VM network bridge (such as br100).
  • Optional NAT exclusion CIDR range or ranges for networks configured with a DMZ,
  • The name of the Nova cluster.
  • A password for an admin OpenStack user.
  • The libvirt virtualization type. The default is KVM.
  • Nova management network address in CIDR format.
  • The interface of the VM network for the Compute notes (such as eth1).
  • The name of the default availability zone.
  • The VM network CIDR range.
  • The Nova internal network CIDR range that you want to assign to each Controller and Compute node.

The system will offer default suggestions for each entry.

When the process is complete, run opencentercli node list. The node list now shows the Nova Custer, Infrastructure, Compute, and Availability Zone nodes.

$ opencentercli node list
id |name           |task |adventure |attrs |facts                 |
---|---------------|-----|----------|------|----------------------|
1  |workspace      |None |None      |{...} |{u'backends': ...     |
2  |unprovisioned  |None |None      |{...} |{u'parent_id': ...    |
3  |support        |None |None      |{...} |{u'parent_id': ...    |
4  |oc-server      |None |None      |{...} |{u'parent_id':...     |
5  |chef-server    |None |None      |{...} |{u'parent_id': ...    |
6  |controller     |None |None      |{...} |{u'parent_id': ...    |
7  |compute        |None |None      |{...} |{u'parent_id': ...    |
8  |Nova Cluster   |None |None      |{...} |{u'osops_public': ... |
9  |Infrastructure |None |None      |{...} |{u'osops_public': ... |
10 |Compute        |None |None      |{...} |{u'osops_public': ... |
11 |AZ nova        |None |None      |{...} |{u'osops_public': ... |

Create a Controller Node

You will now create a Controller node by moving an unprovisioned node to the Infrastructure container. The syntax for moving a node is: 

$ opencentercli node move <node_id_or_name> <container_node_id_or_name>

Moving a node into the infrastructure container triggers an adventure that changes the parent_id of the node and applies the single-controller role to the node.

Execute the following command:

$ opencentercli node move controller Infrastructure

The Controller installation can take up to 10-12 minutes. While it is running, you can check on the progress with the opencentercli task list command and look for the currently active tasks. The first will be install_chef. The second will be run_chef. To watch the logs for either task, run opencentercli task logs <id> where <id> is the number of the task. This will show the last 1024 bytes of the log. To retrieve the whole log, run opencentercli task logs <id> --offset=+0.

You can also monitor the progress by logging into the node and using the tail command to monitor /var/log/opencenter/trans_N.log.

When the process is complete, you can access controller via its IP address in your browser and view the OpenStack Horizon dashboard.

However, at this point, you have no Compute nodes.

Create a Compute Node

You will now create a Compute node by adding an unprovisioned node to the Compute container. By default, it will also be added to the default availability zone.

In this case, we're going to move compute (node ID 6) into the container AZ Nova with the node move command. Execute the following command:

$ opencentercli node move compute 'AZ nova' 

This command triggers an adventure that changes the parent_id of compute and applies the single-compute role to the node.

The Compute installation can take up to 5 minutes, and you can monitor the progress in the same way as you did for the Controller node.

You now have an OpenStack cluster consisting of one Controller node and one Compute node, and are now ready to create instances within the cluster. Refer to the Rackspace Private Cloud Software Getting Started Guide for more information on accessing and using your OpenStack cluster.

$ opencentercli node list
id |name           |task |adventure |attrs |facts                 |
---|---------------|-----|----------|------|----------------------|
1  |workspace      |None |None      |{...} |{u'backends': ...     |
2  |unprovisioned  |None |None      |{...} |{u'parent_id': ...    |
3  |support        |None |None      |{...} |{u'parent_id': ...    |
4  |oc-server      |None |None      |{...} |{u'parent_id': ...    |
5  |chef-server    |None |None      |{...} |{u'parent_id': ...    |
6  |controller     |None |None      |{...} |{u'parent_id': ...    |
7  |compute        |None |None      |{...} |{u'parent_id': ...    |
8  |Nova Cluster   |None |None      |{...} |{u'osops_public': ... |
9  |Infrastructure |None |None      |{...} |{u'osops_public': ... |
10 |Compute        |None |None      |{...} |{u'osops_public': ... |
11 |AZ nova        |None |None      |{...} |{u'osops_public': ... |

Upload Glance Images

To upload a set of disk images to Glance, use the Upload Initial Glance Images adventure. Run opencentercli node adventure list against the Controller node. In this example, the command is executed on the node 5, controller. The command shows that the following adventures are available:

$ opencentercli node adventure list controller
id |criteria                      |name                          |
---|------------------------------|------------------------------|
14 |(facts.nova_role = 'nova-c... |Upload Initial Glance Images |
2 |('agent' in facts.backends... |Install Chef Server |

To upload the Glance images, you will execute the adventure (14) on the Controller node. In this example, the Controller node's name is controller. You could also use the Controller node ID.

$ opencentercli adventure execute controller 14

Create an HA Controller Node

For High Availability, all you need to do is add another Controller node to the Infrastructure node. This is accomplished in the same way as the original Controller node was created.

In this example, another node has been added to the cluster called controller-2, which has an ID of 12:

id |name           |task |adventure |attrs |facts              |

---|---------------|-----|----------|------|-------------------|
1  |workspace      |None |None      |{...} |{u'backends':      |
2  |unprovisioned  |None |None      |{...} |{u'parent_id':     |
3  |support        |None |None      |{...} |{u'parent_id':     |
4  |chef-server    |None |None      |{...} |{u'chef_server_pem'|
5  |controller     |None |None      |{...} |{u'osops_public':  |
6  |compute        |None |None      |{...} |{u'osops_public':  |
7  |Nova Cluster   |None |None      |{...} |{u'osops_public':  |
8  |Infrastructure |None |None      |{...} |{u'osops_public':  |
9  |Compute        |None |None      |{...} |{u'osops_public':  |
10 |AZ nova        |None |None      |{...} |{u'osops_public':  |
11 |compute-2      |None |None      |{...} |{u'osops_public':  |
12 |controller-2   |None |None      |{...} |{u'osops_public':  |                                      
                      

This node will be turned into a Controller node by enabling HA on the infrastructure node and moving controller-2 into it.

First, you need to enable HA on the infrastructure container. In this example, the "Enable HA Infrastructure" adventure number is 4, and it will be run on the infrastructure node with an ID of 8.

$ opencentercli adventure execute 8 4

You will be prompted to enter three IP addresses which must be part of the Nova public network range: 

  • Nova API VIP: the failover that all OpenStack APIs will listen to
  • MySQL VIP: the failover IP that MySQL will listen to
  • RabbitMQ VIP: the failover ip that RabbitMQ will listen to

Once this process is complete, move controller-2 into Infrastructure. This command triggers an adventure that changes the parent_id of controller-2 and applies the appropriate HA roles to both nodes that have the infrastructure node as a parent.

Execute the following command:

$ opencentercli node move 'controller-2' Infrastructure 

The installation can take up to 10-12 minutes, and you can monitor the progress as you did with the original Controller node.

Command Line Help

The OpenCenter command line client includes online Help, which can be invoked with the --help flag.

The following example shows the results of the basic opencentercli --help command.

$ opencentercli --help 
usage: opencentercli [-h] [--debug] [--endpoint ENDPOINT]
{node,primitive,task,attr,adventure,fact} ...

OpenCenter CLI

positional arguments:
{node,primitive,task,attr,adventure,fact}
subcommands
adventure A predefined set of tasks for achieving a goal.
attr A non-inherritable attribute of a node
fact An inheritable property of a node
node An opencenter object, may represent a server or a
container for other nodes.
primitive A low level action that can be executed by OpenCenter
task An action that runs against a node

optional arguments:
-h, --help show this help message and exit
--debug Print debug information such as API requests
--endpoint ENDPOINT URL to opencenter endpoint. Should be of the form
http://host:8080 or https://user:pass@host:8443

The following example shows the arguments available for the opencentercli node command.

$ opencentercli node --help
usage: opencentercli node [-h] [--debug] [--endpoint ENDPOINT]

{show,create,move,list,update,filter,adventure,file,delete}
...

positional arguments:
{show,create,move,list,update,filter,adventure,file,delete}
Commands relating to node
adventure Adventure related commands for a node.
create Create a node
delete Delete a node
file list or retrieve files from a node that is running the
opencenter agent
filter list nodes that match filter-string. Example: id=4 or
name="workspace"
list List all nodes
move Move a node to a different container. This is an alias
for "fact create node parent_id new_parent". This
operation is not available if either the node to be
moved or current/destination container has the locked
attribute set.
show Show the properties of a node
update Modify a node

optional arguments:
-h, --help show this help message and exit
--debug Print debug information such as API requests
--endpoint ENDPOINT URL to opencenter endpoint. Should be of the form
http://host:8080 or https://user:pass@host:8443

The following example shows the arguments available for the opencentercli node create command.

$ opencentercli node create --help
usage: opencentercli node create [-h] [--debug] [--endpoint ENDPOINT] name

positional arguments:
name Name of the new node

optional arguments:
-h, --help show this help message and exit
--debug Print debug information such as API requests
--endpoint ENDPOINT URL to opencenter endpoint. Should be of the form
http://host:8080 or https://user:pass@host:8443






© 2011-2013 Rackspace US, Inc.

Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License


See license specifics and DISCLAIMER