help-cfengine
[Top][All Lists]
Advanced

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

Re: editfiles template; multiple edits; setting a class on update


From: Atom Powers
Subject: Re: editfiles template; multiple edits; setting a class on update
Date: Fri, 13 Jan 2006 14:58:01 -0800

I looked at your wiki docs.
How do you enforce your editfiles action without changing the RCS
version? Correct me if I'm wrong, but it looks like your editfiles
block won't begin unless your template has changed.

On 1/13/06, Adams, Russell L. <RLAdams@kelsey-seybold.com> wrote:
> I use my editfiles functions (ReplacementEdit and BlockEdit) for
> exactly this.
>
> I have an editfiles statement that rewrites the entire file
> (ReplacementEdit) if a new version is present, and then multiple
> BlockEdits that see if their block is current or missing and adds them
> if thats the case.
>
> Then of course I trigger a restart if the file was edited.
>
> See:
>
> http://cfwiki.org/cfwiki/index.php/Editfiles_Examples
> http://cfwiki.org/cfwiki/index.php/Managing_Blocks_of_Code_with_Editfiles
>
> I've m4 macroed these and the version numbering, so if I update the m4
> file the version number is updated which forces the file to be
> rewritten entirely, and defines additional classes for me to trigger
> events with.
>
> I could provide some code examples, etc, if you like.
>
> Russell
>
> On Fri, Jan 13, 2006 at 09:23:15AM -0800, Atom Powers wrote:
> > I have a situation, many of them in fact, where I want to create a
> > template file, make multiple edits to it, and then restart a service
> > if the destination file is updated. How can I manage my editfiles
> > without restarting the service every time cfengine runs?
> >
> > I could do my editfiles on "$(FileSource)/common/etc/inetd.conf"; but
> > then that file would be copied from the masterfiles server every time
> > cfengine runs.
> >
> > How have you solved this problem?
> >
> > For example:
> > I have a default inetd.conf file, with sshd in it.
> > --
> > copy::
> >       $(FileSource)/common/etc/inetd.conf
> >       dest=/etc/inetd.conf
> >       mode=664        owner=root      group=wheel
> > --
> > Some hosts run ftp, others run nntp:
> > --
> > editfiles:
> >   ftp-server::
> >       {  /etc/inetd.conf
> >       AppendIfNoSuchLine "ftp    stream  tcp nowait  root
> > /usr/libexec/ftpd   ftpd -l"
> >        DefineClasses "newinetd"
> >        }
> >
> >   nntp-server::
> >       {  /etc/inetd.conf
> >       AppendIfNoSuchLine "nntp   stream  tcp     nowait  news
> > /usr/local/libexec/nntpd        nntpd"
> >        DefineClasses "newinetd"
> >        }
> > --
> > Then I restart inetd if the config file changed:
> > --
> > shellcommands:
> >   newinetd::
> >     "/etc/rc.d/inetd restart"
> > --
> >
> > This will modify inetd.conf, and thus restart inetd, every time.
> >
> >
> > --
> > --
> > Perfection is just a word I use occasionally with mustard.
> > --Atom Powers--
> >
> >
> > _______________________________________________
> > Help-cfengine mailing list
> > Help-cfengine@gnu.org
> > http://lists.gnu.org/mailman/listinfo/help-cfengine
>
>
> _______________________________________________
> Help-cfengine mailing list
> Help-cfengine@gnu.org
> http://lists.gnu.org/mailman/listinfo/help-cfengine
>


--
--
Perfection is just a word I use occasionally with mustard.
--Atom Powers--




reply via email to

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