[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Running host IP
From: |
Mark . Burgess |
Subject: |
Re: Running host IP |
Date: |
Sat, 5 Apr 2003 14:46:29 +0200 (MEST) |
$(ipaddress) ??
M
On 5 Apr, Dennis, Richard wrote:
> Sorry, nevermind, I figured out how to get this done. I created a module
> "module:getLocalIP" to provide the local ip. I'm including it in this mail
> just in case someone else runs accross the same issue w/ their linux
> systems.
>
> --Rick
>
> #!/bin/sh
> # Module:getLocalIP
> # $Id$
> #
> IPADDR=`/sbin/ifconfig eth0 | awk '/inet addr/{print $2}' | sed 's/addr://'`
> echo "=MyIP="$IPADDR
>
>
> And then just put this in my config:
>
> editfiles:
> { /etc/hosts
> BeginGroupIfNoSuchLine "127.0.0.1 localhost.localdomain
> localhost"
> CommentLinesStarting "127.0.0.1"
> InsertLine "127.0.0.1 localhost.localdomain localhost"
> EndGroup
> BeginGroupIfNoSuchLine "$(MyIP) $(host)"
> CommentLinesStarting "$(MyIP)"
> InsertLine "$(MyIP) $(host)"
> EndGroup
> }
>
> -----Original Message-----
> From: Dennis, Richard
> Sent: Friday, April 04, 2003 4:33 PM
> To: 'help-cfengine@gnu.org'
> Subject: Running host IP
>
>
> Is there a variable or a simple way to get the ip of eth0 (or main
> interface) into a cfengine variable?
>
> Linux has issues when the hostname is put in the 127.0.0.1 line rather than
> it's real interface's ip and hostname. What I'm trying to do is comment out
> existing wrong 127.0.0.1 lines, and create a proper one.
>
> --Rick
>
> editfiles:
> { /etc/hosts
> BeginGroupIfNoSuchLine "127.0.0.1 localhost.localdomain
> localhost"
> CommentLinesStarting "127.0.0.1"
> InsertLine "127.0.0.1 localhost.localdomain localhost"
> InsertLine "$(some_variable) $(host)"
> EndGroup
> }
>
> ----------------------------------------------------------------------------
> --
> This message is intended only for the personal and confidential use of the
> designated recipient(s) named above. If you are not the intended recipient
> of this message you are hereby notified that any review, dissemination,
> distribution or copying of this message is strictly prohibited. This
> communication is for information purposes only and should not be regarded as
> an offer to sell or as a solicitation of an offer to buy any financial
> product, an official confirmation of any transaction, or as an official
> statement of Lehman Brothers. Email transmission cannot be guaranteed to be
> secure or error-free. Therefore, we do not represent that this information
> is complete or accurate and it should not be relied upon as such. All
> information is subject to change without notice.
>
>
>
>
> _______________________________________________
> Help-cfengine mailing list
> Help-cfengine@gnu.org
> http://mail.gnu.org/mailman/listinfo/help-cfengine
>
> ----------------------------------------------------------------------------
> --
> This message is intended only for the personal and confidential use of the
> designated recipient(s) named above. If you are not the intended recipient
> of this message you are hereby notified that any review, dissemination,
> distribution or copying of this message is strictly prohibited. This
> communication is for information purposes only and should not be regarded as
> an offer to sell or as a solicitation of an offer to buy any financial
> product, an official confirmation of any transaction, or as an official
> statement of Lehman Brothers. Email transmission cannot be guaranteed to be
> secure or error-free. Therefore, we do not represent that this information
> is complete or accurate and it should not be relied upon as such. All
> information is subject to change without notice.
>
>
> ------------------------------------------------------------------------------
> This message is intended only for the personal and confidential use of the
> designated recipient(s) named above. If you are not the intended recipient
> of this message you are hereby notified that any review, dissemination,
> distribution or copying of this message is strictly prohibited. This
> communication is for information purposes only and should not be regarded as
> an offer to sell or as a solicitation of an offer to buy any financial
> product, an official confirmation of any transaction, or as an official
> statement of Lehman Brothers. Email transmission cannot be guaranteed to be
> secure or error-free. Therefore, we do not represent that this information
> is complete or accurate and it should not be relied upon as such. All
> information is subject to change without notice.
>
>
>
>
> _______________________________________________
> Help-cfengine mailing list
> Help-cfengine@gnu.org
> http://mail.gnu.org/mailman/listinfo/help-cfengine
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Work: +47 22453272 Email: Mark.Burgess@iu.hio.no
Fax : +47 22453205 WWW : http://www.iu.hio.no/~mark
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~