创建测试模块
mkdir -p /etc/puppet/modules/test/{manifests,templates,files}
vi /etc/puppet/modules/test/manifests/init.pp
class test {
file {"/tmp/$hostname.txt":content=>"Hello World!";}
}
vi /etc/puppet/modules/test/templates/test.erb
hostname <%= fqdn %>
添加节点
mkdir -p /etc/puppet/manifests/nodes/
vi /etc/puppet/manifests/nodes/huangat-test.pp
node 'huangat-test' {
include test
}
vi /etc/puppet/manifests/site.pp
node default {
notify {'test-success':
name => 'test-suecces1',
message => 'connect successtest',
}
}
import "nodes/*.pp"
检测语法
puppet parser validate /etc/puppet/modules/test/manifests/init.pp
检查语法,客户端
puppet agent --test --server zhoulj-test --noop
执行
mco puppet runonce -I huangat-test -v