自動(dòng)化運(yùn)維平臺(tái)puppet的高級(jí)應(yīng)用
一、模板的應(yīng)用
到目前為止,資源申報(bào)、定義類(lèi)、聲明類(lèi)等所有功能都只能一個(gè)manifest文件中實(shí)現(xiàn),但這卻非有效的基于puppet管理IT資源架構(gòu)的方式。實(shí)踐中,一般需要把manifest文件分解成易于理解的結(jié)構(gòu),例如將類(lèi)文件、配置文件甚至包括后面講提到的模板文件等分類(lèi)存放,并且通過(guò)某種機(jī)制在必要時(shí)將他們整合起來(lái)。這種機(jī)制即成為“模板”,它有助于結(jié)構(gòu)化、層次化的方式使用puppet,而puppet則基于“模塊自動(dòng)裝載器”完成模塊裝載
從另一個(gè)角度來(lái)說(shuō),模板實(shí)際上就是一個(gè)按約定的、預(yù)定義的機(jī)構(gòu)存放了多個(gè)文件或子目錄的目錄,目錄里的這些文件或子目錄必須遵循其命名規(guī)范。puppet會(huì)按照這種規(guī)范在特定位置查找所需的模塊文件,不過(guò),這些特定目錄頁(yè)可以通過(guò)puppet的配置參數(shù)modulepath定義
只要在某模塊中定于了一個(gè)類(lèi),就可以在任何manifest文件中使用它,puppet會(huì)自動(dòng)去查找并裝載包含了這個(gè)類(lèi)的定義的manifest文件任意使用它們。于是,基于模塊機(jī)制的puppet的主manifest文件就可以變得很小,也更易懂并能基于策略進(jìn)行定制
模塊目錄的結(jié)構(gòu)
在puppet中,模塊本身用一個(gè)目錄來(lái)表示,其需要存放于puppet的modulepath參數(shù)所定義的目錄中,如/etc/puppet/modules。模塊目錄名稱(chēng)必須與模塊名稱(chēng)相同,需要遵循特定的組織結(jié)構(gòu)
- MODULE NAME
 - manifests
 - init.pp
 - files
 - templates
 - lib
 - tests
 - spec
 
MODULE NAME:模塊名稱(chēng),也即模塊目錄名稱(chēng):模塊只能以小寫(xiě)字母開(kāi)頭,可以包含小寫(xiě)字母、數(shù)字和下劃線(xiàn),但不能使用“main”和“settings”作為模塊名
manifests目錄:包含當(dāng)前模塊的所有manifest文件:每個(gè)manifest文件包含了一個(gè)類(lèi)或一個(gè)定義的類(lèi)型,此文件訪(fǎng)問(wèn)路徑格式為“Modulename::[SubDirectoryName::]ManifestFileName”
init.pp:只能包含一個(gè)單獨(dú)的類(lèi)定義,且類(lèi)的名稱(chēng)必須與模塊名稱(chēng)相同
files目錄:包含了一組靜態(tài)的文件,這些文件可被站點(diǎn)下載使用:每個(gè)文件的訪(fǎng)問(wèn)路徑都遵循puppet:///modules/MODELE_NAME/filename路徑格式
lib目錄:插件目錄,常用于自定義fact及自定義資源類(lèi)型等
templates目錄:存儲(chǔ)了manifest用到的模板文件,其訪(fǎng)問(wèn)路徑遵循template(‘ModulesName/TemplateName’)格式,后綴名應(yīng)該為.erb,關(guān)于模板文件詳細(xì)信息,后文有介紹
tests目錄:當(dāng)前模板的使用幫助或使用范例文件,類(lèi)似如何聲明當(dāng)前模板中的類(lèi)及定義的類(lèi)型等
spec目錄:類(lèi)似于tests目錄的功能,只不過(guò),其是為lib目錄定義的各插件提供使用范例的
- [root@node1 ~]# mkdir -p /etc/puppet/modules/nginx/{manifests,files,templates,lib}
 - [root@node1 ~]# cd /etc/puppet/modules/nginx/
 - [root@node1 nginx]# cd manifests/
 - [root@node1 manifests]# vi init.pp
 - class nginx {
 - package {'nginx':
 - ensure => installed,
 - name => nginx,
 - }
 - }
 - [root@node1 manifests]# vi web.pp
 - class nginx::web inherits nginx {
 - service {'nginx':
 - ensure => true,
 - enable => true,
 - name => nginx,
 - require => Package['nginx'],
 - }
 - file{'web.conf':
 - ensure =>file,
 - source => "puppet:///modules/nginx/web.conf",
 - path => '/etc/nginx/nginx.conf',
 - notify => Service['nginx'],
 - require => Package['nginx']
 - }
 - }
 - [root@node1 manifests]# puppet apply -e 'include nginx::web'
 - notice: /Stage[main]/Nginx/Package[nginx]/ensure: created
 - notice: /Stage[main]/Nginx::Web/File[web.conf]/content: content changed '{md5}d9dfc198c249bb4ac341198a752b9458' to '{md5}33d2119b71f717ef4b981e9364530a39'
 - notice: /Stage[main]/Nginx::Web/Service[nginx]/ensure: ensure changed 'stopped' to 'running'
 - notice: Finished catalog run in 8.07 seconds
 - [root@node1 manifests]# grep work /etc/nginx/nginx.conf
 - worker_processes 2;
 
準(zhǔn)備nginx配置文件,并有意修改nginx的配置文件
- [root@node1 ~]# cp /etc/nginx/nginx.conf /etc/puppet/modules/nginx/files/web.conf
 - [root@node1 ~]# grep worker_processes /etc/puppet/modules/nginx/files/web.conf
 - worker_processes 2;
 
可以看到我們的配置執(zhí)行成功
使用模板配置文件
語(yǔ)法:<%= Ruby Expression %>:替代為表達(dá)式的值,在使用表達(dá)式時(shí)應(yīng)該使用@引用
<% ruby code %>:僅執(zhí)行代碼,不做任何替換,常用于條件判斷或循環(huán)語(yǔ)句、設(shè)定變量以及在輸出之前對(duì)數(shù)據(jù)進(jìn)行處理
<%# commit %>:注釋信息
<%%: 輸出<%
%%>:輸出%>
如上面的案例,在使用模板后
- [root@node1 manifests]# cp /etc/puppet/modules/nginx/files/web.conf /etc/puppet/modules/nginx/templates/conf.erb
 - [root@node1 manifests]# grep work /etc/puppet/modules/nginx/templates/conf.erb
 - worker_processes <%= @processorcount %>;
 - 表示nginx的線(xiàn)程數(shù)按照cpu的個(gè)數(shù)來(lái)啟動(dòng)
 - 類(lèi)應(yīng)該改為如下所示
 - class nginx::web inherits nginx {
 - service {'nginx':
 - ensure => true,
 - enable => true,
 - name => nginx,
 - require => Package['nginx'],
 - }
 - file{'web.conf':
 - ensure =>file,
 - content =>template('nginx/conf.erb'),
 - path => '/etc/nginx/nginx.conf',
 - notify => Service['nginx'],
 - require => Package['nginx']
 - }
 - }
 - [root@node1 manifests]# puppet apply -e 'include nginx::web'
 - notice: /Stage[main]/Nginx/Package[nginx]/ensure: created
 - notice: /Stage[main]/Nginx::Web/Service[nginx]/ensure: ensure changed 'stopped' to 'running'
 - notice: Finished catalog run in 8.25 seconds
 - [root@node1 manifests]# grep work /etc/nginx/nginx.conf
 - worker_processes 1;
 
#p#
二、master/agent
應(yīng)用場(chǎng)景:
統(tǒng)一資源管理軟件
統(tǒng)一配置系統(tǒng)優(yōu)化參數(shù)
定期檢測(cè)服務(wù)器是否運(yùn)行
主機(jī)上的軟件配置合理的屬性
1.安裝
前提:配置實(shí)用epel的yum源,而后使用yum命令安裝即可
環(huán)境規(guī)劃
192.168.1.201 puppet-server端
192.168.1.202 puppet-agent端
安裝部署puppet服務(wù)器端
- [root@node1 manifests]# yum install puppet-server
 
安裝部署puppet客戶(hù)端
- [root@node2 ~]# yum install puppet -y
 
2.解析雙方主機(jī)
解析雙方主機(jī),可以使用DNS和hosts文件,由于本處實(shí)驗(yàn)的緣故,故使用的為/etc/hosts文件來(lái)解析雙方主機(jī)
建議的主機(jī)命名方式:
角色名-運(yùn)營(yíng)商-機(jī)房名-機(jī)器ip.域名
- [root@node1 manifests]# cat /etc/hosts
 - 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
 - ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
 - 172.16.0.1 server.magelinux.com server
 - 192.168.1.201 node1.wangfeng7399.com node1
 - 192.168.1.202 node2.wangfeng7399.com node2
 - 192.168.1.203 node3.wangfeng7399.com node3
 - 192.168.1.204 node4.wangfeng7399.com node4
 
3.啟動(dòng)
1)啟動(dòng)puppet服務(wù)器端
收起啟動(dòng)puppet守護(hù)進(jìn)程時(shí),其會(huì)自動(dòng)進(jìn)行運(yùn)行環(huán)境的初始化,例如創(chuàng)建一個(gè)本地CA及服務(wù)器端相關(guān)的證書(shū)和密鑰等。初始化操作完成后,puppet就會(huì)監(jiān)聽(tīng)指定的套接字并等待客戶(hù)端的連接請(qǐng)求。默認(rèn)情況下,其證書(shū)和密鑰等文件位于/var/lib/puppet/ssl目錄中
出于調(diào)試的目的,建議***啟動(dòng)puppet服務(wù)進(jìn)程可以以非守護(hù)進(jìn)程方式進(jìn)行,并讓其輸出詳細(xì)信息以便于觀察初始化過(guò)程,如下所示,其逐步展示了創(chuàng)建本地主叫向CA申請(qǐng)證書(shū)、獲得證書(shū)以及CA移除證書(shū)簽署請(qǐng)求的過(guò)程等,而后啟動(dòng)服務(wù)進(jìn)程并準(zhǔn)備接受各agent端的連接請(qǐng)求
- [root@node1 manifests]# puppet master --no-daemonize --debug
 - [root@node1 manifests]# puppet master --no-daemonize --debug
 - debug: Failed to load library 'rubygems' for feature 'rubygems'
 - debug: Puppet::Type::User::ProviderDirectoryservice: file /usr/bin/dscl does not exist
 - debug: Puppet::Type::User::ProviderPw: file pw does not exist
 - debug: Puppet::Type::User::ProviderUser_role_add: file roledel does not exist
 - debug: Puppet::Type::User::ProviderLdap: true value when expecting false
 - debug: /File[/var/lib/puppet/facts]: Autorequiring File[/var/lib/puppet]
 - debug: /File[/var/lib/puppet/ssl/certs/ca.pem]: Autorequiring File[/var/lib/puppet/ssl/certs]
 - debug: /File[/etc/puppet/manifests]: Autorequiring File[/etc/puppet]
 - debug: /File[/var/lib/puppet/bucket]: Autorequiring File[/var/lib/puppet]
 - debug: /File[/var/lib/puppet/ssl/private_keys/node1.wangfeng7399.com.pem]: Autorequiring File[/var/lib/puppet/ssl/private_keys]
 - debug: /File[/var/lib/puppet/ssl/private_keys]: Autorequiring File[/var/lib/puppet/ssl]
 - debug: /File[/var/lib/puppet/server_data]: Autorequiring File[/var/lib/puppet]
 - debug: /File[/var/lib/puppet/rrd]: Autorequiring File[/var/lib/puppet]
 - debug: /File[/etc/puppet/puppet.conf]: Autorequiring File[/etc/puppet]
 - debug: /File[/var/lib/puppet/ssl/crl.pem]: Autorequiring File[/var/lib/puppet/ssl]
 - debug: /File[/etc/puppet/auth.conf]: Autorequiring File[/etc/puppet]
 - debug: /File[/var/lib/puppet/ssl/private]: Autorequiring File[/var/lib/puppet/ssl]
 - debug: /File[/var/lib/puppet/ssl/public_keys/node1.wangfeng7399.com.pem]: Autorequiring File[/var/lib/puppet/ssl/public_keys]
 - debug: /File[/etc/puppet/fileserver.conf]: Autorequiring File[/etc/puppet]
 - debug: /File[/var/lib/puppet/ssl/certs/node1.wangfeng7399.com.pem]: Autorequiring File[/var/lib/puppet/ssl/certs]
 - debug: /File[/var/lib/puppet/yaml]: Autorequiring File[/var/lib/puppet]
 - debug: /File[/var/lib/puppet/state]: Autorequiring File[/var/lib/puppet]
 - debug: /File[/var/lib/puppet/lib]: Autorequiring File[/var/lib/puppet]
 - debug: /File[/var/lib/puppet/ssl]: Autorequiring File[/var/lib/puppet]
 - debug: /File[/var/log/puppet/masterhttp.log]: Autorequiring File[/var/log/puppet]
 - debug: /File[/var/lib/puppet/ssl/certificate_requests]: Autorequiring File[/var/lib/puppet/ssl]
 - debug: /File[/var/lib/puppet/ssl/certs]: Autorequiring File[/var/lib/puppet/ssl]
 - debug: /File[/var/lib/puppet/reports]: Autorequiring File[/var/lib/puppet]
 - debug: /File[/var/lib/puppet/ssl/public_keys]: Autorequiring File[/var/lib/puppet/ssl]
 - debug: /File[/var/lib/puppet/ssl/public_keys/node1.wangfeng7399.com.pem]/mode: mode changed '0640' to '0644'
 - debug: /File[/var/lib/puppet/ssl/private_keys/node1.wangfeng7399.com.pem]/mode: mode changed '0640' to '0600'
 - debug: /File[/var/lib/puppet/ssl/certs/node1.wangfeng7399.com.pem]/mode: mode changed '0640' to '0644'
 - debug: Finishing transaction 70240930059560
 - debug: /File[/var/lib/puppet/ssl/ca/serial]: Autorequiring File[/var/lib/puppet/ssl/ca]
 - debug: /File[/var/lib/puppet/ssl/ca/inventory.txt]: Autorequiring File[/var/lib/puppet/ssl/ca]
 - debug: /File[/var/lib/puppet/ssl/ca/private]: Autorequiring File[/var/lib/puppet/ssl/ca]
 - debug: /File[/var/lib/puppet/ssl/ca/private/ca.pass]: Autorequiring File[/var/lib/puppet/ssl/ca/private]
 - debug: /File[/var/lib/puppet/ssl/ca/signed]: Autorequiring File[/var/lib/puppet/ssl/ca]
 - debug: /File[/var/lib/puppet/ssl/ca/requests]: Autorequiring File[/var/lib/puppet/ssl/ca]
 - debug: /File[/var/lib/puppet/ssl/ca/ca_key.pem]: Autorequiring File[/var/lib/puppet/ssl/ca]
 - debug: /File[/var/lib/puppet/ssl/ca/ca_pub.pem]: Autorequiring File[/var/lib/puppet/ssl/ca]
 - debug: /File[/var/lib/puppet/ssl/ca/ca_crt.pem]: Autorequiring File[/var/lib/puppet/ssl/ca]
 - debug: /File[/var/lib/puppet/ssl/ca/ca_crl.pem]: Autorequiring File[/var/lib/puppet/ssl/ca]
 - debug: /File[/var/lib/puppet/ssl/ca/ca_crt.pem]/mode: mode changed '0640' to '0660'
 - debug: /File[/var/lib/puppet/ssl/ca/ca_crl.pem]/mode: mode changed '0644' to '0664'
 - debug: /File[/var/lib/puppet/ssl/ca/ca_key.pem]/mode: mode changed '0640' to '0660'
 - debug: /File[/var/lib/puppet/ssl/ca/private/ca.pass]/mode: mode changed '0640' to '0660'
 - debug: Finishing transaction 70240928434340
 - debug: Using cached certificate for ca
 - debug: Using cached certificate for ca
 - debug: Using cached certificate for node1.wangfeng7399.com
 - notice: Starting Puppet master version 2.7.25
 
使用puppet master --genconfig可以查看服務(wù)器端的配置信息,建議將其輸出到/etc/puppet/puppet.conf中
- [root@node1 ~]# puppet master --genconfig >> /etc/puppet/puppet.conf
 
注意:如果此前曾以其主機(jī)名或各種原因啟動(dòng)過(guò)puppet客戶(hù)端過(guò)程并完成過(guò)初始化,其證書(shū)文件將無(wú)法符合本次啟動(dòng)的需要:此時(shí),需要先情況/var/lib/puppet/ssl目錄方可完成后續(xù)的初始化操作
如上述的測(cè)試啟動(dòng)沒(méi)有問(wèn)題,可終止當(dāng)前的啟動(dòng)后將其以守護(hù)進(jìn)程方式啟動(dòng)
- [root@node1 ~]# service puppetmaster start
 - Starting puppetmaster: [ OK ]
 - [root@node1 ~]# chkconfig puppetmaster on
 
2)啟動(dòng)puppet客戶(hù)端
puppet agent在***啟動(dòng)時(shí),會(huì)想起指定的puppet server申請(qǐng)證書(shū),并完成后續(xù)連接請(qǐng)求,同樣的理由,處于測(cè)試的目的,接入當(dāng)前puppet集群中的***agent節(jié)點(diǎn)可以以非守護(hù)進(jìn)程的方式運(yùn)行,以觀察其初始化過(guò)程
- [root@node2 ~]# puppet agent --server=node1.wangfeng7399.com --no-daemonize --debug
 - info: Creating a new SSL key for node2.wangfeng7399.com
 - info: Caching certificate for ca
 - info: Creating a new SSL certificate request for node2.wangfeng7399.com
 - info: Certificate Request fingerprint (md5): BC:B2:36:9F:B5:78:CD:60:1E:72:9A:D5:88:DE:4B:57
 
此時(shí),在puppet服務(wù)器端使用puppet cert命令管理客戶(hù)端的證書(shū)請(qǐng)求,其--list選項(xiàng)能夠查看等待簽署證書(shū)的客戶(hù)端列表,而--sign選項(xiàng)可用于為指定節(jié)點(diǎn)簽署證書(shū),如果要一次性地多個(gè)節(jié)點(diǎn)證書(shū)申請(qǐng)進(jìn)行簽署可以使用--all選項(xiàng)
- [root@node1 ~]# puppet cert --list
 - "node2.wangfeng7399.com" (BC:B2:36:9F:B5:78:CD:60:1E:72:9A:D5:88:DE:4B:57)
 - [root@node1 ~]# puppet cert --sign node2.wangfeng7399.com
 - notice: Signed certificate request for node2.wangfeng7399.com
 - notice: Removing file Puppet::SSL::CertificateRequest node2.wangfeng7399.com at '/var/lib/puppet/ssl/ca/requests/node2.wangfeng7399.com.pem'
 
一旦agent節(jié)點(diǎn)收到簽署過(guò)的證書(shū),其將會(huì)顯示如下信息
- info: Caching certificate for node2.wangfeng7399.com
 - notice: Starting Puppet client version 2.7.25
 
確保上述agent相關(guān)操作不存在問(wèn)題后,便可以將--server選項(xiàng)指定的信息存儲(chǔ)與agent的配置文件中,并以服務(wù)的方式啟動(dòng)puppet agent了。其配置文件為/etc/puppet/puppet.conf,配置完整既可以期待能夠puppet
- [root@node2 ~]# echo "server=node1.wangfeng7399.com" >> /etc/puppet/puppet.conf
 - [root@node2 ~]# service puppet start
 - Starting puppet: [ OK ]
 - [root@node2 ~]# chkconfig puppet on
 
#p#
4.授權(quán)訪(fǎng)問(wèn)
在puppet服務(wù)器端的/etc/puppet/manifests/中創(chuàng)建site.pp,在master/agent時(shí),所有節(jié)點(diǎn)清單文件入口文件為site.pp
- node node2.wangfeng7399.com {
 - incldue nginx::web
 - }
 
建議:一類(lèi)節(jié)點(diǎn)使用一個(gè)清單文件,所有清單文件都在site.pp中使用improt包含進(jìn)來(lái),清單文件修改后應(yīng)重啟文件
5.自動(dòng)簽發(fā)證書(shū)
可以設(shè)置master自動(dòng)簽發(fā)所有的證書(shū),我們只需要在/etc/puppet目錄下創(chuàng)建autosign.conf文件即可
- [root@node1 ~]# echo "*.wangfeng7399.com" > /etc/puppet/autosign.conf 
 
這樣就會(huì)對(duì)所有來(lái)自magedu.conf的機(jī)器的請(qǐng)求自動(dòng)簽署證書(shū)
6.puppet kick功能實(shí)現(xiàn)
puppet客戶(hù)端默認(rèn)每30分鐘很服務(wù)器通訊一次,但是有時(shí),我們希望服務(wù)器能夠給客戶(hù)端緊急推送一些人物,于是就有了puppet kick(puppet 2.6以前叫puppetrun)
1)編輯客戶(hù)端配置文件/etc/puppet/puppet.conf在[agent]端中添加如下
- root@node2 ~]# echo "listen=true" >> /etc/puppet/puppet.conf
 - [root@node2 puppet]# ss -tnl
 - State Recv-Q Send-Q Local Address:Port Peer Address:Port
 - LISTEN 0 5 *:8139 *:*
 
2)在客戶(hù)端編輯或創(chuàng)建新文件/etc/puppet/namespaceauth.conf,包含下面內(nèi)容
- [puppetrunner]
 - allow *.wangfeng7399.com
 
3)在客戶(hù)端編輯文件auth.conf,添加如下內(nèi)容
- path /run
 - method save
 - auth any
 - allow *.wangfeng7399.com
 
4)推送方法,在服務(wù)器端運(yùn)行命令
- [root@node1 puppet]# puppet kick -p 10 node2.wangfeng7399.com
 - Triggering node2.wangfeng7399.com
 - Getting status
 - status is success
 - node2.wangfeng7399.com finished with exit code 0
 - Finished
 
查看node2
- [root@node2 puppet]# rpm -q nginx
 - nginx-1.0.15-5.el6.x86_64
 - [root@node2 puppet]# grep work /etc/nginx/nginx.conf
 - worker_processes 1;
 
錯(cuò)誤信息,慘痛的教訓(xùn),客戶(hù)端一致在報(bào)這個(gè)錯(cuò)誤
- err: Could not retrieve catalog from remote server: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed: [certificate is not yet valid for /CN=Puppet CA: node1.wangfeng7399.com]
 - warning: Not using cache on failed catalog
 - err: Could not retrieve catalog; skipping run
 - debug: report supports formats: b64_zlib_yaml pson raw yaml; using pson
 - err: Could not send report: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed: [certificate is not yet valid for /CN=Puppet CA: node1.wangfeng7399.com]
 
解決方法:
兩臺(tái)服務(wù)器需要時(shí)間同步
7.安裝配置puppet-dashboard
1)安裝
- [root@node1 puppet]# rpm -ivh http://yum.puppetlabs.com/puppetlabs-release-el-6.noarch.rpm //安裝官方通過(guò)的yum倉(cāng)庫(kù)
 - [root@node1 puppet]# yum install puppet-dashboard -y
 - [root@node1 puppet]# yum install mysql-server mysql -y
 
2)數(shù)據(jù)庫(kù)授權(quán)
- mysql> create database dashboard character set utf8;
 - Query OK, 1 row affected (0.00 sec)
 - mysql> grant all on dashboard.* to 'dbuser'@'192.168.1.%' identified by 'wangfeng7399';
 - Query OK, 0 rows affected (0.00 sec)
 - mysql> flush privileges;
 - Query OK, 0 rows affected (0.00 sec)
 
3)修改配置文件,dashboard的配置文件為/usr/share/puppet-dashboard/config/database.yml,修改如下參數(shù)
- production:
 - host:192.168.1.201
 - database: dashboard
 - username: dbuser
 - password:wangfeng7399
 - encoding: utf8
 - adapter: mysql
 
為dashboard導(dǎo)入依賴(lài)的數(shù)據(jù)表
- [root@node1 config]# gem install rake
 - [root@node1 puppet]# cd /usr/share/puppet-dashboard/config
 - [root@node1 config]# rake gems::refresh_specs
 - [root@node1 config]# rake RAILS_ENV=production db:migrate
 
啟動(dòng)服務(wù)
- [root@node1 config]# service puppet-dashboard start
 - Starting Puppet Dashboard: => Booting WEBrick
 - => Rails 2.3.17 application starting on http://0.0.0.0:3000
 - [ OK ]
 
4)配置puppet服務(wù)器和客戶(hù)端
服務(wù)器端配置
在puppetmaster的配置文件中添加如下內(nèi)容
- reports = store, http
 - reporturl = http://192.168.1.201:3000/reports/upload
 - 在[master]中添加
 
客戶(hù)端配置
- report=true
 - 在[agent]中添加
 
配置完成后重啟puppet
5)測(cè)試
還可以在頁(yè)面中添加節(jié)點(diǎn)和類(lèi)文件
終于完成了,一個(gè)時(shí)間不同步弄了2小時(shí)才找出錯(cuò)誤
















 
 
 


 
 
 
 