* Classes are named blocks of Puppet code, which can be created in one place and invoked elsewhere.
+
* Puppet 的 class 更像是宏, 但拥有变量域。
+
* ''include <class name>'' 来起作用。
+
* Modules:
+
* Modules are just directories with files, arranged in a specific, predictable structure. The manifest files within a module have to obey certain naming restrictions.
+
* Puppet looks for modules in a specific place (or list of places). This set of directories is known as the ''modulepath'', which is a [[https://docs.puppetlabs.com/references/stable/configuration.html#modulepath|configurable setting]]
+
* If a class is defined in a module, you can declare that class by name in //any manifest//. Puppet will automatically find and load the manifest that contains the class definition.
+
* 一个 module 就是一个路径, 模块名就是路径名
+
* module layout: 模块包含子文件夹''manifests'',''files'',''templates''等等, 详看[[https://docs.puppetlabs.com/puppet/latest/reference/modules_fundamentals.html| a page of info about module layout]] 以及 [[https://docs.puppetlabs.com/module_cheat_sheet.pdf| module cheat sheet]].
* Templates are saved as files with the ''.erb'' extension. and be stored in the ''templates/'' directory of any module. There can be any number of subdirectories inside ''templates/''.
+
* Use a template by the function ''template'': <code> file {'/etc/foo.conf':