Search code examples
puppetsles

How do I use puppet to configure network settings?


I have written a module that will configure network settings on my system but I can't apply the manifest because before a manifest is applied it does "facter ipaddress" to find and present global facts.

Does it mean that in order to apply puppet manifest we must have IP configured ?

So I have a system that has no IP address configured and i want to use puppet to configure that IP address for me, for that I am asking user to input IP address which i save in a .csv file, then I am using a template to configure if-eth0 file. Template will do extlookup to fill up the fields in template and template is finally called upon inside a manifest. So the problem is that before anything is applied by puppet, it fails to run with following error

facter ip address unable to resolve IP , reason anonymous


Solution

  • I am not sure about the actual question (if IP is indeed needed). However, if I understand correctly you can try one of the two workarounds:

    1. Enable DHCP

    This way when your system boots will take a little bit more time (assuming there is no DHCP service on the network). A timeout will occur which, in most of the cases, results in a default IP (169.254.Y.Z if I remember). In this case you may need to stop/kill the dhcp client process before applying static IP or restart the interface to get the new configuration.

    1. Assign default static IP

    If you know that puppet configuration will be applied no matter what (maybe a call in rc.local?), you can configure your interface with a static IP (ie 10.1.1.10) to avoid the error message. This is temporary since once puppet runs, the correct configuration will be applied.

    Hope it helps,

    Andreas