Next Previous Contents

3. Creating Rulesets

Rulesets are a fundimental concept for Rover development. This section describes what rulesets are, how to create them, and how to use and reuse them.

3.1 What is a Ruleset?

Rover executes commands in groups called a Ruleset. Each ruleset consists of actions to be taken against a remote machine. These rulests are then configured to be ran against an operating system type (OS).

For example, we create a ruleset call "Unix_Uptime" that executes the uptime command on a UNIX machine. We can then specify to run the ruleset on all OS types, or we can chose to run it only on Linux, AIX, SunOS, and HP-UX machines.

The contents of a ruleset are really function calls using Perl syntax. The functions used are called ruleset commands, which are specifically imported in order to perform specialized tasks. The most common is the command execute(). Here is an example of a ruleset definition using the execute() command:

Unix_Uptime:{
execute(uptime);
};

3.2 Available Commands

Ruleset commands are imported to Rover using modules. Rover ships with several modules which supply everything you'll probably ever need. Here are the supplied modules and the commands they provide:

Run_Commands: Execute and send commands

File_Transfer: Transfer files to and from remote machine

User_Admin: User administration commands

Password: Run passwd command as a normal user

3.3 Creating Rulesets

As an example, we are going to create a ruleset called "Unix_Uptime". This ruleset will simply execute the command "uptime" on a remote machine. We will be creating The command two ways, first using the command line script "rover", then using "rovergtk".

Command Line

From the command line, we can create rulesets using the interactive shell of "rover". Issue the following command in order to enter the shell:
$ rover -s
Once in the shell you can type help for a list of available commands. Next, create the ruleset "Unix_Uptime" using the following syntax:
rover> new Unix_Uptime
This will launch a VI session where we can edit the ruleset. Enter into insert mode (press "i") and type the following:
execute(uptime);
Save the ruleset as you would normally save a file in vi (escape, then ZZ or :wq).

You have just created a ruleset that will run the command "uptime" on remote machines. However, this ruleset will not be available the next time you run rover unless you save it to your Rover config. Do that by using the "save" command within the shell:
rover> save
rover> exit

Graphical Interface

Launch the graphical interface by typing "rovergtk" at the command line. Follow normal procedures for setting your DISPLAY variable, if applicable.

In order to launch the ruleset configuration window, select Config from the main menu, then Rulesets. The following window will appear:


Within this window we can create a new ruleset, save it, and modify existing rulesets. At the top of the display is a "Ruleset Name" text entry. This is where you define the ruleset name. Left center is a listing of all the modlules and their exported commands. Right center is the text area for editing the current ruleset.

The bottom row of buttons allows you to load an existing ruleset, save a ruleset in the working configuration, delete a ruleset, and start over with a new ruleset.

For this example, we want to type "Unix_Uptime" in the Ruleset Name entry box. Then highlight the "execute" command from the left window and click the "Append" button. A new window will appear, type "uptime" in the text box, then press Ok.

Your window should now look like this:


Press the "Save" button on the bottom row and close the ruleset window. The final step is to save the working configuration by selecting File, Save from the main menu.

3.4 Using Rulesets

Once a ruleset is created and saved, it is used by assigning it an OS type. Available OS types are as follows:

ALL UNKNOWN Linux AIX SunOS HP_UX FreeBSD OpenBSD Windows
Using the command line, you can enter an interactive shell to modify the runlist. Alternatively you can use the command line switch "-r|--ruleset <name>" to specify a ruleset be ran on all OS types. See "man rover" for more details.

Here is an example of using the shell to modify what rulesets will be ran on Linux machines.
rover> runmod Linux
Change runlist for Linux:

Chose one or more of the following rulesets, enter blank line to finish
Unix_Uptime

Linux> Unix_Uptime
Linux>

rover>
For the graphical user interface, you can add a ruleset to an OS by selecting the ruleset, checking the OS or OS's you wish to run that on, and clicking the "Add" button.


The above image is the main screen for rovergtk. The left half of the window is devoted to configuring the runlist. In this example, we have already configured the Linux OS to run the Unix_Uptime ruleset (bottom window).

We have also highlighted the Unix_Uptime ruleset in the Ruleset window (top), and checked the AIX, SunOS, and HP_UX operating systems in the target OS window (middle). If we were to then click on the "Add" button under the Target OS's, we would assign the Unix_Uptime ruleset to those OS types as well.
Next Previous Contents