When you run puppet 2.7.12 or higher you will see a warning message, telling you that dynamic variable scope look-up will be removed in puppet 2.8.x.
What to do if you have variables defined in a node definition?
- switch to hiera
- write a mockup
A mockup can be build in the following way:
- write a new module with a define
- use the define and add the proper parameter
Why do you have to do it that ugly way? Is there no way to give the scope of a node definition?
No. Nodes do not have any scope. Scope is limited to modules and classes.
class base_variable ( stage = first, dummyvariable ) {
case $dummyvariable {
'live': { $truevariable = 'live' }
'testing': { $truevariable = 'testing' }
'testing2': { $truevariable = 'testing2' }
}
}
In node definition you can now use the define:
node 'default.server.domain.tld' {
include stages
class { base_variable:
dummyvariable => 'testing2',
}
include base::dev
....
}
No comments:
Post a Comment