Puppet Foreach / For Loop Workaround

Here is a quick workaround to effectively write a foreach loop in puppet. There isn’t a native foreach function that I’m aware of, however it is possible to obtain similar functionality by using a define statement.

Let’s create a simple example to loop over multiple users, and perform an action on each user. In this case we’ll print “Found user ” for each user.