Take a look at the actual code I've been building to provision a bunch of software. See the patterns used for individual tasks, some hairy variable and string manipulation, and how the roles are structured.
Delivered while wearing my bullet proof vest - much of this is likely not "pretty" - but we've got so many experts coming that the ensuing discussion will be awesome!