FAQ
Hi,



I would like to use a defined type and enter parameters from the puppet console. So far I can only use defined types in a class because the puppet console only seems to allow assigning configuration via classes. This means that I can use the same class with different parameters for the same node...which is why I wanted to use a defined type. Is there any way around this?



Kind Regards

Chandra

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

  • AMARASINGHAM, Chandra at Oct 9, 2013 at 4:18 am
    Hi,



    Sorry I just saw my email and saw a typo....it should be re-written to include



    I can't use the same class with different parameters for the same node



    Any ideas....or a way around this?



    Chandra

    ________________________________
    From: puppet-users@googlegroups.com [puppet-users@googlegroups.com] on behalf of AMARASINGHAM, Chandra
    Sent: Tuesday, 8 October 2013 5:59 PM
    To: puppet-users@googlegroups.com
    Subject: [Puppet Users] parameters to a defined type from the puppet console


    Hi,



    I would like to use a defined type and enter parameters from the puppet console. So far I can only use defined types in a class because the puppet console only seems to allow assigning configuration via classes. This means that I can use the same class with different parameters for the same node...which is why I wanted to use a defined type. Is there any way around this?



    Kind Regards

    Chandra

    --
    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+unsubscribe@googlegroups.com.
    To post to this group, send email to puppet-users@googlegroups.com.
    Visit this group at http://groups.google.com/group/puppet-users.
    For more options, visit https://groups.google.com/groups/opt_out.

    --
    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+unsubscribe@googlegroups.com.
    To post to this group, send email to puppet-users@googlegroups.com.
    Visit this group at http://groups.google.com/group/puppet-users.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Paul Tötterman at Oct 9, 2013 at 6:17 am
    I can't use the same class with different parameters for the same node

    Classes can only be declared once per node. If you want multiple somethings
    per node, you need defined types.

    Would something like this work?

    define foo($param) {
       notice { $param: }
    }

    node example {
       foo { 'test1': }
       foo { 'test2': }
    }

    Cheers,
    Paul

    --
    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+unsubscribe@googlegroups.com.
    To post to this group, send email to puppet-users@googlegroups.com.
    Visit this group at http://groups.google.com/group/puppet-users.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Jcbollinger at Oct 9, 2013 at 2:09 pm

    On Tuesday, October 8, 2013 1:59:58 AM UTC-5, AMARASINGHAM, Chandra wrote:
    Hi,



    I would like to use a defined type and enter parameters from the puppet
    console. So far I can only use defined types in a class because the puppet
    console only seems to allow assigning configuration via classes. This
    means that I can use the same class with different parameters for the same
    node...which is why I wanted to use a defined type. Is there any way
    around this?
    External node classifiers, such as the one integrated into the Puppet
    console, cannot assign individual resources to nodes; they can only set
    global variables and assign classes. Defined type instances are resources.

    As Paul described, you can wrap multiple defined type instance declarations
    into a class, and assign that (via the console or otherwise). There are
    also approaches involving external data accessed via the hiera() function
    or automated class parameter binding. These would still involve preparing
    an appropriate class definition.


    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+unsubscribe@googlegroups.com.
    To post to this group, send email to puppet-users@googlegroups.com.
    Visit this group at http://groups.google.com/group/puppet-users.
    For more options, visit https://groups.google.com/groups/opt_out.
  • AMARASINGHAM, Chandra at Oct 9, 2013 at 10:44 pm
    Thanks John and Paul,



    I would like to use the console, and I think wrapping the resource (defined type) declaration in a class is still problematic for me because the parameters I would like to pass in still exist at the class level, thus causing a problem if I use different parameters for the same node.



    At the moment I have come up with a workaround where I declare the defined type in site.pp but reference a group level variable for setting parameters....this seems to work....but I would like the puppet administrator to be able to do all this via the console....any ideas let me know.



    Thanks again,

    Chandra

    ________________________________
    From: puppet-users@googlegroups.com [puppet-users@googlegroups.com] on behalf of jcbollinger [john.bollinger@stjude.org]
    Sent: Thursday, 10 October 2013 1:09 AM
    To: puppet-users@googlegroups.com
    Subject: [Puppet Users] Re: parameters to a defined type from the puppet console



    On Tuesday, October 8, 2013 1:59:58 AM UTC-5, AMARASINGHAM, Chandra wrote:

    Hi,



    I would like to use a defined type and enter parameters from the puppet console. So far I can only use defined types in a class because the puppet console only seems to allow assigning configuration via classes. This means that I can use the same class with different parameters for the same node...which is why I wanted to use a defined type. Is there any way around this?

    External node classifiers, such as the one integrated into the Puppet console, cannot assign individual resources to nodes; they can only set global variables and assign classes. Defined type instances are resources.

    As Paul described, you can wrap multiple defined type instance declarations into a class, and assign that (via the console or otherwise). There are also approaches involving external data accessed via the hiera() function or automated class parameter binding. These would still involve preparing an appropriate class definition.


    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+unsubscribe@googlegroups.com.
    To post to this group, send email to puppet-users@googlegroups.com.
    Visit this group at http://groups.google.com/group/puppet-users.
    For more options, visit https://groups.google.com/groups/opt_out.

    --
    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+unsubscribe@googlegroups.com.
    To post to this group, send email to puppet-users@googlegroups.com.
    Visit this group at http://groups.google.com/group/puppet-users.
    For more options, visit https://groups.google.com/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppuppet-users @
categoriespuppet
postedOct 8, '13 at 3:41p
activeOct 9, '13 at 10:44p
posts5
users3
websitepuppetlabs.com

People

Translate

site design / logo © 2022 Grokbase