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?
Thanks in advance.
Gonzalo
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.
On Tue, Nov 29, 2011 at 03:23:22PM +1100, Gonzalo Servat wrote:> 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?I did something similar by creating a template for a single line of a config file, then merging the individual lines. This is from puppet ~0.18.0 so the syntax might not be exactly right for current versions, but you should get the idea. define lbservice($virtual_ips, $real_ips, $ports = [80], $primary_server = lb1) { $service = $name file { "/etc/ha.d/ldirectord.cf.d/$service": content => template("ldirectord.cf.snippet.rb"), notify => Mergesnippets["/etc/ha.d/ldirectord.cf"], backup => false; } } define mergesnippets($mode = 644, $owner = root, $group = root, $refreshonly = true) { exec { "build_snippet_file-$name": command => "/bin/cat $name.d/* > $name", refreshonly => $refreshonly, } file { $name: mode => $mode, owner => $owner, group => $group } } node lb1,lb2 { lbservice { 1: virtual_ips => ["192.168.1.129"], real_ips => ["10.0.0.185", "10.0.0.186"], ports => [25, 80, 443]; 2: virtual_ips => ["192.168.1.130"], real_ips => ["10.0.0.188"], ports => [25, 80, 443]; } } The contents of ldirectord.cf.snippet.rb: virtual=<%= Integer(service)|0x1000 %><% real_ips.each do |real_server| %> real=<%= real_server %> gate<% end %> service=http request="ldirector.html" receive="Test Page" scheduler=rr checktype=negotiate Your torquenode resource type would pretty similar to the lbservice one. Hope that helps, Christian -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On Tue, Nov 29, 2011 at 4:23 AM, Gonzalo Servat <gservat@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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.