Note: we use Puppet standalone (master-less) i.e. puppet apply.
Usually, while deploying a web application there are a number of back-end services and applications that run behind the front-facing application - things like the database, search server, caching server, other internal services, etc. These services are need not listen on the public network interfaces. Instead, they can listen on private network interface and all the applications can communicate over that securely. This is something that I already do.
The issue arises when you want to automatically deploy these services. We use Puppet for infra provisioning. When these services are deployed, we depend on facts to pickup things like ipaddress and hostname. Depending upon where your machine is, the name of the interface differs. For example, the identifiers in machines provided by Soft Layer are bond0, bond1, etc. and the same provided by Digital Ocean are eth0, eth1, etc. Out of these, lets say bond0 and eth0 are public interfaces and bond1 and eth1 are private.
Ideally, we should use the same Puppet scripts for provisioning infrastructure no matter where you are provisioning. And we use hiera for picking up default values for classes. So ideally, I would want to have facts like ipaddress_public, ipaddress_private available and then I can use them however I want for whichever class in Puppet. And the fact should hide away the gory details of figuring out where the machine is i.e. Soft Layer, Digital Ocean, AWS, etc. and get me the fact for the job. Or, I can create a hierarchy for infrastructure provider in hiera and have different defaults for different infrastructure providers.
The issue is I don't know how to figure out the provider for a particular machine. So for example, if I give you a machine to run Puppet on, can there be a reliable way to figure out if it is running on Soft Layer, Digital Ocean, AWS, etc.? How do you guys solve problems like these?