Ruby-Code in Puppet

182 views
Skip to first unread message

ytmp123

unread,
Nov 2, 2013, 6:03:13 PM11/2/13
to puppet...@googlegroups.com
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

ytmp123

unread,
Nov 2, 2013, 6:52:14 PM11/2/13
to puppet...@googlegroups.com
I want to define and call a ruby-method within a Puppet template oder Puppet manifest

Johan De Wit

unread,
Nov 4, 2013, 3:12:53 AM11/4/13
to puppet...@googlegroups.com
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...@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

jcbollinger

unread,
Nov 4, 2013, 9:23:34 AM11/4/13
to puppet...@googlegroups.com


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



Reply all
Reply to author
Forward
Message has been deleted
0 new messages