[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Running host IP
From: |
Dennis, Richard |
Subject: |
RE: Running host IP |
Date: |
Sat, 5 Apr 2003 06:58:11 -0500 |
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.