How can I setup a network connection with Puppet?
Puppet is a tool that is used to automate processes and configurations typically once you have a process or configuration identified. It seems here that you aren't sure what you wish to do. It would help to know if this is Windows or Linux (or Mac ). Do you have the physical cabling completed? Are these computers all on the same subnet? Do you have an IP addressing scheme in mind? It seems to me that you are not providing nearly enough information.
In Red Hat linux, you typically would define the network settings of an individual computer within the file /etc/sysconfig/network-scripts/ifcfg-eth0
(assuming you wish to define the first network interface, eth0 ). You would use puppet typically to automate redundant tasks or to enforce that specific configuration files maintain the correct settings and revert to the proper state even after being modified. Typically a puppet master server would check for changes on a file and revert them every 30 minutes. This is an odd task for puppet as assigning IP addresses to a few machines is a one-off task.
If you must do it in Puppet, you could look into using an erb template for the /etc/sysconfig/network-scripts/ifcfg-eth0
file.
The issue is that each machine must have a unique IP address, like 192.168.1.2, 192.168.1.3, 192.168.1.4, and so on. I believe, with all due respect, that this task may involve too many factors that are foreign to you. You can also use puppet to have certain services listen for changes to related files. In this case, you would want the /etc/init.d/network
service to reload after you have modificed the ifcfg-eth0 file, adding an IPADDR=192.168.1.X entry, where X is a unique number.
Generally you wouldn't use Puppet to configure a system's networking -- you certainly CAN as Gregg points out in his answer, but it's a chicken-and-egg scenario:
- Puppet operates over the network, therefore Puppet requires the machine to be connected to the network.
- You want to use Puppet to configure the network, which presumably means the machine is NOT on the network.
- Puppet operates over the network (goto 1)
Since IP configuration is usually a one-time thing, and I have to do it manually at least once to break the chicken-and-egg cycle above, it's not typically something I manage with Puppet (or any other configuration management tool) -- I keep records of which machines have what address (separate from configuration management), manually configure the systems as they're built, and thereafter the network settings should never be changed.
This means I need to manually log in to each machine if I ever change my IP addressing scheme, but that should be infrequent enough that it's not a major inconvenience worth my time to implement management of the network configuration.
If you expect to be changing the IP address of machines regularly managing them with Puppet might make sense for your environment (but I'd argue if you're renumbering machines frequently you're probably Doing It Wrong).