Puppet – How to Classify the Node types ?

We need to classify the nodes when you have to perform similar operation on different OS variant. For an example, If you want to install Apache package on Linux systems, you need to use package name as “httpd” on Redhat variants and “apache2” on Debian variants. In such a cases, you need to tweak your module to detect the OS family using facter and based upon the results , module have to choose either “httpd” or “apache2”. Let’s write a small code to achieve this.