service puppetmaster start
pclient主机:
yum install puppet
chkconfig puppet on
service puppet start
配置puppet主机(服务器)的puppet.conf文件:
在原来的基础上添加以下内容
[agent]
server = puppet.onepc.com
certname = puppet.onepc.com
[master]
certname = puppet.onepc.com
更改后如下:
[root@puppet puppet]# vi 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> # 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
server = puppet.onepc.com
certname = puppet.onepc.com
[master]
certname = puppet.onepc.com
配置pclient主机的puppet.conf文件:
注:这里没有配置certname,默认是以主机名为certname。
[root@pclient puppet]# cat 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> # 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
server = puppet.onepc.comyg
参考:http://kisspuppet.com/2014/03/08/puppet_learning_base4/
目的:ntp软件自动安装,并且配置好ntp.conf文件
先把pclient主机上的ntp软件删除
[root@pclient puppet]# rpm -e --nodeps ntp-4.2.4p8-2.el6.centos.i686
warning: /etc/ntp.conf saved as /etc/ntp.conf.rpmsave
puppet主机上创建安装ntp模块:
[root@puppet /]# mkdir /etc/puppet/modules/ntp
[root@puppet /]# mkdir /etc/puppet/modules/ntp/{files,manifests,templates}
+restrict 192.168.198.0 mask 255.255.255.0 nomodify notrap
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).