I would like to write functions in the puppet language that accept a block of code, so that I can write my own iterators and other functions that accept code, without the context switch of doing it in ruby.
The specific use case I have is that we often need to run some piece of puppet code once among a group of nodes. To do that, we do a puppetdbquery to find similarly-classified nodes, then sort that list and see if the current node's certname is the first one on the list. If true, run some bit of code.
I would like to write a function like:
The way I might use this would be if I want to schedule a cron job to run on one of several identical web application servers:
ping Henrik Lindberg because I think we've talked about this before