Stefan Pommerening
2013-Jun-06 11:23 UTC
[Puppet Users] Running the same command (exec) multiple times?
Hi all, I am currently writing a graylog2 module for puppet on centos 6.3 and need to update Ruby on target machine to 1.9.3 although there is already an older version (1.8.7) installed. Therefore I decided to use rvm but for writing a more general puppet module I need to invoke commands like ruby, gem and bundle without the trailing version numbers. A simple ''rvm use 1.9.3 --default'' does the job but I happen to need multiple invocations of this command during further installation progress. (one after installing ruby using rvm, the second after installing rubygems and a third after installing the bundler, depending on configured complexity of the puppet ruby module when being used) My question: - Is it possible to trigger a puppet exec type multiple times and can it also be executed (the command) multiple times? Afaik the usual puppet behaviour is to trigger each resource only a single time. But maybe there is a special way to realize my requirement? Thanks in advance, Stefan -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Nick Fagerlund
2013-Jun-06 18:34 UTC
[Puppet Users] Re: Running the same command (exec) multiple times?
The way Puppet is built today, you can''t trigger the same exec resource multiple times in a single run. However, the exec resource type is kind of special: the value of the namevar ("command") doesn''t have to be globally unique; only the title has to be unique. Basically, to deal with cases like yours. So in your case, since you know how many times rvm has to be executed, you can actually make three exec resources (with different titles) that use the same command value. They can all have different behavior to account for their needs (refreshonly => true on the last one, maybe, or whatever). -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.