next up previous
Next: Command line syntax Up: Configuration Previous: hosts.conf

objects.conf

This one defines all the objects that will be distributed using PICA, and depends on the current host. In general, one can include or generate dynamically parts of it, depending on evaluations of previously defined variables. The variables available at this time for the PPP will be:

  1. Variables defined in the hosts.conf ``defaults'' environment
  2. Variables defined in the objects.conf ``defaults'' environment
  3. Variables defined in any of the groups which the current host belongs to
  4. Variables defined in the current host

The latter, of course, have preference in case of multiple definition. We also can use the internal variable $picahost to get the name of the current host. Because of that, the possibilities explode here: we can write entire Perl scripts (or in other languages, as far as we call them from Perl) to dynamically generate out configuration files on the fly, depending on defined variables, the day of the week, or whathever condition we can imagine. And here resides the power of PICA.

The mandatory and optional attributes for the two types of objects are:

For any of these attributes we can define default values in the ``defaults'' environment (see example).

A simple objects.conf file could be:

## Default values
defaults {
      uid = 0;
      gid = 0;
      perms = 644;
      verbatim = 0;
      vars {
         globalvar1 = 'value1';
      }
}

file motd {
    path = '/etc/motd';
    source = 'Services/Info/motd';
}

##################################
# Configuration for Service: NTP #
##################################
group NTP {
    file ntp.conf {
       path = '/etc/ntp.conf';
       source = 'Services/NTP/ntp_conf.cfg';
    }
    file step-tickers {
       path = '/etc/ntp/step-tickers';
       source = 'Services/NTP/step-tickers.cfg';
    }
    ##
    ## Documentation for this Service
    ##
#if (ingroup('doc'))
    file README.ntp {
       path = '<#$docdir#>/Services/NTP/README';
       source = '<#$picasrc#>/Services/NTP/README';
    }
#fi
}

##################################
# Configuration for Service: DNS #
##################################
#if (ingroup('dnsservers'))
group DNS {
    file named.conf {
         path = '/etc/named.conf';
         source = 'Services/DNS/named_conf.cfg';
    }
    ##
    ## Documentation for this Service
    ##
#  if (ingroup('doc'))
    file README.dns {
       path = '<#$docdir#>/Services/DNS/README';
       source = 'Services/DNS/README';
    }
#  fi
#fi
}

## DNS check
alarm DNSChkUrgent {
    priority = 'Urgent';
    source = 'alarms/DNSChk';
    perms = '755';
    uses {
        file dnschk.conf {
            source = 'alarms/conf/dnschk.conf';
            path = '<#picaobj#>/conf/dnschk.conf';
        }
    }
}

We also have a defaults section that will be seen from any object, and we can also define variables that will only be seen by the object they are defined in.

Anytime PICA operates with an object, it will build a namespace containing all the variables seen by that object in the host it is working on. Of course, the most specific definition has precedence. That is, if we define a variable in an object, and that object belongs to a group where the same variable is also defined, the value used is the one given in the object definition. In addition to these variables, we always have available $picahost and $picaobject, which hold the current host and object we are processing.

As a side note, since pica 0.3.6, files that happen to be directories are copied recursively, but treated verbatim (that is, no preprocessing is done on any file).


next up previous
Next: Command line syntax Up: Configuration Previous: hosts.conf
Esteban Manchado Velázquez 2002-12-13