help-cfengine
[Top][All Lists]
Advanced

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

SUMMARY: action copy options


From: Sabrina Lautier
Subject: SUMMARY: action copy options
Date: Fri, 02 Aug 2002 18:32:41 +0200

Hi !

First of all, thanks a lot for all your answers.

Here is what I finally did to solve my pb:
- create a temporary directory (/tmp/hostnames)
- copy in it all hostname.* file from the cfengine
  server to the client
- in /etc remove hostname.* files wich does not exist 
  in /tmp/hostnames
- copy all hostname.* files from tmp/hostnames to /etc

This led me to the following cfengine script:
******************************************************
actionsequence = ( shellcommands.begin copy shellcommands.end )

copy:
  $(master_dir)  dest=/tmp/hostnames
                 r=1
                 include=hosname.*

shellcommands:
  begin::
    mkdir "/tmp/hostnames"

  end::
    "/bin/true; for file in `ls hostname.*`; do /bin/test ! -
f /tmp/hostnames/$file && rm $file; done"
    chdir=/etc

  "/bin/cp /tmp/hostnames/hostname.* /etc"

  "/bin/rm -Rf /tmp/hostnames"
******************************************************
The main pb is that we copy all $(master_dir)/hostname.* files 
in /tmp/hostnames whereas some might not need to be updated =>
this solution generates network trafic even if we don't need it.

Mark solution didn't fit our requirement:
> Then why not:
> include=tot include=tutu
> also?
because we wanted to delete hostname.* and leave everything else 
in /etc intact. Mark's solution would require a huge include list.

Ted's solution is fine:
> I would mirror to a separate directory, e.g. /etc/hostnames,
> and then do:
> "/bin/rm /etc/hostname.* ; /bin/cp /etc/hostnames/* /etc"
But as files /etc/hostname.* are very sensitive I couldn't remove all 
of them in /etc (what will happen if the server reboots just at that 
time ?)

Chris's solution is great:
> One way that springs to mind is to have an /etc/hostname
> directory and copy the hostname.* file there with the
> purge option set. Then use "links" and "files" to
> maintain symlinks:
> ===
> control:
>    actionsequence = ( copy links files )
> 
> copy:
>    <cfengine_root>/network  dest=/etc/hostname
>       r=1
>       include=hostname.*
>       purge=true
>       server=<server_name>
> 
> links:
>    /etc +> /etc/hostname
> 
> files:
>    /etc include=hostname.* recurse=1 links=tidy act=fixall
But we didn't want to create a "not regular" directory under /etc.

Thanks again all for your help.

Sabrina.

Quoting Sabrina Lautier <slautier@lavache.com>:
> ---------------- Beginning of the original message -----------------
-
> Hi !
> 
> I use cfengine 2.0.1 and can't find an easy solution to do
> what I 
> want...
> 
> I would like cfengine to copy files hostname.* from the server
> to the 
> directory /etc on the client side.
> But I also would like it to remove files which exist on the
> client 
> side but not on the server side.
> 
> Example:
> --------------------------------------------
> **Before running cfengine
> server side              client side
>   hostname.eri0            hostname.eri0
>                            hostname.qfe0
>                            toto
>                            tutu
> 
> **After having runned cfengine
> server side              client side
>   hostname.eri0            hostname.eri0
>                            toto
>                            tutu
> --------------------------------------------
> 
> I've tried the following with the purge option set to yes:
> --------------------------------------------
> copy:
>   <cfengine_root>/network  dest=/etc
>                            r=1
>                            include=hostname.*
>                            purge=true
>                            server=<server_name>
> --------------------------------------------
> 
> But this gives the following result:
> --------------------------------------------
> server side              client side
>   hostname.eri0            hostname.eri0
> --------------------------------------------
> It removes all files which are not hostname.eri0... the thing
> is that 
> I don't want files toto and tutu to be removed.
> 
> Is there an easy way to perform this ?
> 
> Any help will be greatly appreciated.
> 
> Regards,
> 
> Sabrina

---------------------------------------------
Powered by Alinto (http://www.alinto.net)
        for lavache.com (http://www.lavacheautomatique.com)



reply via email to

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