Application definition

Application definitions look a lot like a defined resource, but are also similar to a traditional Puppet profile. They describe a collection of components that make an entire system, but unlike profiles, are not tied down to a single node. These application definitions describe a configured state of one or more nodes, broken down by application components. 

Application definitions will resemble defined types, with a few key differences:

  • They are titled application instead of define.
  • Each resource must be name spaced within the module:
# Application used instead of 'class' or 'define'
application 'example' (
$var,
) {

# app1 exports its database configuration items
example::app1 {
config => $var,
export => Database['app1'],
}

# app2 both imports the previous database and exports its own type: Application
example::app2 {
config => $var,
consume => Database['app1'],
export => Application['app1'],
}

What is important to note is that each resource in this application can be tied to an entirely different node with our site definition. We can also use our site definitions to pass in those shared configuration items, represented by $var in the preceding code:

#/etc/puppetlabs/code/environments/production/manifests/site.pp
site {
example {'app1':
var => 'config',
nodes => {
Node['database'] => [ Example::App1['app']],
Node['app'] => [ Example::App2['app']],
}
}
}
Inside of the node's hash, notice that the Node object and Example::App<X> objects are capitalized.
..................Content has been hidden....................

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