I had the same problem some time ago. Solution is to replace ifconfig (that is what facter uses to fetch information abount interfaces) with a custom wrapper that simply hides most interfaces. First, you need to move original ifconfig out of original position:
dpkg-divert --local --divert /sbin/ifconfig.orig --rename /sbin/ifconfig
Then, create a shell wrapper in /sbin/ifconfig with contents:
#!/bin/bash
OK=no
CUR=0
while [ $# -gt 0 ]; do
case "$1" in
-a|-v|-s)
OPTS[$CUR]="$1"
CUR=$((CUR+1))
;;
*)
OPTS[$CUR]="$1"
CUR=$((CUR+1))
OK=yes
;;
esac
shift || break
done
if [ $OK = yes ]; then
exec /sbin/ifconfig.orig "${OPTS[@]}"
else
for IFACE in lo eth0; do
/sbin/ifconfig.orig "${OPTS[@]}" $IFACE
done
fi
In essence, while you are calling your new ifconfig with a single interface, it behaves as normal ifconfig. If it is called as ifconfig -a
for a example, it only lists lo
and eth0
interfaces. Script could be improved a little, but you get the idea.