In this topic, we will look at how to make our modules stateless. We will move all the data that is specific to the node that is applied to the module in Hiera (https://docs.puppetlabs.com/hiera/3.1/). There are two main drivers behind this. The first is to remove any sensitive data such as passwords, keys, and so on, out of our modules. The second is if we remove node-specific data or state out our modules so that they are generic. We can apply them to any number of hosts without changing the logic of the module. This gives us the flexibility to publish our modules for other members of the Puppet community.
When we first sit down and start development on a new module, some of the things that we should consider are: whether we can make our module OS agnostic, how we can run the module on multiple machines without logic changes or extra development, and how we can protect our sensitive data?
The answer to all these questions is Hiera.
We are able to leverage Hiera...