gg-tools


gg-tools is a set of CLI (command line interface) tools to control GoGrid cloud. It also provides a Python module with the interface to the GoGrid API. It has no additional dependencies but Python itself and should work with both CPython and Jython.

News

Version 0.2.0 released! Changes:

Download

Latest release: 0.2.0

Installation

After you've downloaded and upacked gg-tools, just go into its directory and execute:

sudo python setup.py install

It will install both CLI tools and Python module onto your system.

Configuration

All you need to do is to obtain your API key and password and put them in a file ~/.ggrc in a format:

     [default]
     apikey: your_api_key
     secret: your_secret
     

Usage

Server Images

In order to get a list of available images use gg-images-list tool. It doesn't require you to specify any arguments and is just as simple as that:

		
	     image rhel51_64_lamp (id = 21)
	     image rhel51_64_mysql (id = 22)
	     image rhel51_64_postgresql (id = 23)
	     image centos51_64_apache (id = 24)
	     image centos51_64_php (id = 25)
	     image centos51_64_lamp (id = 26)
     

By example of the first line: here rhel51_64_lamp is a name of the image and 21 is its numeric id. In all gg tools if you need specify some image, you can use both id or name, so remember id or a name of the image you're interested it.

Creating Servers

To create a server you can use gg-server-add tool. It accepts the following arguments:

Finding Out Credentials For Logging On To Servers

As you've created your server, you'd most certainly like to log into it. :-) You can use gg-password tool to list passwords for your servers. Typical output would look this way:

id             username             password               server
31830                 root             foobar1         192.168.0.1
31831                 root             barfoor1	 	192.168.0.2
     

A typical use would be like: gg-password | grep 192.168.0.1 so the grep tool leaves only server you're currently interested in.

Dealing With IP Addresses

gg-ip allows to obtain various information about IPs belonging to your account. Without specifying any arguments, gg-ip just print out all the IPs available. However, it supports various arguments which allow to perform some queries:

For example, if you want to list of all free (unassigned) public IPs, you should do:

gg-ip -t pu -s u

Removing servers

You can remove servers using gg-server-delete tool. You can remove it by id:

gg-server-delete -i 12345

Or you can remove it by name:

gg-server-delete -n myserv

And you can even remove a set of servers that match a regular expression:

gg-server-delete -rn 'foobar_*'

In regex mode, gg-server-delete asks confirmation before deleting servers to make sure you didn't make unexpected errors in regular expressions and don't removing something that doesn't need to be removed. However, you can pass -q key if it annoys you.

MyGSI

MyGSI allows to create custom server images. You can get more details on it here. The process of creating custom image with gg tools looks this way:

You need to create a new server which would serve as a basis for new image. You should use gg-server-add and pass all the arguments you usually pass to it and in addition pass -s argument which would make it a sandbox. Now, when you execute gg-server-list, each sandbox will be marked with > sign.

Once the server has provisioned, you can perform all the customizations you need. When done, execute /root/prep.py on the server and then on your own box execute:

gg-image-save -n my_new_image -s 12345 -d 'some cool image'

Where my_new_image is the name of your brand new image, 12345 is the id of the server you're using as a basis and -d is an optional switch for description of the image.

Now the new image should be available in gg-image-list and you can use it like any other usual image.

Multiple Config Profiles

As of version 0.2.0 gg tools support having multiple config profiles. Section 'Configuration' describes how to create 'default' section. You can follow this pattern and add additional sections, like e.g. myacc2 and when you will need to switch to myacc2 you will pass -p myacc2 args to the gg tool you need to use. It should not be hard to guess that section 'default' is used by default.

API Documentation

Python module Documentation

Source Code/Development

Project's github page: http://github.com/novel/gg/tree/master