FAQ
Hi.

What is the best way to mix classes?

For example, I have a class apache, which sets up web server, and have
class cobbler which needs to add few files to /etc/httpd/conf.d.

What's the best way to do this? Include apache class in cobbler class?
Where can I find examples?

Or, if I use postgresql class to manage PgSQL, how can add a database
from some class that needs to create PgSQL database?


ty.


Ps. I can elaborate more if question is not clear enough...

--
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.

Search Discussions

  • Jcbollinger at Sep 10, 2012 at 2:31 pm

    On Friday, September 7, 2012 8:02:50 AM UTC-5, Jakov Sosic wrote:
    Hi.

    What is the best way to mix classes?

    For example, I have a class apache, which sets up web server, and have
    class cobbler which needs to add few files to /etc/httpd/conf.d.

    What's the best way to do this? Include apache class in cobbler class?

    That is what I would do, provided that class 'apache' is not parametrized.
    I.e.:

    class cobbler {
    include 'apache'
    # ...
    }

    Unfortunately, that approach doesn't work well if class 'apache' is
    parametrized. If class 'apache' is parametrized, or if for some reason you
    don't want to make the module containing your cobbler class explicitly
    dependent on the module containing class 'apache', then you can declare the
    dependency externally via Puppet's chaining operators:

    class { 'apache':
    # some parameters
    }

    include 'cobbler'

    Class['apache'] -> Class['cobbler']

    You can also set up finer-grained relationships between classes and
    individual resources, or between pairs of resources, using the 'before' and
    'requires' metaparameters, including across class and even module
    boundaries, but that kind of deep coupling can present a maintenance
    problem.


    John

    --
    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/-/1u24nTMTAJAJ.
    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
postedSep 7, '12 at 1:33p
activeSep 10, '12 at 2:31p
posts2
users2
websitepuppetlabs.com

2 users in discussion

Jcbollinger: 1 post Jakov Sosic: 1 post

People

Translate

site design / logo © 2022 Grokbase