2

I am looking for a way to exclude ifaces from the macaddress and the interfaces facter in order to make puppet run faster on certain hosts. These facts are built-in as far as I understand and I would like to make this happen without patching the facter package source code, or at least with the less intrusive manner.

Is there any clean-cut solution to this that you could propose? I am on Debian wheezy with facter 1.6.10-1 installed.

Thanks in advance

Kostis
  • 21
  • 1
  • Have you tried my solution? Or have found another one, that would be interesting to know. – thor Feb 24 '14 at 06:41

1 Answers1

1

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.

thor
  • 658
  • 1
  • 7
  • 18