help-cfengine
[Top][All Lists]
Advanced

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

RE: Maintaing similar but not identical versions of files


From: Mark
Subject: RE: Maintaing similar but not identical versions of files
Date: Tue, 31 Aug 2004 18:15:20 -0700

I just found that cfagent does NOT copy the base file over again, even
though the local version of the file is different.
I thought initally that it copies the file over again as soon as it
differs... What does it use to determine when to copy a file over again and
when not? Timestamps?

Thanks,

MARK


> -----Original Message-----
> From: help-cfengine-bounces+msalists=gmx.net@gnu.org 
> [mailto:help-cfengine-bounces+msalists=gmx.net@gnu.org] On 
> Behalf Of Mark
> Sent: Tuesday, August 31, 2004 5:20 PM
> To: help-cfengine@gnu.org
> Subject: Maintaing similar but not identical versions of files
> 
> 
> Hi,
> 
> I have a file that I want to copy to a bunch of servers. The 
> file is the
> config file for the MySQL database (/etc/my.cnf).
> I want to make sure that it is on each server and that the 
> basic content is
> always the same, but some of the lines need to differ for 
> each server the
> file is on.
> Here is the content (abbreviated):
> 
> /etc/my.cnf on server "data1":
> ----------------------------------
> ## Common part start ##
> [mysqld]
> datadir=/var/lib/mysql
> socket=/var/lib/mysql/mysql.sock
> log=/var/log/mysql/mysqld.log
> log-error=/var/log/mysql/mysqld.err
> ## Common part end ##
> ## Specific part start ##
> master-host=data1
> replicate-do-db=1to2
> ## Specific part end ##
> ------------------------------------
> 
> /etc/my.cnf on server "data2":
> -----------------------------------
> ## Common part start ##
> [mysqld]
> datadir=/var/lib/mysql
> socket=/var/lib/mysql/mysql.sock
> log=/var/log/mysql/mysqld.log
> log-error=/var/log/mysql/mysqld.err
> ## Common part end ##
> ## Specific part start ##
> master-host=data2
> replicate-do-db=2to1
> ## Specific part end ##
> -------------------------------------
> 
> So what I figured I could do is the following:
> Copy the part of the file that is equal for all servers over using the
> "copy" action:
> 
> [mysqld]
> datadir=/var/lib/mysql
> socket=/var/lib/mysql/mysql.sock
> log=/var/log/mysql/mysqld.log
> log-error=/var/log/mysql/mysqld.err
> ## Specific part start ##
> ## Specific part end ##
> 
> Then use an "editfiles" action to remove everything between 
> the "## Specific
> part start ##" and "## Specific part end ##" and use 
> InsertLine to add the
> specific content for each server.
> 
> This will give me what I need.
> However, there are 2 things I do not like about it:
> 1. Since the basic file, which I copy over from the policy server, is
> different than the modified final file, it gets copied over 
> in each run,
> even though it does not need to be copied, unless the common 
> part changes.
> 
> 2. Since it takes some time (maybe only a few seconds if I'm 
> lucky, but
> still) from the step that copies over the base file to the 
> step that does
> the edit to get the final version of the config file, there is a short
> period in which the config file is incomplete and thus 
> unusable. If MySQL
> gets restarted just during this period, I will be missing part of the
> configuration, meaning I will most likely be in trouble... 
> 
> This is only one example for this general problem of files 
> that I need on
> several servers that are almost but not exactly identical on 
> the different
> machines. Is there a better way than the one I describe above?
> The only other thing I could think of is having one version 
> of the config
> file per machine on the policy server, but this means 
> redundancy and is not
> really scalable - so it is exactly the opposite of the cfengine
> philosophy... Except if I have a template mechanism that generates the
> various versions on the central host...
> 
> Thanks,
> 
> MARK
> 
> 
> 
> 
> _______________________________________________
> Help-cfengine mailing list
> Help-cfengine@gnu.org
> http://lists.gnu.org/mailman/listinfo/help-cfengine
> 





reply via email to

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