help-cfengine
[Top][All Lists]
Advanced

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

editfiles and iteration


From: Bobby Billingsley
Subject: editfiles and iteration
Date: Wed, 10 Sep 2003 22:39:02 +0200
User-agent: Mutt/1.3.27i

After a browse through the mail archives and the web docs I still can't
figure out how to go about this little puzzle.

I've got a (perl)script generating a bunch of groups/classes ang control
variables, amongs these is a list of NTP servers (which aren't the same for all
hosts).

What I'd like to be able to do is have some kind of editfiles stanza add/modify
lines in /etc/ntp.conf based on the list of IPnos. defined in the NTPservers
variable.

Currently my script is generating cfagent.conf entries similar to the following
example:

    # -- cfagent.conf 
    groups:
        HostGroupA = ( hostA hostB hostC )
        HostGroupB = ( hostD hostE hostF )

    control:
        HostGroupA::
                NTPservers = ( 1.2.3.4 2.3.4.5 3.4.5.6 )
        HostGroupB::
                NTPservers = ( 6.5.4.3 5.4.3.2 4.3.2.1 )


...what I'd like to do is add/modify entries in /etc/ntp.conf similar to these:

    # -- HostGroupA /etc/ntp.conf
    server 1.2.3.4 minpoll 4 maxpoll 7
    server 2.3.4.5 minpoll 4 maxpoll 7
    server 3.4.5.6 minpoll 4 maxpoll 7

and

    # -- HostGroupB /etc/ntp.conf
    server 6.5.4.3 minpoll 4 maxpoll 7
    server 5.4.3.2 minpoll 4 maxpoll 7
    server 4.3.2.1 minpoll 4 maxpoll 7

based on the NTPservers variable.

I'm sure that this isn't the only situation where one would like to do
something similar.

Any suggestions?

/bobby

-- -- -- -- -- -- -- Bobby Billingsley, General Specialist -- -- -- -- -- -- --
 ___    .--.- \   |                                 |                        _ 
`-,_`--'__/ x./_  | Remember to love while you dare | ASCII ribbon campaign ( )
//-_`--/    //\ \ | remember to live while you do   |  - against HTML email  X 
 \__/  `---' \__/ |                   -- Piet Hein  |              & vcards / \
                 Lat: 55° 40' 52" N Lon: 12° 32' 56" E 
     Anyone without a sense of humor is at the mercy of the rest of us :->




reply via email to

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