FAQ
Hello all,

I am new to puppet and I am currently designing a set of deployment rules
for our company web servers. The Puppet DSL brings me quite far, but now I
could really use the possibility to extend the DSL with one or two ruby
functions.

Example: I would like to iterate over all the IP addresses of a system,
picking out only those which match a certain criteria.
There are method-like things in the DSL, like the template("...") method
for the file class.

Now my question is: Is that possible in general? And if yes - where is a
point where I can read up on this? I am a Ruby Noob (tm) but firm in quite
a few other languages, so some rough hands-on documentation on how to start
should be enough.

Thanks for any answers :)
/Axel.

--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/FT4gNfz2lnQJ.
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.

Search Discussions

  • R.I.Pienaar at Jul 19, 2012 at 1:58 pm

    ----- Original Message -----
    From: "Axel Bock" <axel.bock@arbeitsagentur.de>
    To: puppet-users@googlegroups.com
    Sent: Thursday, July 19, 2012 2:54:36 PM
    Subject: [Puppet Users] Integrating Ruby methods into Puppet classes

    Hello all,

    I am new to puppet and I am currently designing a set of deployment
    rules for our company web servers. The Puppet DSL brings me quite
    far, but now I could really use the possibility to extend the DSL
    with one or two ruby functions.

    Example: I would like to iterate over all the IP addresses of a
    system, picking out only those which match a certain criteria.
    There are method-like things in the DSL, like the template("...")
    method for the file class.

    Now my question is: Is that possible in general? And if yes - where
    is a point where I can read up on this? I am a Ruby Noob (tm) but
    firm in quite a few other languages, so some rough hands-on
    documentation on how to start should be enough.
    You can write your own functions http://docs.puppetlabs.com/guides/custom_functions.html

    Puppet ships with quite a few http://docs.puppetlabs.com/references/stable/function.html

    And there is a good library called puppetlabs-stdlib with many more https://github.com/puppetlabs/puppetlabs-stdlib

    --
    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.
  • Axel Bock at Jul 30, 2012 at 12:50 pm
    thanks, that works just fine :) . I am writing some methods right now.

    a last question maybe: how can I ouptut text on the command line from
    within a function?

    crit(...) and function_crit(...) don't seem to work, even when I include
    the puppet functions using "... loadall" like said in the docs.


    thanks in advance,
    axel.


    Am Donnerstag, 19. Juli 2012 15:58:06 UTC+2 schrieb R.I. Pienaar:

    ----- Original Message -----
    From: "Axel Bock" <axel.bock@arbeitsagentur.de>
    To: puppet-users@googlegroups.com
    Sent: Thursday, July 19, 2012 2:54:36 PM
    Subject: [Puppet Users] Integrating Ruby methods into Puppet classes

    Hello all,

    I am new to puppet and I am currently designing a set of deployment
    rules for our company web servers. The Puppet DSL brings me quite
    far, but now I could really use the possibility to extend the DSL
    with one or two ruby functions.

    Example: I would like to iterate over all the IP addresses of a
    system, picking out only those which match a certain criteria.
    There are method-like things in the DSL, like the template("...")
    method for the file class.

    Now my question is: Is that possible in general? And if yes - where
    is a point where I can read up on this? I am a Ruby Noob (tm) but
    firm in quite a few other languages, so some rough hands-on
    documentation on how to start should be enough.
    You can write your own functions
    http://docs.puppetlabs.com/guides/custom_functions.html

    Puppet ships with quite a few
    http://docs.puppetlabs.com/references/stable/function.html

    And there is a good library called puppetlabs-stdlib with many more
    https://github.com/puppetlabs/puppetlabs-stdlib
    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/quC5MgWKhJMJ.
    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.
  • R.I.Pienaar at Jul 30, 2012 at 2:05 pm

    ----- Original Message -----
    From: "Axel Bock" <axel.bock@arbeitsagentur.de>
    To: puppet-users@googlegroups.com
    Sent: Monday, July 30, 2012 5:50:41 AM
    Subject: Re: [Puppet Users] Integrating Ruby methods into Puppet classes

    thanks, that works just fine :) . I am writing some methods right
    now.

    a last question maybe: how can I ouptut text on the command line from
    within a function?

    crit(...) and function_crit(...) don't seem to work, even when I
    include the puppet functions using "... loadall" like said in the
    docs.
    functions are run on the master so you wont see them on the client side
    unless you are using 'apply', Puppet.notice() should do it.

    --
    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.
  • Axel Bock at Jul 31, 2012 at 6:40 am
    that sounds quite like what I need. thanks :)


    Am Montag, 30. Juli 2012 16:04:56 UTC+2 schrieb R.I. Pienaar:

    ----- Original Message -----
    From: "Axel Bock" <axel.bock@arbeitsagentur.de>
    To: puppet-users@googlegroups.com
    Sent: Monday, July 30, 2012 5:50:41 AM
    Subject: Re: [Puppet Users] Integrating Ruby methods into Puppet classes

    thanks, that works just fine :) . I am writing some methods right
    now.

    a last question maybe: how can I ouptut text on the command line from
    within a function?

    crit(...) and function_crit(...) don't seem to work, even when I
    include the puppet functions using "... loadall" like said in the
    docs.
    functions are run on the master so you wont see them on the client side
    unless you are using 'apply', Puppet.notice() should do it.
    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/sqKF9zOf9y4J.
    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.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppuppet-users @
categoriespuppet
postedJul 19, '12 at 1:56p
activeJul 31, '12 at 6:40a
posts5
users2
websitepuppetlabs.com

2 users in discussion

Axel Bock: 3 posts R.I.Pienaar: 2 posts

People

Translate

site design / logo © 2021 Grokbase