Gary Wilson
2012-Apr-30 22:45 UTC
[Puppet Users] accessing a variable within a previously declared instance of a defined type
I''m trying to define a static media server that uses a common website
layout (e.g. with directories `etc/`, `log/`, `html/`, etc.), as well as an
nginx config that will get included into a host-wide nginx config. The
site''s nginx config needs to make use of the doc root that gets defined
by
the declared `layouts::website` resource.
So, what I''d like to do is something like this:
class sites::static ($sites_dir) {
$domain = "static.example.com"
layouts::website {$domain:
base_dir => $sites_dir,
name => $domain,
}
nginx::siteconfig {$domain:
domain => $domain,
doc_root => $layouts::website[$domain]::doc_root,
}
}
Which could then be used by declaring:
class {''sites::static'': sites_dir =>
"/opt/sites"}
However, the above fails because the `$layouts::website[$domain]::doc_root`
part is invalid. I''ve tried various alternatives here, unsuccessfully.
From what I''ve read thus far, it seems that what I''m asking
for is not
possible (though I would be interested in any pointers to discussion on the
topic if this is something that''s been suggested before). Any
suggestions
on how can I accomplish the stated goal of using a base layout that then
needs to be used by various bits that will populate content within that
base layout?
Thanks,
Gary
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/puppet-users/-/VT8TBloxghYJ.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to
puppet-users+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.