help-cfengine
[Top][All Lists]
Advanced

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

Re: Suggestion for future release


From: Marco van Beek
Subject: Re: Suggestion for future release
Date: Sat, 11 Mar 2006 08:39:18 +0000
User-agent: Thunderbird 1.5 (Windows/20051201)

What I am doing at the moment is to have a subdirectory structure on the master based on the hostname. I then use a copy command to copy all of the /${configroot}/${hostname}/* files into a directory on the client called host, so I am basically using the copy command to not only select the right files (and only those files), but also to put them into the same place on every host (so the same file on different clients will contain different information).

The problem is then I have to write a small bash script to read in the relevant data into each and every cfengine variable I want to define.

So I have cracked getting the data easily onto each client, the problem is getting it easily into CFEngine.

Cheers,

Marco

Scott Lackey wrote:
The granular per-host configuration solutions are always difficult with cfengine. I don't know that this should be a part of cfengine, as doing host configs does not scale any easier than system administration without cfengine at all. I've been trying to up a system where groupfile data is stored in a database and pulled via cfengine at the time of execution in order to centralize group membership data and facilitate reporting, which really doesn't exist right now. If I have time to finish it, it might be useful in solving some of the problems of keeping up with individual host configurations.


On 3/8/06, *Marco van Beek* < address@hidden <mailto:address@hidden>> wrote:

    Hi Everyone,

    I have a suggestion for CFengine. It would be nice to be able to have a
    plain text config file with variables, which could be read by a client
    on a host by host, and/or class by class basis.

    The data would be read in by CFEngine (probably set in cfagent.conf) and
    would be available to all subsequent cf files being processed.

    I did something a while ago because I wanted to read the same data in
    Perl as PHP for a project I have been dabbling with.

    Anyway, an example config plus working Perl code is below. It would save
    me having to use complicated bash code to extract data from a plain
    text
    file. I have a config file per host which means I can define each boxes
    purpose outside of CFEngine, which makes it easier to maintain.

    Cheers,

    Marco


    ==============================================================
    EXAMPLE CONFIG FILE
    ==============================================================

    #######################################
    # Cross language config file for SSiS #
    #######################################
    # Comments are allowed    #
    # White space is allowed  #
    # syntax is 'key = value' #
    ###########################

    ...

    #########
    # MySQL #
    #########

    mysql_server = localhost
    mysql_datasource = dbi:mysql:ssis
    mysql_database = ssis
    mysql_username = ssis
    mysql_password = ssis
    mysql_palm_gluetable = PDA_Sync
    mysql_ldap_gluetable = LDAP_Sync

    ########
    # LDAP #
    ########

    ou = ou=SSiS
    dc = dc=supporting-role,dc=co,dc=uk
    ldap_bindas = uid=ssis,ou=People,dc=supporting-role,dc=co,dc=uk
    ldap_password = secret
    ldap_server = localhost
    ldap_port   = 389
    ldap_version = 3

    ===============================================================
    PERL CODE TO EXTRACT FROM CONFIG AND DUMP INTO ARRAY
    ================================================================
    my %settings;
    open(CONFIG,"/etc/ssis-config");
    while(<CONFIG>)
             {
             chomp;                  # no newline
             s/#.*//;                # no comments
             s/^\s+//;               # no leading whitespace
             s/\s+$//;               # no trailing whitespace
             next unless length;     # Anything left?
             my ($var, $value) = split(/\s*=\s*/,$_, 2);
             $settings{$var} = $value;
             }
    close CONFIG;

    my $mysql_datasource            = $settings{"mysql_datasource"};
    my $mysql_username              = $settings{"mysql_username"};
    my $mysql_password              = $settings{"mysql_password"};
    my $mysql_palm_gluetable        = $settings{"mysql_palm_gluetable"};
    my $public_user                 = $settings{"public_user"};
    my $Memo_user                   = $settings{"Memo_user"};
    my $ToDo_user                   = $settings{"ToDo_user"};
    my $Address_user                = $settings{"Address_user"};
    my $Datebook_user               = $settings{"Datebook_user"};
    ==================================================================


    _______________________________________________
    Help-cfengine mailing list
    address@hidden <mailto:address@hidden>
    http://lists.gnu.org/mailman/listinfo/help-cfengine




--
-Scott




reply via email to

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