I’m using the OpenSource version of puppet, the system configuration engine to keep some Solaris systems in sync. For some modules, I wanted to know which zones are running on a given system. So I extended facter, puppet’s system fact collecting framework a bit.

This little patch adds a list of zones and a mapping for shared IP interfaces to their zones to the facts. Something like

root@global:~# /opt/bin/facter
...
interfaces => lo0,lo0_1,beaggr0,beaggr0_1,feaggr0,feaggr0_1
ipaddress => 0.20.72.116
ipaddress6 => ::
ipaddress_beaggr0 => 0.20.72.116
ipaddress_beaggr0_1 => 0.20.72.180
ipaddress_feaggr0 => 1.231.85.66
ipaddress_feaggr0_1 => 1.231.85.71
ipaddress_lo0 => 127.0.0.1
ipaddress_lo0_1 => 127.0.0.1
...
macaddress => 00:21:28:af:fd:06
macaddress_beaggr0 => 0:21:28:af:fd:6
macaddress_feaggr0 => 0:21:28:af:fd:7
...
netmask => 255.255.252.0
netmask_beaggr0 => 255.255.252.0
netmask_beaggr0_1 => 255.255.252.0
netmask_feaggr0 => 255.255.255.240
netmask_feaggr0_1 => 255.255.255.240
netmask_lo0 => 255.0.0.0
netmask_lo0_1 => 255.0.0.0
network_beaggr0 => 0.20.72.0
network_beaggr0_1 => 0.20.72.0
network_feaggr0 => 1.231.85.64
network_feaggr0_1 => 1.231.85.64
network_lo0 => 127.0.0.0
network_lo0_1 => 127.0.0.0
...
zone_beaggr0_1 => z004
zone_feaggr0_1 => z004
zone_lo0_1 => z004
zones => global, z003,z002,z001,z004

I don’t know if that’s useful for anybody else. But just in case;-)

Have fun,

— Marco