On Thu, 2011-09-22 at 13:26 -0700, jcbollinger wrote:
> >
> > I would like the backup_include to automatically include /var/www if
> > the host is an apache server (for example), and I would like those
> > directories to be defined in the apache class (not the bacula class)
> >
> > Any clever ways of achieving this?
>
>
> There are no particularly good ways to achieve that if you restrict
> yourself to Puppet DSL. Generally speaking, you never want your
> manifests to inquire about the node's target state -- they should
> dictate instead. Anyway, all the approaches I know that inquire about
> what other classes are declared for a given node suffer from order-
> dependence issues, so at best, using them makes your manifests
> brittle.
>
> Without going too far outside Puppet DSL, you can achieve your goal by
> externalizing some or all of your data. Then, instead of asking
> whether a particular class _has been_ assigned to the node, you can
> use extlookup(), hiera, or similar to ask whether that class _is
> supposed to be_ assigned, whether it already has been or not. For
> best results, use the same data to drive the actual choice of whether
> to assign the class.
I currently am using LDAP external nodes, and I see two ways of
assigning classes to hosts
1. use the puppetClass attribute, and assign classes directly. However,
extlookup cannot query ldap, so I could not query this data within my
manifests
2. add all hosts to a global generic_server class. I could then set
variables in ldap like is_bacula_client=1, is_apache_server=1, etc.
generic_server would look something like:
class generic_server {
if $is_apache_server == 1 {
include apache::server
}
if $is_bacula::client == 1 {
include bacula::client
}
etc
etc
}
This would allow me to use a construct of the following pseudocode in my
bacula client template file
if is_apache_server == 1 then
print "File = /var/www"
end
if is_dns_server == 1 then
print "File = /var/named
end
etc
etc
This would work, but requires that I add conditionals for all other
classes in the bacula class
I would like to keep the classes self contained, so that the bacula
client template file or class has a generic include mechanism, and the
apache class would define all the required backup directories. Any
ideas around that?
Chris
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.