[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: syncing files....
From: |
John Sechrest |
Subject: |
Re: syncing files.... |
Date: |
Mon, 09 Feb 2004 10:18:07 -0800 |
Earlier, I posted my script for determining packages on a per
host basis. And I was able to install packages with that script.
It has two parts:
The CFengine rules:
#################################################################
#
# cf.packages - for vnl
#
# Look for what debian style / apt-get based packages should be installed
#
#################################################################
control:
split = ( ${n} )
packagestohave = ( ReadFile(/var/mln/packagelist,4000) )
shellcommands:
any::
"/usr/bin/apt-get install ${packagestohave}"
###
#
# END cf.packages
#
###
this probably needs to be more robust
And the script for determining packages:
#!/usr/bin/perl
#
# 2004/01/24
# John Sechrest/ Kyrre Begnum
# sechrest@peak.org / kyrre.begnum@iu.hio.no
#
# module:getrolebyhost
#
# Given the file named: $file
# and a hostname called $host
# then find all of the roles that the host has
# and then print them out with a + in front
# Future OPTION: if there is a conflict between roles, put roles
# that are in conflict up with a -...
# The file is of the form:
# ID machine host role featurelist
# as a tab seperated file
# Like:
# 3 rex host1 web
# 4 rex host2 dns
$debug=0;
# Get the filename and hostname out of the parameters
# They should be in ArgV
# assume that $ARGV[0] = filename;
# and that $ARGV[1] = hostname;
if ($debug) {print "#Argv: $#ARGV\n";}
if ($#ARGV != 1) {
print "MODULE ERROR: Arguments to getrolebyhost must be: filename
hostname\n";
exit(1);
}
$filename=$ARGV[0];
$hostname=$ARGV[1];
#Open the file
if ($debug) {print "Filename: $filename\n";}
if ($debug) {print "hostname: $hostname\n";}
open (MYFILE , "< $filename") or die"Module ERROR: Could Not open $filename\n" ;
# For each line in the file
while ( $line=<MYFILE> ){
if ($debug) {print "line: $line\n";}
$line=~s/#.*$//; # Delete any comments
if ($debug) {print "line w/o #: $line\n";}
($id,$machine,$host,$role,$featurelist) = split /\t+/, $line;
if ($debug) {print "host: $host\n";}
if ($debug) {print "hostname: $hostname\n";}
# if it is for host $host, then get the role
# write out +role
if ( $host eq $hostname ){
print "+$role\n";
}
# end
}
# close file
close MYFILE;
John Gray <gray@agora-net.com> writes:
% Nate Campi wrote:
%
% >On Mon, Feb 09, 2004 at 10:14:10AM +0100, Thomas Glanzmann wrote:
% >
% >
% >>Hi,
% >>
% >>
% >>
% >>>And note that some packages will not install correctly as long as
% >>>cfagent doesn't have a console, for example proftpd and emacs.
% >>>Unfortunately, some installs use < /dev/tty, sigh. Oh, and some
% >>>packages still use shell read,
% >>>
% >>>
% >>I know only about one package that ends up in a endless loop when
% >>pressing all the time return (it's gpm) and gpm is broken anyway.
% >>
% >>But in order to install such packet you can add a divertation (look at
% >>FAI).
% >>
% >>
% >
% >Does anyone actually have working debian package management examples for
% >cfengine? It would be nice to have something to start with.
% >
% >
% Other than Will's script? Or do you mean sample package lists? I'd be
% interested in seeing see sample package lists.
%
% We are modifing Will's script to be cfengine class oriented right now.
% Just a couple of minor changes and we'll having looking for packages
% according to classes instead according to its farm as the script does now.
%
% John
%
% --
% John Gray gray@agora-net.com
% AgoraNet, Inc. (302) 224-2475
% 102 E. Main Street, Suite 303 (302) 224-2552 (fax)
% Newark, De 19711 http://www.agora-net.com
%
%
%
% _______________________________________________
% Help-cfengine mailing list
% Help-cfengine@gnu.org
% http://mail.gnu.org/mailman/listinfo/help-cfengine
-----
John Sechrest . Helping people use
. computers and the Internet
. more effectively
.
. Internet: sechrest@peak.org
.
. http://www.peak.org/~sechrest
- Re: syncing files...., (continued)
- Re: syncing files...., John Sechrest, 2004/02/06
- Re: syncing files...., Nate Campi, 2004/02/06
- Re: syncing files...., John Gray, 2004/02/06
- Re: syncing files...., Frank Smith, 2004/02/06
- Re: syncing files...., Will Lowe, 2004/02/06
- Re: syncing files...., John Gray, 2004/02/07
- Re: syncing files...., Adrian Phillips, 2004/02/09
- Re: syncing files...., Thomas Glanzmann, 2004/02/09
- Re: syncing files...., Nate Campi, 2004/02/09
- Re: syncing files...., John Gray, 2004/02/09
- Re: syncing files....,
John Sechrest <=
- Re: syncing files...., Erik Hjelmås, 2004/02/09
- Re: syncing files...., Will Lowe, 2004/02/09
- Re: syncing files...., John Gray, 2004/02/09
- Re: syncing files...., Adrian Phillips, 2004/02/10
- Re: syncing files...., John Sechrest, 2004/02/06