Scope
In Puppet terms, scope reflects the location in the code where variables can be directly accessed without the use of namespaces and where resource defaults can be affected.
There are three levels of scope:
- Top scope: Any code outside of a class, type, or node definition. Any variable or resource declaration in the top scope will be accessible to be read or used anywhere.
- Node scope: Any code defined in a node definition. Any variables and resource defaults in the node scope will be visible to nodes that match the node definition at the node and local scope levels.
- Local scope: Any code defined in a class, defined type, or lambda. So, any variables and resource defaults defined will only be visible within that specific resource.
Both External Node Classifiers (ENCs) and node definitions will be discussed in Chapter 11. All we need to understand for this section is that an ENC is an executable script that returns variables and classes to be applied to...