On Tuesday, June 7, 2016 at 5:13:33 AM UTC-5, Christoph wrote: > > Hi there, > > I want to run a whole puppet class only once when provisioning a system > for the first time. > > Unfortunately I do not find a way to do this. > > I know how to run commands once using onlyif or unless or creates, but > what about running a whole class ? > >
As Rob described, what you describe goes against the Puppet grain. Classes and resources should be idempotent -- *that* is the purpose of Exec's onlyif, unless, and creates parameters. Puppet is not a script engine; it is a state management system. If you insist on writing and applying classes that are not idempotent, however, then your options for controlling whether such classes are applied to a given node on a given run are these: 1. Assign the class only to nodes to which you want to apply it That implies that you need a mechanism to determine whether your class needs to be applied; among the more promising of such mechanisms are (i) manipulating node facts and (ii) establishing separate environments within Puppet. Note also that you must be sure to disable usage of cached catalogs wherever there is any chance that a catalog contains a class that should not be re-applied. John -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/c6bfd1cd-b2f5-4278-9cab-a9f2b5cad74b%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.