FAQ
Hi,

I currently have puppet setup and backed into the dashboard and using ENC.

I wish to control as much of the configuration of machines via the
dashboard.

However, I have a requirement to call a module/class multiple times and was
wondering if this is possible? in a normal manifest I'd do this with the
following:

node "somenode" {
somemodule::submodule { "first": key => 'value'; "second": key => 'value'
}
}

How can i do that with the dashboard? It seems to me that
class definitions need to include the ability to define variables So I
could create multiple classes calling the same modules with each different
values and then include them in a group, and then include that group to the
host? But the dashboard doesn't appear to support this? Does this mean I
need to define it outside of the dashboard? How can I do this if i'm using
ENC?



--
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/-/fzM0XYoY2IAJ.
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 Jan 16, 2013 at 4:50 pm

    On Tuesday, January 15, 2013 5:30:09 PM UTC-6, Michael Dodwell wrote:
    Hi,

    I currently have puppet setup and backed into the dashboard and using ENC.

    I wish to control as much of the configuration of machines via the
    dashboard.

    However, I have a requirement to call a module/class multiple times and
    was wondering if this is possible?
    It is not possible with Dashboard or by any other means if you are
    specifying class parameters. It is not meaningful or useful if you are not
    specifying class parameters.

    Do not confuse declaring the same class multiple times with declaring
    multiple resources of the same defined type. The latter is allowed and
    meaningful because each resource is independent of the others. The former
    is not meaningful, because classes are singletons -- second and subsequent
    declarations of the same class have no effect on the target node's
    catalog. On the other hand, a second or subsequent declaration of a given
    class is erroneous if it expresses and class parameters (even if they are
    the same as those of the first declaration).

    Furthermore, do recognize that even your example fails to express even a
    single class declaration. Instead, it expresses a declaration of a defined
    type instance. Neither Dashboard nor any other ENC can declare defined
    type instances, however, so there is no help for you there.

    Your requirement is therefore bogus -- either useless or unfulfillable. If
    you can offer more detail on what you're actually trying to accomplish then
    perhaps we can suggest alternatives.


    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/-/9ojvbnRKrmUJ.
    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.
  • Michael Dodwell at Jan 17, 2013 at 2:01 pm

    On Thursday, January 17, 2013 3:50:14 AM UTC+11, jcbollinger wrote:

    On Tuesday, January 15, 2013 5:30:09 PM UTC-6, Michael Dodwell wrote:

    Hi,

    I currently have puppet setup and backed into the dashboard and using
    ENC.

    I wish to control as much of the configuration of machines via the
    dashboard.

    However, I have a requirement to call a module/class multiple times and
    was wondering if this is possible?
    It is not possible with Dashboard or by any other means if you are
    specifying class parameters. It is not meaningful or useful if you are not
    specifying class parameters.

    Do not confuse declaring the same class multiple times with declaring
    multiple resources of the same defined type. The latter is allowed and
    meaningful because each resource is independent of the others. The former
    is not meaningful, because classes are singletons -- second and subsequent
    declarations of the same class have no effect on the target node's
    catalog. On the other hand, a second or subsequent declaration of a given
    class is erroneous if it expresses and class parameters (even if they are
    the same as those of the first declaration).

    Furthermore, do recognize that even your example fails to express even a
    single class declaration. Instead, it expresses a declaration of a defined
    type instance. Neither Dashboard nor any other ENC can declare defined
    type instances, however, so there is no help for you there.

    Your requirement is therefore bogus -- either useless or unfulfillable.
    If you can offer more detail on what you're actually trying to accomplish
    then perhaps we can suggest alternatives.


    John
    Ok so for an example I have a module/class that enables apache vhost setup.
    In this example I have X web servers that are load balanced and i want to
    add all my Y virtual hosts, so working backwards I would want to create a
    group called 'web_vhosts', for example, and add to that Y class calls to
    the same apache vhost creation class but with different variables ie
    servername => "somehost.com"

    Or as a more syntax correct manifest:


    node somenode {

    include apache

    apache::vhost {


    "my-site":
    servername => "my-site.com",
    port => 80,
    docroot => "/opt/mysite";

    "other-site":
    servername => "other-site.com",
    port => 80,

    docroot => "/opt/othersite";

    # ETC ETC


    }
    }

    --
    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/-/ZBtz-nmwHfIJ.
    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.
  • Jcbollinger at Jan 18, 2013 at 4:29 pm

    On Thursday, January 17, 2013 7:05:59 AM UTC-6, Michael Dodwell wrote:

    Ok so for an example I have a module/class that enables apache vhost
    setup. In this example I have X web servers that are load balanced and i
    want to add all my Y virtual hosts, so working backwards I would want to
    create a group called 'web_vhosts', for example, and add to that Y class
    calls to the same apache vhost creation class but with different variables
    ie servername => "somehost.com"

    Or as a more syntax correct manifest:


    node somenode {

    include apache

    apache::vhost {


    "my-site":
    servername => "my-site.com",
    port => 80,
    docroot => "/opt/mysite";

    "other-site":
    servername => "other-site.com",
    port => 80,

    docroot => "/opt/othersite";

    # ETC ETC


    }
    }

    I repeat: do not confuse declaring the same class multiple times with
    declaring multiple resources of the same defined type. Based on the syntax,
    the "apache::vhost" in your example can only be a defined type, not a
    class. ENCs cannot directly declare defined type instances (or native type
    instances); they can only declare classes and top-level variables. On the
    other hand, if "apache::vhost" *were* a class, then it would be invalid to
    declare it multiple times with different parameters. Re-read my earlier
    comments and the Puppet language documentation until you understand these
    things.

    You can create a class to declare the appropriate vhost instances -- say
    site::vhosts -- but as a class, it can only be declared with any explicit
    parameters once, whether by your ENC or in a manifest somewhere. For such
    a class to serve your needs, therefore, it must declare *all* vhosts needed
    by the target node in one go.

    If you want a single site::vhosts class that declares the correct vhosts
    for every relevant server, where those vary from server to server, then
    you're looking for a data-driven approach. There are a number of
    variations on that, but they all involve these pieces:

    - A data store / access function. A good and common choice here would
    be a YAML-based data store accessed via hiera. You could also use one or
    more Puppet class variables, accessed directly. Or you could use virtual
    resources as your data, and the realize function or collection operator as
    your accessor. There are other possibilities.
    - Rules for selecting which data to use. That could come from a vhost
    list stored alongside the vhost data or in a global variable or class
    parameter, or it could be coded into a class. There are probably other
    options for this part, too.

    Depending on what you choose for those pieces you also have a selection of
    mechanisms for connecting them together to create the class you want. The
    choices for that depend on your choices for the other pieces, however.


    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/-/Rk0rCBI1g8gJ.
    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
postedJan 15, '13 at 11:46p
activeJan 18, '13 at 4:29p
posts4
users2
websitepuppetlabs.com

2 users in discussion

Michael Dodwell: 2 posts Jcbollinger: 2 posts

People

Translate

site design / logo © 2022 Grokbase