puppet连载六:创建测试模块test

创建测试模块

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

在dashboard上查看运行情况

puppet连载六:创建测试模块test
image.png
上一篇:JAVA常用类之日期处理


下一篇:Vsftp 安装配置(被动模式)