help-cfengine
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Determine file to copy based on classes


From: Ted Zlatanov
Subject: Re: Determine file to copy based on classes
Date: Sun, 27 Oct 2002 08:05:47 -0500
User-agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.2 (i386-redhat-linux-gnu)

On Sat, 26 Oct 2002, kai.grossjohann@uni-duisburg.de wrote:
> The idea is that /your/repository/etc/foo is a directory which
> contains files named after classes.  For each host the right file is
> chosen and installed as /etc/foo.  Suggestions for improvements
> welcome.
[...]
> kai (why didn't I do it in Perl)

I think I've done something similar to what you describe using Perl.
The layout of the configuration file repository (starting with
$SPECROOT) was like this:

/$SPECROOT/default/passwd -> /etc/passwd for all classes

/$SPECROOT/solaris/inetd.conf -> /etc/inetd.conf for Solaris,

/$SPECROOT/xinetd/inetd.conf -> /etc/xinetd.conf for xinetd machines

/$SPECROOT/sigur/hostname.hme0 -> /etc/hostname.hme0 for machine "sigur"

/$SPECROOT/solaris/firewalled/net192.168/defaultrouter ->
/etc/defaultrouter for Solaris machines that are firewalled and in the
192.168 network

The administrator has to maintain the config file mapping, e.g.

inetd.conf is /etc/xinetd.conf on class xinetd, /etc/inetd.conf
otherwise

root-ssh-key is /home/root/.ssh/id_dsa_key on Redhat Linux,
/.ssh/id_dsa_key otherwise

The administrator's task is to flatten the configuration file names
into a single filename, so they will fit in the directory structure
above.  I think this simplifies things, so you don't have to keep
unnecessary subdirectories in your configuration repository.  Applying
CVS to a flat directory is much easier than doing it recursively,
grepping is easier, etc.

The Perl script had to figure out the best match for a machine, and
would then run scp to copy each source file to the remote target.
This was fairly simple with File::Find.  This system was layered on
top of cfengine for historical reasons, but it shouldn't be too hard
to integrate them.  

Hmm, maybe I can add something like this to cfperl :) Right now I'm
doing the user add/change/delete and group add/change/delete for
cfperl (it's almost finished), but if anyone is interested in this
configuration scheme let me know.

-- 
Teodor Zlatanov <tzz@iglou.com>
"Brevis oratio penetrat colos, longa potatio evacuat ciphos." -Rabelais





reply via email to

[Prev in Thread] Current Thread [Next in Thread]