On 11/6/05, Mark Burgess <[EMAIL PROTECTED]> wrote:
> On Sun, 2005-11-06 at 12:55 -0500, Viraj Alankar wrote:
> > Hello,
> >
> > I have a certain task that I'd like to do but not sure what the best
> > way to do it with cfengine. Any advice appreciated.
> >
> > Let's say I want have a file /etc/httpd/conf.d/log_sql.conf that looks
> > like the following on a couple of servers:
> >
> > LoadModule log_sql_module modules/mod_log_sql.so
> > LoadModule log_sql_mysql_module modules/mod_log_sql_mysql.so
> > LogSQLLoginInfo mysql://my:[EMAIL PROTECTED]/apachelogs
> > LogSQLCreateTables on
> > LogSQLMassVirtualHosting On
> > LogSQLTransferLogFormat AabHhMmRrSsTUuv
> > LogSQLMachineID $(short_hostname)
> >
> > Now short_hostname should be replaced with a variable that I define:
> >
> > short_hostname = ( ExecResult(/bin/hostname -s) )
>
> As Brendan said, you don't need to do this. Use $(host) from cfagent.

> You don't have to copy by checksum, you can copy by date (the default),
> in which case there will be no problem with editing the file afterwards.
> In that case you example already looks fine.

Thanks, I see there are many ways to do this and decided on the copy
by date with an appropriate editfiles just for the needed line. That
seems the simplest. I also see that the EmptyEntireFilePlease option
would work.

Regarding short_hostname, on my system '/bin/hostname' returns the
FQDN. If I try using $(host), I just get the FQDN. Is that normal?
That's why I'm using my own variable.

> If the file contains $(macro) like instances already, you could simply
> ask cfagent to expand them using "ExpandVariables". Alernatively you
> could use a

I'm a little confused on how to use template files. Since the template
file is on a server, how do I get it part of the editfiles? I'm only
familiar with using 'server=' in copy:. Do I need to copy the file
over first? If so, how do I make sure to do that before an edit (and
if possible, to avoid worrying about this ordering)?

Viraj.


_______________________________________________
Help-cfengine mailing list
Help-cfengine@gnu.org
http://lists.gnu.org/mailman/listinfo/help-cfengine

Reply via email to