Skip to content

Instantly share code, notes, and snippets.

@dougm
Created February 10, 2011 06:46
Show Gist options
  • Save dougm/820059 to your computer and use it in GitHub Desktop.
Save dougm/820059 to your computer and use it in GitHub Desktop.
knife_network_default_gateway.rb
#knife exec ...
seen = {}
search(:node, "roles:hudson_jobs").sort{|a,b| a.os<=>b.os}.each {|n|
os = n.sigar.platform.description
next if seen[os]
printf "%-20s %-12s %s\n", n.network[:default_gateway], n.network[:default_interface], os
seen[os] = true
}
__END__
10.136.251.125 en0 AIX 6.1
10.136.251.125 en0 AIX 5.3
10.16.16.1 en0 Mac OS X Server 10.6.5
10.16.16.1 en0 Mac OS X Server 10.5.8
10.136.251.125 em0 FreeBSD 8.0-RELEASE
10.136.251.125 lan0 HP-UX 11.31
10.136.251.125 lan0 HP-UX 11.23
10.136.31.253 eth0 Ubuntu 10.04 (lucid)
10.136.251.125 eth0 Debian 5.0.4
10.136.251.125 eth0 Ubuntu 9.10 (karmic)
10.136.251.125 eth0 Red Hat Enterprise Linux Server release 5.5 (Tikanga)
10.136.251.125 eth0 Fedora release 14 (Laughlin)
10.136.251.125 eth0 Arch Linux 2010.05
10.136.251.125 eth0 Red Hat Linux release 7.3 (Valhalla)
10.136.251.125 eth0 Centos 4.4
10.136.251.125 eth0 SUSE Linux Enterprise Server 11 (x86_64)
10.136.251.125 eth0 Scientific 5.5
192.86.33.3 eth0 Red Hat Enterprise Linux AS release 4 (Nahant Update 7)
10.136.251.125 eth0 Ubuntu 10.10 (maverick)
10.136.251.125 eth0 Red Hat Enterprise Linux AS release 4 (Nahant Update 5)
10.136.251.125 eth0 Red Hat Enterprise Linux Server release 6.0 Beta (Santiago)
10.136.251.125 eth0 Centos 5.5
10.136.251.125 wm0 NetBSD 5.1
10.136.251.125 vic0 OpenBSD 4.8 GENERIC#182
10.136.251.125 e1000g0 Solaris 9 Generic_117172-07
10.136.251.125 e1000g0 Solaris 10 Generic_139556-08
10.136.251.253 e1000g0:2 Solaris 8 Generic_Virtual
10.136.251.125 e1000g0 Solaris 10 Generic_137111-04
Microsoft Windows 2000 Server
10.136.251.125 0xA Microsoft® Windows Server® 2008 Standard without Hyper-V
10.136.251.125 0xA Microsoft® Windows Vista™ Ultimate
10.136.251.125 0x10003 Microsoft(R) Windows(R) Server 2003, Standard Edition
10.136.251.125 0xB Microsoft Windows 7 Professional
Microsoft Windows XP Professional
10.136.251.125 0x10003 Microsoft(R) Windows(R) Server 2003 Standard x64 Edition
@dougm
Copy link
Author

dougm commented Feb 10, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment