I'm writing a custom provider and I'm only going to use it in the context of the module it's attached to. The module will already define things for the resource which I need to act on (e.g. username, password, IP Address). What I'm trying to do is access a variable in scope in the puppet manifest from the custom provider.
Is this possible?
init.pp:
class mymodule(
$username = 'admin',
-- snip --
}
provider.rb:
class Puppet::Provider::MyProvider < Puppet::Provider
def self.configure
#can I get to $mymodule::username here?
Some context:
I'm writing a set of types that will configure a server via an API. I want to have a type like:
mymodule_mail_settings { 'current':
server => 'mail.server.com'
mailuser => 'mail'
}
What I'm trying to avoid is having to pass the username/password/ip to access the server's API passed into all of these different types.