help-cfengine
[Top][All Lists]
Advanced

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

Re: Variable for server argument in copy command?


From: Andrew Mayhew
Subject: Re: Variable for server argument in copy command?
Date: Mon, 6 Nov 2000 17:29:10 -0800
User-agent: Mutt/1.2.5i

I run a similar configuration with a centrally located master server
and a distribution machine in each colocation facility.  In my
situation I use a wrapper shell script that sets environment variables
before calling cfengine.  One of those variables is the name of the
local master server.  My shell script looks something like this:

-----
#!/bin/sh

HOSTNAME=`/usr/bin/hostname`
SHOSTNAME=`/usr/bin/hostname | cut -c1-3`
CFMASTER="${SHOSTNAME}-master"

if [ $HOSTNAME -eq $CFMASTER ]
then
        CFMASTER="cfmaster.home.location"
fi      

export CFMASTER
cfengine -f /usr/local/cfengine/cfengine.conf
-----
In our situation we've named the hosts with a three letter location id
followed by their function.  So a machine named- sjc-ht01 would be a
webserver in San Jose (sjc being the local airport designator).  The
local cfengine repository machine would be sjc-master.  If the machine
is the master in the location then it uses the central repository for
the copies.

The relative portions of the configs look something like:

control:
   cfd_master = ( "$(CFMASTER)" )

copy:
  apache::
        /master/production/configs/apache/httpd.conf
        dest=/usr/local/apache/httpd.conf
        server=$(cfd_master)
        ...

Hope that makes sense.  I've got a fairly extensive network of several
hundred machines in 12 locations, so bandwidth back to the master
repository is really precious.  If you are doing very large copies, I
would suggest actually using rsync over ssh to mirror the respository
to the colocation machines on a regular basis.  rsync copies are much
more efficiently handled than cfengine, particularly in large transfers.

--Andrew Mayhew <amayhew@icewire.com>

On Mon, Nov 06, 2000 at 02:38:23PM -0800, Geary Boedeker wrote:
> I'm having a conceptual mental block with my
> configuration; maybe someone has solved this already.
> 
> I have several small sites of Solaris boxes which I
> want to update/configure using cfengine. These sites
> are connected the headquarters with 1.5mbps T-1, or
> 1.0mbps DSL.
> 
> The model I'm building has 3 tiers. The "gold" system
> lives at headquarters. Each site has a "distribution"
> server that periodically contacts "gold" for updates.
> The clients at the site contact the local "distrib"
> server for updates, thereby minimizing WAN traffic.
> 
> I know how to make the client "figure out" what site
> it is at by setting a variable based on the IP address.
> 
> Problem:
> 
> All of the site configs are basically the same *except*
> for the hostname of the local "distrib" server. But
> because I can't seem to make the "server" argument of the
> "copy" command accept a variable, I'm stuck with having
> individual copy statements for each site - this doesn't scale
> well.
> 
> Ideally, I would like to have one "copy" statement, and
> merely *switch* the name of the server based on site.
> Has anyone done this? As always, am I missing something?
> 
> 
> Thanks in advance for your wisdom......Geary Boedeker
> 

Content-Description: Card for Geary Boedeker




reply via email to

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