I have 3 CentOS nodes. Each of them has 2 IP addresses: 10.0.1.* (eth0) and 192.168.1.* (eth1). All of them have puppet installed and there is a master puppet server for managing configuration in these servers. All the servers interact with puppet server using the 10.0.1.* IPs.
My need is that I want to change the eth1 IP address on these servers. Can I have a generic config file that can be used to change the IP address on the 3 servers or should I have 3 different config files for the 3 servers?
Before writing your own code take a look at https://forge.puppetlabs.com. Because usually there is a module which totally covers all your needs.
In your case if I understand your task correctly it's https://forge.puppetlabs.com/example42/network
If you still want to do that manually you should either use simple template substitution as was mentioned already or
augeas
which I think a better idea.For example to configure
vmbr0
interface you need to add something like this for Debian:And for CentOS:
Also follow this link http://projects.puppetlabs.com/projects/1/wiki/Network_Interface_Templates_Patterns. It has some nice thoughts about network configuration.