[Puppet Users] Re: Ruby-Code in Puppet
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+unsubscr...@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.
[Puppet Users] Re: Ruby-Code in Puppet
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+unsubscr...@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.
[Puppet Users] Re: Ruby-Code in Puppet
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+unsubscr...@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.
[Puppet Users] Re: Ruby Code in Puppet Class.....
Now i feel stupid $reversenetwork= inline_template(%= '$ipaddress'.split('.') [0,3].reverse.join('.') %) FTW! :D On Nov 4, 7:42 pm, Arenstar arens...@gmail.com wrote: Simply put.. I need the reverse of an ipaddress for a in-addr.arpa.. Puppet has a function i can find that will simply execute ruby code, nor bash.. $ipaddress comes from facter $reversenetwork = $ipaddress.split('.')[0,3].reverse.join('.') file { /opt/lp/dnscache-internal/root/servers/$reversenetwork.in- addr.arpa: owner = root, group = root, mode = 644, content = 127.0.0.1 \n, require = Exec[dnscache-internal-setup], } Can anyone help.. ive tried, inline_templates and now working with facter.. Its much too overly complicated for my needs.. i dont want to have to manage facter unless its absolutely neccessary and for a simple line of ruby, i cant see why it will not work.. Suggestions... Thanks David Arena -- 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.