PUPPET集中化管理學習

puppetmaster 主機名puppet.zhouml.com
slave1主機名 slave.puppet1.com
slave2主機名 logserver-SW

安裝服務器端(master
rpm -ivh epel-release-5-4.noarch.rpm
yum install -y puppet puppet-server facter

服務器端hosts
[root@logserver-MO files]# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 puppet.zhouml.com puppet
::1 localhost6.localdomain6 localhost6
192.168.188.132 slave.puppet2.com
192.168.188.135 slave.puppet1.com



puppet 服務器端目錄樹

|-- auth.conf
|-- fileserver.conf
|-- manifests
| |-- nodes
| | |-- 1.pp
| | `-- 2.pp
| |-- nodes.pp
| |-- site.pp
| |-- site.pp.back
| |-- site.pp.new
| `-- zhouml.pp
|-- modules
| |-- mediaserver
| | |-- files
| | | `-- home
| | | `-- mediaserver
| | |-- manifests
| | | `-- init.pp
| | `-- templates
| |-- sudo
| | |-- files
| | | `-- etc
| | | `-- sudoers
| | |-- manifests
| | | `-- init.pp
| | `-- templates
| |-- svn
| | `-- templates
| `-- system
| |-- files
| | `-- puppet.conf
| |-- manifests
| | |-- init.pp
| | `-- puppet_client.pp
| `-- templates
`-- puppet.conf


服務器端/etc/puppet/puppet.conf 配置文件
[main]
# The Puppet log directory.
# The default value is '$vardir/log'.
logdir = /var/log/puppet

# Where Puppet PID files are kept.
# The default value is '$vardir/run'.
rundir = /var/run/puppet

# Where SSL certificates are kept.
# The default value is '$confdir/ssl'.
ssldir = $vardir/ssl

[agent]
# The file in which puppetd stores a list of the classes
# associated with the retrieved configuratiion. Can be loaded in
# the separate ``puppet`` executable using the ``--loadclasses``
# option.
# The default value is '$confdir/classes.txt'.
classfile = $vardir/classes.txt

# Where puppetd caches the local configuration. An
# extension indicating the cache format is added automatically.
# The default value is '$confdir/localconfig'.
localconfig = $vardir/localconfig
[master]
certname=puppet.zhouml.com
server=puppet.zhouml.com

推送mediaserver爲例子

入口文件site.pp
import 'nodes/1.pp'
include mediaserver
$puppetserver = 'puppet.zhouml.com'
注:此處'nodes/1.pp' 可支持通配符'nodes/*.pp'

節點定義
nodes下的1.pp  
node 'slave.puppet1.com' {
}

2.pp
node 'logserver-SW' {
}

模塊定義
|-- mediaserver
| |-- files
| | `-- home
| | `-- mediaserver
| |-- manifests
| | `-- init.pp
| `-- templates
|-- sudo
| |-- files
| | `-- etc

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章