hyzhang
2011-May-20 20:19 UTC
[Puppet Users] puppet code to find out which is the first active network interface
I have a piece of shell script as below: ACTIVE_INTERFACE=`/sbin/ifconfig | /bin/gawk '' /^eth/ { print $1 } '' | /usr/bin/head -1` How do I translate it to puppet code, for example to assign the result as a variable to use? Thanks, -Haiyan -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Daniel Pittman
2011-May-20 23:14 UTC
Re: [Puppet Users] puppet code to find out which is the first active network interface
On Fri, May 20, 2011 at 13:19, hyzhang <hyzhang@jcvi.org> wrote:> I have a piece of shell script as below: > > ACTIVE_INTERFACE=`/sbin/ifconfig | /bin/gawk '' /^eth/ { print $1 } '' > | /usr/bin/head -1` > > How do I translate it to puppet code, for example to assign the result > as a variable to use?You want to write a custom fact, for Facter. Normally you would distribute that as part of the pluginsync process, so it would be sent to the client by Puppet automatically, and available before your catalog was compiled. Regards, Daniel -- ⎋ Puppet Labs Developer – http://puppetlabs.com ✉ Daniel Pittman <daniel@puppetlabs.com> ✆ Contact me via gtalk, email, or phone: +1 (877) 575-9775 ♲ Made with 100 percent post-consumer electrons -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.