On Sun, Dec 19, 2010 at 4:14 AM, Matthew Macdonald-Wallace <li...@truthisfreedom.org.uk> wrote: > 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. > >
Matthew, I'm a bit confused on your code, how does an instance get added to the db? Matthias Approach one won't work, I am doing this from multiple different locations in the code. Also because this is eventually something I want to hide I would probably just set it up using a variable in the node definition and have it read by the redmine class. node redmine { $instances = ["john", "ted", "nancy"] include redmine redmine::instance{"john", "ted", "nancy"} } Approach two is similar to Matthews, so I have the same question how do I add an instance to the db? Thanks, Spenser -- Spenser Gilliland Computer Engineer Illinois Institute of Technology -- 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.