On Tue, Nov 29, 2011 at 4:23 AM, Gonzalo Servat <gser...@gmail.com> wrote:
> Hi All,
>
> We use a package called "Torque Scheduler" which is based on a configuration
> file that defines nodes, the queues they handle, how many slots, etc. The
> config file format is similar to:
>
> unlimited <node1> <node2> ... <nodeN>
>
> node <node1> <load> <slots> <queue1>:<priority> <queue2>:<priority> ...
> <queueN:priority>
> node <node2> <load> <slots> <queue1>:<priority> <queue2>:<priority> ...
> <queueN:priority>
> ...
> node <nodeN> <load> <slots> <queue1>:<priority> <queue2>:<priority> ...
> <queueN:priority>
>
> (a node may or may not be listed as "unlimited")
>
> We would normally store this file as-is in Puppet and push it out using file
> {}, but I'd like to "Puppetize" it. Ideally, I'd like to be able to do the
> following:
>
> node { "node1":
>    unlimited => true,
>    load => XX,
>    slots => XX,
>    queues => {
>       "queue1" => 80,
>       "queue2" => 20,
>       "queueN" => XX
>    }
> }
>
> So basically to build the config file, I'd have to process all the nodes and
> where unlimited is true, add to the "unlimited" line.
>
> I know what I want the config file to look like, but I'm not sure how to
> achieve this in Puppet. Does this sound like a job for a custom Puppet
> provider? I can't figure out how I would build the "unlimited" line over
> time.
>
> Can anyone suggest a module that does something similar to this so I can get
> some ideas flowing?

Just write the files on the master via generate function. Let's say we
store all this in:

/etc/puppet/data/torq.d

class torq::store (
  $unlimited = true,
  $slots,
  ...
) {
  if $unlimited {
    # write a file to /etc/puppet/data/torq.d/${hostname}
    # node <node1> <load> <slots> <queue1>:<priority> <queue2>:<priority>
    generate(' ... ')
  }
}

class torq::load {
   file { '/etc/torq.conf':
     content => template('torq/torq.conf.erb')
   }
}

torq.conf.erb template
unlimited <%= Dir.glob('/etc/puppet/data/torq.d/*').join(' ')

# include each file in the directory below here:
...

Thanks,

Nan

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@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