Parameterized classes were also made for this issue, but I don't recommend
going that route if you have several levels of classes being included
before you have to use the variable.

You might find it worthwhile to set $my_role in Hiera, and provide a sane
default within the webserver class.

On Sat, Aug 11, 2012 at 10:24 AM, Mark Roggenkamp <[email protected]
> wrote:

> You may want to consider making whatever needs $my_role into a define or
> class that can be used in another module. Then make a module to contain
> roles. These roles would be classes (since puppet has no role resources
> type like this) that include relevant defines/classes from other modules.
> I've found for my use cases composing things that way works a bit better,
> though of course YMMV.
>
> Regards,
> Mark
>
> On Friday, August 10, 2012 4:28:33 PM UTC-4, Douglas wrote:
>>
>> So...
>>
>> I was just reading the new puppet scoping documentation at
>> http://docs.puppetlabs.com/**guides/scope_and_puppet.html<http://docs.puppetlabs.com/guides/scope_and_puppet.html>.
>>
>>
>> I don't get it. If I have this...
>>
>> class web_server {
>>     include common
>>     include webserver
>>     $my_role = "web_server"
>> }
>>
>> Can I access the $my_role variable in the webserver class?
>>
>> Doug.
>>
>  --
> 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/-/_6R6QOKDXugJ.
>
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/puppet-users?hl=en.
>



-- 

James Sweeny
Professional Services
http://puppetlabs.com/

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to