0. Introduction to the Environment
System version: CentOS 6.6IP with host name: master01.cheney.com = 192.168.1.100agent01.cheney.com = 192.168.1.101
1.agent Installation
#安装puppet官方源rpm-IVH https://yum.puppetlabs.com/puppetlabs-release-el-6.noarch.rpm# Import gpg key rpm--import https:// yum.puppetlabs.com/rpm-gpg-key-puppetlabs# Installing Agentyum install ruby Ruby-libs Ruby-shadow puppet
2. Configure the Hosts file
PS: In the previous article we installed the DNSMASQ, if you follow the words can be directly in the "/etc/resolv.conf" file in the DNS point to the DNSMASQ server IP, and then on the DNSMASQ server's Hosts file added
Master01.cheney.com 192.168.1.100agent01.cheney.com 192.168.1.101
Can implement the domain name resolution, if not installed DNSMASQ, then both hosts files need to add just two records in the Hosts file.
3. Modify the master configuration file
Vim/etc/puppet/puppet.conf[master] #定义master段bindaddress = 0.0.0.0 #服务器监听地址, four zeros means all Masterport = 8140 #master监听 Port Ssldir =/etc/puppet/server_ssl #ssl认证文件路径logdir =/data1/puppet #日志文件路径manifest =/etc/puppet/manifests/site.pp #agent连接master时的起始配置文件modulepath =/etc/puppet/modules #模块目录certname = master01.chency.com #master的FQDN, full name [Agent] #定义agent段report = True #开启agent上报日志功能
4. Configuring the Site.pp File
vim/etc/puppet/manifests/site.ppnotify{"Hello World":} #notify的作用是发送 content of ' Hello World ' to agent terminal
5. Start Master
Puppet Master--verbose# can query the port after startup, can also query the log file to see the boot status netstat-tunlp |grep 8140tcp 0 0 0.0.0.0:8140 0.0.0.0:* LISTEN 5956/ruby
6. Start Agent
Puppet agent--server=master01.cheney.com--testinfo:retrieving pluginfactsinfo:retrieving plugininfo:caching Catalog for agent01.cheney.comInfo:Applying configuration version ' 1426151646 ' Notice:hello world #看到这行表示我们 Previous configuration was successful Notice:/stage[main]/main/notify[hello world]/message:defined ' message ' as ' Hello World ' notice:finished Catalog run in 0.33 seconds
PS: Because I have already done SSL authentication, so the content may not be the same as you, you have to manually pass the certification in the master file
Puppet cert sign ' agent01.cheney.com '
Then start the agent again and you'll see the correct information.
Preliminary study on puppet (2)--agent Access Master