I need to reuse some scenario in my cookbooks - create several users on a single machine and install same software for each of them. Installing the software is a repeating operation which I'd like to put in a single place and reuse.
I've looked at Providers, but they seem to have a method load_current_resource
which loads the current state of the system, I cannot have such a method because some users might have installed this software, others - haven't and if Chef invokes this method behind the scene, I won't have control over what particular user I'm working with at the moment.
I've also looked at MySQL Cookbook which puts some custom code into libraries
folder. This might be the best option for me, but I don't know whether it's a Chef way or not.
So the question is - what is The Chef Way of putting such reusable parts of code to be used several times by the same recipe or by several of them.