使用 puppet 发布apache的例子,供大家学习参考。
服务端发布
[root@server manifests]# cat /etc/puppet/manifests/site.pp
复制代码 代码如下:
import 'nodes.pp'
#$puppetserver = 'server.manwrx.com'
[root@server manifests]# cat /etc/puppet/manifests/nodes.pp
node 'client.manwrx.com' {
include apache
}
[root@server apache]# ll -l /etc/puppet/modules/apache/
总计 24
drwxr-xr-x 2 root root 4096 07-26 03:58 files
drwxr-xr-x 2 root root 4096 07-26 04:22 manifests
drwxr-xr-x 2 root root 4096 07-26 03:58 templates
[root@server apache]# cat /etc/puppet/modules/apache/manifests/init.pp
复制代码 代码如下:
class apache {
package { httpd:
ensure => present;
}
}
客户端测试
复制代码 代码如下:
[root@client ~]# puppet agent --server server.manwrx.com --test
info: Caching catalog for client.manwrx.com
info: Applying configuration version '1343247871'
notice: /Stage[main]/Apache/Package[httpd]/ensure: created
notice: Finished catalog run in 5.49 seconds
[root@client ~]#