On Sun, 2010-12-19 at 01:51 -0600, Spenser Gilliland wrote:
> Yeap, I'm seeing that it doesn't exist yet either.  I'm thinking maybe
> I can use exported resources or maybe just an exec that increments a
> counter on the host.  Either way it's not very pretty.  My use case is
> as follows:
> 
> In Debian, Redmine has the option of being installed as several
> instances controlled by a single debconf variable.  In order to
> utilize this feature, I need to supply debconf with the name of all
> instances of Redmine on the server. I've split this out into the
> following way:  A class called Redmine which installs the Redmine
> package and should hold an array of all the instances of Redmine to
> feed to debconf using the "responsefile" parameter.
> 
> So I think I've come up with a solution in my head but it involves me
> guaranteeing that the redmine class is instantiated before any of the
> redmine::instances are defined.  Essentially, I'll use an
> environmental variable or file and clear it with the Redmine class and
> append to it for each redmine::instance.  Maybe like below?
> 
> class redmine {
>     exec{"rm /tmp/instances && touch /tmp/instances"}
> }
> 
> define redmine::instance
>    exec{"echo $name >> /tmp/instances"}
> }

Can you "read" (from the file system or list the redmine databases in
mysql/postgresql server?) a list of installed instances?

If so, why not setup a custom fact which has all the instances listed as
a csv string:

========== PSEUDO CODE!!! ==========
instances = read_instances() # a class which connects to the db/file  
# system to read in the instances and converts them to CSV format #

Facter.add redmine_instances do
        setcode do 
                instances
        end
end
===================================

and then template the /tmp/instances file using erb:

========== PSEUDO CODE!!! ============
<% redmine_instances.each do |instance| -%>
instance
<% end -%>
======================================

Your manifest could then source this template onto the file system and
feed the file to debconf.

It's a bit more long winded, however it means that if you want to add
instances, you just add an extra value to the fact.

We use this technique to manage MySQL replication and it works really
well!

Cheers,

M.
                


-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-us...@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to