Application declaration

In the previous example, we called a resource called myapp just under the site{} declaration. This manifest, located in the myapp module at manifests/init.pp, declares the application, describes some overridable parameters, and orchestrates applications using the export and consume metaparameters. Notice the following:

  • On the first line, the application myapp is used in place of a class or define.
  • myapp::db exports to the SQL resource.
  • myapp::web consumes the SQL resource.
  • myapp::db will run before myapp::web, because myapp::web has a dependency via consume.
  • We use the $name variable so that each component receives myapp as a name, taken from myapp {'myapp':}:
application myapp (  $dbuser = 'wordpress', $dbpass = ...

Get Mastering Puppet 5 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.