If you want to manage your servers from the command line without dealing
directly with the API, you can use an open-source client application
Note: Rackspace doesn't maintain the
openstackclient, and it's not
guaranteed to operate with Rackspace Cloud.
python-openstackclient, you need to install Python® 2.7 or later on
your system. You can run the client from either a desktop machine or
a remote system, like a Cloud Server. You also need
pip, which is a
Python package manager.
To install the client, run the following command:
pip install python-openstackclient
Now that you've installed
openstackclient, set up the environment variables that
enable it to connect to your Rackspace Cloud account.
To set some environment variables, run the following command to open your
.bash_profile file for editing:
Then add the following lines in the data center section, changing values to
match your requirements. Pay particular attention to the username, password,
and tenant name or account number. You can find your account number
in the upper-right corner of the Cloud Control Panel
after you log in.
Use the following format:
OS_USERNAME=username OS_TENANT_NAME=accountnumber OS_AUTH_SYSTEM=rackspace OS_PASSWORD=password OS_AUTH_URL=https://identity.api.rackspacecloud.com/v2.0/ OS_REGION_NAME=DFW OS_NO_CACHE=1 export OS_USERNAME OS_TENANT_NAME OS_AUTH_SYSTEM OS_PASSWORD OS_AUTH_URL OS_REGION_NAME OS_NO_CACHE
After you've set the environment variables, save the file. Because
it includes a password, run the following command to set permissions on
the file so other people can't read it:
chmod 600 ~/.bash_profile
The following table lists explanations for each environment variable and
offers suggested values:
|Variable name||Value type||Description|
|OS_USERNAME||username||Set this value to your Rackspace Cloud account username.|
|OS_TENANT_NAME||account number||Set this value to your Rackspace Cloud account number, visible in the upper-right corner of the Cloud Contol Panel when logged in.|
|OS_AUTH_SYSTEM||rackspace||Set this value to |
|OS_PASSWORD||password||Set this value to your Rackspace Cloud account password.|
|OS_AUTH_URL||identity endpoint||Set this value to the endpoint for the Identity service the client uses to authenticate for API operations, |
|OS_REGION_NAME||data center region||The code for the data center region containing the servers you want to manipulate. You can check your server's data center by checking its details screen in the Cloud Control Panel. The data center code is just the first three letters of the datacenter's identifier, such as |
|OS_NO_CACHE||0 or 1||On newer versions of the Ubuntu® operating system the |
To apply these environment variables to your current shell, run the following
Next, run a quick query to make sure the
openstackclient is ready to go.
To see if you can talk to the API server, run the following command:
openstack image list
If the command is successful, the system displays a list of the images available
to you when creating a server.
If you run the client on the Ubuntu® operating system and it asks for a
keychain password, run the client with the
--no-cache option, as shown in
the following example:
openstack --no-cache image-list
Or you can set the environment variable
OS_NO_CACHE=1 as shown in
the preceding configuration sample.
You can get a full list of commands by using the following command:
Note: You can't to use every command listed. The
recent development versions of OpenStack®, so it includes support for
some features that Rackspace has not implemented in the Rackspace Cloud.
You can get more help for a subcommand by running the following command:
openstack help network
--debug flag to output both the full request from
and any responses from the Rackspace Cloud APIs. This information can help
when you file a bug report or open a support ticket.
A common problem is entering the username, tenant name, or password
incorrectly, so be sure to double-check those settings.
Remember that if you change any environment variables, you need to
either log out and log back in or tell your shell to reapply the
.bash_profile again by using the following command:
You can also use the options listed in the
openstack help output
to override some environment variable settings. If you're unsure about
the region, for example, you can substitute it with the
--os-region-name option as shown in the following example:
openstack --os-region-name ORD image list
openstackclient supports features in the Cloud Servers API but that the
Cloud Control Panel does not expose. For example, the following command creates
a server with the OpenStack Config Drive and user data for cloud-init:
openstack server create --image "Ubuntu 16.04 LTS (Xenial Xerus) (PVHVM)" --flavor general1-1 --config-drive=True --user-data=rack-ubuntu.yml openstack-server
Use the Feedback tab to make any comments or ask questions. You can also start a conversation with us.
Updated 26 days ago