下面的一个配置,适合后端多轮询机器的配置,比如后端很多apache在做负载均衡
nodezhandouji {
file { "temp1.txt":
name => "/tmp/ttttt" ,
content => "first puppet manifest", /使 client机器生成一个/tmp/tttt/ 文件,内容是content
owner => "root",
group => "users",
mode => 0777; } ##最简单的文件功能
#file { "/tmp/motd": ensure => "/etc/motd" ,owner => "sync",group => "users" ;}
#这个是做软连的
########################################### 下面这个是单独一个功能##
#客户端同步服务器端的xxx文件,会diff一下,如有不同,将会重启服务
#以下例子可以实现配置文件更改后,客户端自行重启自己的apache服务
file {
"apache":
name => "/tmp/apache.conf",
content => template("test/test.txt");
#文件目录是 /etc/puppet/modules/test/templates/test.txt
}
service {
apache2:
# binary => "/usr/local/apache2/bin/apachectl",
# ensure => "running";
subscribe => File[apache],
restart => "/etc/rc.d/apache2 restart";
}
#######################################################
#file {
# "/usr/local/linlin.txt" :
# source => "puppet:///linlin/linlin.txt";
#file -> "/etc/puppet/modules/linlin/files/linlin.txt"
文件目录是 /etc/puppet/modules/test/files/linlin.txt
# }
file {
"/tmp/test" :
ensure => "directory",
source => "puppet:///linlin",
owner => "sync",
group => "users",
recurse => "true";
}
}
转载于:https://blog.51cto.com/linuxguy/862739