That does not work because the variables set in a define are local and
private, there is no way that variable can be accessed from within an
included class.
Depending on puppet version, the scoping rules are slightly different
wrt. what can be accessed. In older versions you could use dynamic
scoping by changing your define to a class, but that does not work in
newer versions (dynamic scoping has been deprecated and removed because
of its many bad side effects).
You may instead want to use parameterized classes, and instead of an
include do this:
class { app1: defined_variable => 'content' }
and define the class like this:
class app1($defined_variable) {
# ...
}
This also has the advantage that you can control the configuration using
external data lookup via hiera instead of having your own logic
in puppet for this.
- henrik
--
Visit my Blog "Puppet on the Edge"
http://puppet-on-the-edge.blogspot.se/