创建必要的目录。Manifests存放模块的主要配置文件init.pp
Puppet在应用类后会首先加载init.pp读取必要的信息
如果init.pp使用templates函数,会读取templates目录下的erb模块文件
当前的变量也会传入templates函数中
mkdir -p /etc/puppet/modules/test/{manifests,templates,files}vi /etc/puppet/modules/test/manifests/init.pp定义类:class test{ file{"/tmp/$hostname.txt": context => "Hello world"; }}定义模板vi /etc/puppet/modules/test/templates/test.esbhostname <%= fqdn %>定义节点信息:节点目录可以任意定义,只需再site配置文件中import即可ru:vi /etc/pupprt/manifests/nodes/agent1.harry.com.ppnode 'agent1.harry.com'{ include test}在site.pp文件中import节点信息vi /etc/puppet/manifests/site.ppimport nodes/agent1.harry.com.pp