Hi guys, I''ve two questions: 1. How can I execute normal Ruby-Code in a Puppet-Template? 2. How can I execute normal Ruby-Code in a Puppet-Manifest? thanks -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/769987d6-d993-4804-af0c-a2191ba10e03%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
I want to define and call a ruby-method within a Puppet template oder Puppet manifest -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/8ab6be9d-133c-49ae-b599-1ff1f2cb8525%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
On 11/02/2013 11:52 PM, ytmp123 wrote:> I want to define and call a ruby-method within a Puppet template oder > Puppet manifest > -- > 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 view this discussion on the web visit > https://groups.google.com/d/msgid/puppet-users/8ab6be9d-133c-49ae-b599-1ff1f2cb8525%40googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out.inline_template in a manifest (http://docs.puppetlabs.com/references/latest/function.html#inlinetemplate) The link will direct you to the template docs. There isw explained how to use ruby inside your template. Jo -- Johan De Wit Open Source Consultant Red Hat Certified Engineer (805008667232363) Puppet Certified Professional 2013 (PCP0000006) _________________________________________________________ Open-Future Phone +32 (0)2/255 70 70 Zavelstraat 72 Fax +32 (0)2/255 70 71 3071 KORTENBERG Mobile +32 (0)474/42 40 73 BELGIUM http://www.open-future.be _________________________________________________________ Next Events: Puppet Advanced Training | https://www.open-future.be/puppet-advanced-training-12-till-14th-november Zabbix Certified Training | http://www.open-future.be/zabbix-certified-training-18-till-20th-november Zabbix Large Environments Training | http://www.open-future.be/zabbix-large-environments-training-21-till-22nd-november Puppet Fundamentals Training | http://www.open-future.be/puppet-fundamentals-training-10-till-12th-december Subscribe to our newsletter | http://eepurl.com/BUG8H -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/52775705.2080105%40open-future.be. For more options, visit https://groups.google.com/groups/opt_out.
On Saturday, November 2, 2013 5:03:13 PM UTC-5, ytmp123 wrote:> > Hi guys, > > I''ve two questions: > 1. How can I execute normal Ruby-Code in a Puppet-Template? >See any onine docs / tutorials on ERB, though there really isn''t much to it. The docs Jo pointed you to are as good as any, and they cover the details particular to Puppet''s use of ERB.> 2. How can I execute normal Ruby-Code in a Puppet-Manifest? > >Not directly, no, but it is relatively easy to create custom functions (in Ruby) that your manifests can call just like Puppet''s built-ins. These are often a better vehicle for general-purpose Ruby code than are templates. John -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/c078d963-80ad-4db2-97ff-f7f23d47b919%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
You can use inline_template("<%= var = "your ruby code here" %>") Cheers On Monday, November 4, 2013 2:23:34 PM UTC, jcbollinger wrote:> > > > On Saturday, November 2, 2013 5:03:13 PM UTC-5, ytmp123 wrote: >> >> Hi guys, >> >> I''ve two questions: >> 1. How can I execute normal Ruby-Code in a Puppet-Template? >> > > > See any onine docs / tutorials on ERB, though there really isn''t much to > it. The docs Jo pointed you to are as good as any, and they cover the > details particular to Puppet''s use of ERB. > > > >> 2. How can I execute normal Ruby-Code in a Puppet-Manifest? >> >> > > Not directly, no, but it is relatively easy to create custom functions (in > Ruby) that your manifests can call just like Puppet''s built-ins. These are > often a better vehicle for general-purpose Ruby code than are templates. > > > John > > > >-- 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 view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/91c0a2da-3d74-4e27-aa27-9534daa60564%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.