Hi all, I''m configuring bonding on my hosts. I have no problem on copying/modifying netwrok-scripts/ifcfg-*, but I have to add some lines to modprobe.conf and modify the primary interface in function of its ip. So, if host has an odd IP, primary interface must be eth1, if not, it must be eth0: Example: IP=192.168.1.10 options bonding mode=1 primary=eth0 miimon=100 IP=192.168.1.11 options bonding mode=1 primary=eth1 miimon=100 In bash, I have soemthing like: is_odd=$(( `echo $ipaddress|cut -d "." -f 4` % 2 )) but when I put it in puppet, it does not work: $primary_interface= (( `echo $ipaddress|cut -d "." -f 4` % 2 )) I suppose it''s for ", pipes and the double parentheses. anyone could help me to translate it to puppet languaje? Any doc for this kind of operations?¿ Cheers, Arnau --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On Fri, 28 Nov 2008 12:18:05 +0100 Arnau Bria wrote: I''ll do it using an external script. After reading : http://reductivelabs.com/trac/puppet/wiki/LanguageTutorial#variable-expressions I''ve seen I''m on version 0.24.5 not 0.24.6 so, I suppose I can''t do it yet. Cheers, Arnau --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Arnau, You won''t be able to do a shell escape like that even if you upgrade. You would have to do the calculations in Puppet. --Paul On Fri, Nov 28, 2008 at 6:55 AM, Arnau Bria <arnaubria@pic.es> wrote:> > On Fri, 28 Nov 2008 12:18:05 +0100 > Arnau Bria wrote: > > I''ll do it using an external script. > After reading : > http://reductivelabs.com/trac/puppet/wiki/LanguageTutorial#variable-expressions > I''ve seen I''m on version 0.24.5 not 0.24.6 so, I suppose I can''t do it > yet. > > Cheers, > Arnau > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hi On Nov 28, 11:18 am, Arnau Bria <arnaub...@pic.es> wrote:> So, if host has an odd IP, primary interface must be eth1, if not, it > must be eth0:You can write a custom fact to do it: Facter.add("primaryint") do setcode do ip = Facter.value(:ipaddress) int_number = ip.split(/\./).last.to_i % 2 "eth#{int_number}" end end [draytm01@gate ~]$ facter ipaddress 172.31.42.140 [draytm01@gate ~]$ facter primaryint eth0 Follow the instructions at http://reductivelabs.com/trac/puppet/wiki/AddingFacts to distribute facts to your clients. Cheers, Mark --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On Fri, Nov 28, 2008 at 9:33 PM, Mark Drayton <mdrayton@gmail.com> wrote:> > HiHi, [...] thanks you very much.> > Follow the instructions at > http://reductivelabs.com/trac/puppet/wiki/AddingFacts > to distribute facts to your clients.http://reductivelabs.com/trac/puppet/wiki/PluginsInModules> Cheers, > > MarkCheers, Arnau --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---