Reference variables in a clear, unambiguous way that is consistent with the Puppet style.
When referencing facts, prefer the
$facts hash to plain top-scope
variables (such as
Although plain top-scope
variables are easier to write, the
$facts hash is clearer, easier to read, and
distinguishes facts from other top-scope variables.
When referencing top-scope variables other than facts, explicitly specify absolute namespaces for clarity and improved readability. This includes top-scope variables set by the node classifier and in the main manifest.
These special variable names are protected; because you cannot create local variables with these names, they always refer to top-scope variables.
When defining variables you must only use numbers, lowercase letters, and underscores. Do not use uppercased letters within a word, such as “CamelCase”, as it introduces inconsistency in style. You must not use dashes, as they are not syntactically valid.
$foo_bar $some_long_variable $foo_bar123
$fooBar $someLongVariable $foo-bar123