LTH-image
Anders Blomdell
Anders Blomdell
Research Engineer
anders.blomdell@control.lth.se
Phone: +46 46 222 46 25
Fax: +46 46 13 81 18

mio - Manage Installed Options

 

NEEDS UPDATING!!!

A small utility for handling what options should be installed on various machines. As we all know, rpm is a great way to package software, yum is a great way to handle interpackage relationships, but for the last finishing touch on the diverse configuration files of a Linux system, mio might be useful.

Mio relies on yum for installing rpms, and only adds handling of files, directories and symlinks.

Installing a Fedora package group

Assuming that you are running FedoraCore-2, and feels a sudden urge to add swedish language support to your machine, you only need to run:

mio --fedora http://download.fedora.redhat.com/pub/fedora/linux/core/2/i386/os/ --install @swedish-support

To find out what package groups are available, you can run:

mio --fedora http://download.fedora.redhat.com/pub/fedora/linux/core/2/i386/os/ --list

Customizing your systems

Just installing package groups is of course not much simpler than running the ordinary GUI's for updating, but suppose that you have a number of machines that should run smartd (Self-Monitoring, Analysis and Reporting Technology) , but your machines have different number of disks. If you use mio, you need to create the following files:

smart.mio Mio rules for smartd configuration
<?xml version="1.0" encoding="UTF-8"?>

<mio name="smart" files=".">
  <group name="tools">
    <rpm name="kernel-utils"/>
  </group>

  <group name="hd_a">
    <dependency name="tools"/>
    <file name="/etc/smartd.conf" source="smartd.conf_a"/>

  </group>
  <group name="hd_ab">
    <dependency name="tools"/>
    <file name="/etc/smartd.conf" source="smartd.conf_ab"/>

  </group>
</mio>
smartd.conf_a smartd configuration for machines with hda disk
# Send an email if SMART health status check fails
/dev/hda -H -m root@localhost.localdomain

smartd.conf_ab smartd configuration for machines with both hda and hdb disks
# Send an email if SMART health status check fails
/dev/hda -H -m root@localhost.localdomain
/dev/hdb -H -m root@localhost.localdomain

To install smartd for a Fedora-2 system with both hda and hdb disks, you just have to type:

mio --fedora http://download.fedora.redhat.com/pub/fedora/linux/core/2/i386/os/ --mio http://www.control.lth.se/user/andersb/software/mio/smart.mio /smartd/hd_ab

Running this command will make sure that the rpm kernel-utils (which contains smartd on Fedora-2 systems) is installed, and it will will copy the smartd.conf_ab to /etc/smartd.conf.

Managing many machines

The above seems to add a lot of complexity to an obviously simple task, and mio is intended for handling configurations for many machines in a centralized way. So a reasonable scenario would be that your site has a host.mio file that describes the setup for all your machines, and then run mio at regular intervals to keep configuration up to date.

host.mio Host specific rules
<?xml version="1.0" encoding="UTF-8"?>

<mio name="host" files=".">
  <group name="single_disk">
    <dependency name="/smart/hd_a"/>
  </group>

  <group name="dual_disk">
    <dependency name="/smart/hd_ab"/>
  </group>

  <group name="host1">

    <dependency name="dual_disk"/>
  </group>
  <group name="host2">
    <dependency name="dual_disk"/>

  </group>
  <group name="host3">
    <dependency name="single_disk"/>
  </group>
</mio>

Assuming that your host is one of host1 - host3, you can run the following command to update them:

mio --fedora http://download.fedora.redhat.com/pub/fedora/linux/core/2/i386/os/ --mio http://www.control.lth.se/user/andersb/software/mio/smart.mio /host/`hostname`

MIO file elements

mio Top level entity
dirmode Protection for directories
files Location of configuration files
group File and directory group owner
mode Protection for files
name Root name for groups in this file
owner File and directory owner
rpms Location of RPMs
scripts Location of scripts
group*
group Group entity
name Name of group (will be combined with mio name)
description dependency* dir* file* post* pre* rpm* symlink*
description Textual description of group contents
dependency Things that group depends on
name Full or relative name of dependency
exclude*
exclude Things to exclude from dependency
file File to exclude
rpm RPM to exclude
symlink Symlink to exclude
precommand Pre-command to exclude
postcommand Post-command to exclude
prescript Pre-scriptto exclude
postscript Post-script to exclude
rpm RPM neded by group
name Name of RPM
dir Directory neded by group
group Directory group owner
mode Directory protection
name Directory name
owner Directory owner
file File needed by group
group File group owner
mode File protection
name File name
owner File owner
symlink Symlink needed by group
group Symlink group owner
name Symlink name
owner Symlink owner
post Actions to perform after installing group
command Commands to execute
script Name of script to execute
pre Actions to perform before installing group
command Commands to execute
script Name of script to execute