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 = 'w0rdpr3ss!',
$webpath = '/var/www/wordpress',
$vhost = 'appserver',
) {
myapp::db { $name:
dbuser => $dbuser,
dbpass => $dbpass,
export => Sql[$name],
}
myapp::web { $name:
webpath => $webpath,
consume => Sql[$name],
vhost => $vhost,
}
}
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.19.29.89