零基础学习Puppet自动化配置管理系列文档

MCollective只是一个框架,如果需要在上面发挥各种作用,那就需要各种插件的支持。官方提供了很多这方面的插件,除此之外,还有第三方的插件,比如shell插件等,下面会介绍各种插件的安装,以及插件之间如何组合进行使用。

1、在mcollective client端和server端安装各种官网plugins

首先去官网下载各个插件 http://yum.puppetlabs.com

1.1 下载collective-client端

[root@linuxmaster1poc~]#rpm-qa|grepmcomcollective-service-common-3.1.2-1.noarchmcollective-client-2.2.4-1.el6.noarchmcollective-service-client-3.1.2-1.noarchmcollective-common-2.2.4-1.el6.noarchmcollective-iptables-common-3.0.1-1.noarchmcollective-filemgr-client-1.0.1-1.noarchmcollective-nrpe-client-3.0.2-1.noarchmcollective-puppet-client-1.6.0-1.noarchmcollective-nrpe-common-3.0.2-1.noarchmcollective-filemgr-common-1.0.1-1.noarchmcollective-iptables-client-3.0.1-1.noarchmcollective-puppet-common-1.6.0-1.noarchmcollective-facter-facts-1.0.0-1.noarchmcollective-package-client-4.2.0-1.noarchmcollective-package-common-4.2.0-1.noarch

1.2 下载mcollecitve-server端

[root@linux57poc~]#rpm-qa|grepmcomcollective-nrpe-common-3.0.2-1mcollective-puppet-common-1.6.0-1mcollective-iptables-common-3.0.1-1mcollective-iptables-agent-3.0.1-1mcollective-2.2.4-1.el5mcollective-package-common-4.2.0-1mcollective-service-common-3.1.2-1mcollective-service-agent-3.1.2-1mcollective-puppet-agent-1.6.0-1mcollective-package-agent-4.2.0-1mcollective-filemgr-common-1.0.1-1mcollective-common-2.2.4-1.el5mcollective-facter-facts-1.0.0-1mcollective-filemgr-agent-1.0.1-1mcollective-nrpe-agent-3.0.2-1

以上安装可写个package模块执行,以下只针对mcollective server端,安装完成之后记得重启服务,如果写了service模块可以自动刷新

1.3 编写plugins.pp

classmcollective::plugins{includemcollective::plugins_puppet,mcollective::plugins_facter,mcollective::plugins_filemgr,mcollective::plugins_iptables,#mcollective::plugins_nettest,#这个安装需要依赖包ruby-net-ping,没找到mcollective::plugins_nrpe,mcollective::plugins_package,mcollective::plugins_service}#mco-clientneedinstallmcollective-puppet-clientandmcollective-puppet-commonclassmcollective::plugins_puppet{package{['mcollective-puppet-agent','mcollective-puppet-common']:ensure=>installed,require=>Class["mcollective::install"]}}#mco-clientneedinstallmcollective-facter-factsclassmcollective::plugins_facter{package{'mcollective-facter-facts':ensure=>installed,require=>Class["mcollective::install"]}}#mco-clientneedinstallmcollective-filemgr-clientandmcollective-filemgr-commonclassmcollective::plugins_filemgr{package{['mcollective-filemgr-agent','mcollective-filemgr-common']:ensure=>installed,require=>Class["mcollective::install"]}}#mco-clientneedinstallmcollective-iptables-clientandmcollective-iptables-commonclassmcollective::plugins_iptables{package{['mcollective-iptables-agent','mcollective-iptables-common']:ensure=>installed,require=>Class["mcollective::install"]}}#mco-clientneedinstallmcollective-nettest-clientandmcollective-nettest-commonclassmcollective::plugins_nettest{package{['mcollective-nettest-agent','mcollective-nettest-common']:ensure=>installed,require=>Class["mcollective::install"]}}#mco-clientneedinstallmcollective-nrpe-clientandmcollective-nrpe-commonclassmcollective::plugins_nrpe{package{['mcollective-nrpe-agent','mcollective-nrpe-common']:ensure=>installed,require=>Class["mcollective::install"]}}#mco-clientneedinstallmcollective-package-clientandmcollective-package-commonclassmcollective::plugins_package{package{['mcollective-package-agent','mcollective-package-common']:ensure=>installed,require=>Class["mcollective::install"]}}#mco-clientneedinstallmcollective-service-clientandmcollective-service-commonclassmcollective::plugins_service{package{['mcollective-service-agent','mcollective-service-common']:ensure=>installed,require=>Class["mcollective::install"]}}

1.4 编写conf.pp

classmcollective::service{service{'mcollective':ensure=>running,hasstatus=>true,hasrestart=>true,enable=>true,subscribe=>Class['mcollective::config'],}}

1.5 mcollective-client端安装好之后,可通过mco命令查看

[root@linuxmaster1poc~]#mcoTheMarionetteCollectiveversion2.2.4usage:/usr/bin/mcocommand<options>Knowncommands:completionfactsfilemgrfindhelpinventoryiptablesnrpepackagepingpluginpuppetrpcserviceshellType'/usr/bin/mcohelp'foradetailedlistofcommandsand'/usr/bin/mcohelpcommand'togetdetailedhelpforacommand

1.6 mcollective-server端安装好之后,可在mco-client端查看

[root@linuxmaster1poc~]#mcoinventorylinux57pocInventoryforlinux57poc:ServerStatistics:Version:2.2.4StartTime:FriDec1308:15:46+08002013ConfigFile:/etc/mcollective/server.cfgCollectives:mcollectiveMainCollective:mcollectiveProcessID:23268TotalMessages:16MessagesPassedFilters:16MessagesFiltered:0ExpiredMessages:0RepliesSent:15TotalProcessorTime:0.71secondsSystemTime:0.15secondsAgents:#都加载上了discoveryfilemgrnrpepackagepuppetrpcutilserviceshellDataPlugins:agentfstatnrpepuppetresourceserviceConfigurationManagementClasses:NoclassesappliedFacts:architecture=>x86_64augeasversion=>0.10.0bios_release_date=>06/22/2012bios_vendor=>PhoenixTechnologiesLTDbios_version=>6.00blockdevice_fd0_size=>4096blockdevice_hdc_size=>3834736640。。。

注意: 接下来测试各种命令的操作组合,这里只举一些例子,更多信息可参考--help或者参考官网

2、安装shell插件

插件下载地址:https://github.com/kisspuppet/mcollective-plugins,有github客户端的童鞋可直接clone https://github.com/kisspuppet/mcollective-plugins.git

2.1、下载插件放在对应的目录里即可

mcollective-client端[root@linuxmaster1poc~]#ll/usr/libexec/mcollective/mcollective/application/|grepshell-rw-r--r--1rootroot1601Aug606:36shell.rb[root@linuxmaster1poc~]#ll/usr/libexec/mcollective/mcollective/agent/|grepshell-rw-r--r--1rootroot1017Aug606:36shell.ddl-rw-r--r--1rootroot862Aug606:36shell.rbmcollective-server端[root@linux57pocagent]#ll/usr/libexec/mcollective/mcollective/agent/|grepshell-rw-r--r--1rootroot1017Aug606:36shell.ddl-rw-r--r--1rootroot862Aug606:36shell.rb

备注:mcollective-server端部署完成之后,记得重启mcollective服务。

2.2、 查看shell插件是否加载成功

从下面可以看出mcollective-client端shell插件已经有了

[root@linuxmaster1poc~]#mcoTheMarionetteCollectiveversion2.2.4usage:/usr/bin/mcocommandKnowncommands:completionfactsfindhelpinventorypingpluginpuppetrpcshell#shell插件加载OKType'/usr/bin/mcohelp'foradetailedlistofcommandsand'/usr/bin/mcohelpcommand'togetdetailedhelpforacommand

从下面可以看出mcollective-server端shell插件也加载了

[root@linuxmaster1poc~]#mcoinventorylinux57pocInventoryforlinux57poc:ServerStatistics:Version:2.2.4StartTime:FriDec1301:14:14+08002013ConfigFile:/etc/mcollective/server.cfgCollectives:mcollectiveMainCollective:mcollectiveProcessID:23898TotalMessages:10MessagesPassedFilters:10MessagesFiltered:0ExpiredMessages:0RepliesSent:9TotalProcessorTime:0.73secondsSystemTime:0.17secondsAgents:discoverypuppetrpcutilshell#shell插件加载OKDataPlugins:agentfstatpuppetresourceConfigurationManagementClasses:NoclassesappliedFacts:architecture=>x86_64augeasversion=>0.10.0bios_release_date=>06/22/2012bios_vendor=>PhoenixTechnologiesLTDbios_version=>6.00blockdevice_fd0_size=>4096blockdevice_hdc_size=>3834736640blockdevice_sda_model=>Virtualdiskblockdevice_sda_size=>42949672960。。。

2.3、通过shell插件执行shell命令

mcoshell帮助信息[root@linuxmaster1poc~]#mcoshell--helpMCollectiveDistributedShellUsage:mcoshell<CMD>TheCMDisastringEXAMPLES:mcoshelluptime--np,--no-progressDonotshowtheprogressbar-1,--oneSendrequesttoonlyonediscoverednodes--batchSIZEDorequestsinbatches--batch-sleepSECONDSSleeptimebetweenbatches--limit-seedNUMBERSeedvaluefordeterministicrandombatching--limit-nodes,--ln,--limitCOUNTSendrequesttoonlyasubsetofnodes,canbeapercentage-j,--jsonProduceJSONoutput--displayMODEInfluencehowresultsaredisplayed.Oneofok,allorfailed-c,--configFILELoadconfiguratuionfromfileratherthandefault-v,--verboseBeverbose-h,--helpDisplaythisscreenCommonOptions-T,--targetCOLLECTIVETargetmessagestoaspecificsubcollective--dt,--discovery-timeoutSECONDSTimeoutfordoingdiscovery-t,--timeoutSECONDSTimeoutforcallingremoteagents-q,--quietDonotbeverbose--ttlTTLSetthemessagevalidityperiod--reply-toTARGETSetacustomtargetforreplies--dm,--disc-methodMETHODWhichdiscoverymethodtouse--do,--disc-optionOPTIONOptionstopasstothediscoverymethod--nodesFILEListofnodestoaddressHostFilters-W,--withFILTERCombinedclassesandfactsfilter-S,--selectFILTERCompoundfiltercombiningfactsandclasses-F,--wf,--with-factfact=valMatchhostswithacertainfact-C,--wc,--with-classCLASSMatchhostswithacertainconfigmanagementclass-A,--wa,--with-agentAGENTMatchhostswithacertainagent-I,--wi,--with-identityIDENTMatchhostswithacertainconfiguredidentityTheMarionetteCollective2.2.4

显示对端uptime命令负载情况

[root@linuxmaster1poc~]#mcoshell"uptime"Doyoureallywanttosendthiscommandunfiltered?(y/n):yDiscoveringhostsusingthemcmethodfor2second(s)....3Host:linux58pocStatuscode:0Output:02:45:02up21:10,2users,loadaverage:0.00,0.00,0.00Host:linux64pocStatuscode:0Output:02:45:02up20:59,1user,loadaverage:0.00,0.00,0.00Host:linux57pocStatuscode:0Output:02:45:02up21:04,3users,loadaverage:0.00,0.00,0.00

显示所有节点/etc/password文件中puppet用户哪一行

[root@linuxmaster1poc~]#mcoshell"cat/etc/passwd|greppuppet"Doyoureallywanttosendthiscommandunfiltered?(y/n):yDiscoveringhostsusingthemcmethodfor2second(s)....3Host:linux58pocStatuscode:0Output:puppet:x:52:52:Puppet:/var/lib/puppet:/sbin/nologinHost:linux64pocStatuscode:0Output:puppet:x:52:52:Puppet:/var/lib/puppet:/sbin/nologinHost:linux57pocStatuscode:0Output:puppet:x:52:52:Puppet:/var/lib/puppet:/sbin/nologin

修改其中一台主机的root密码

[root@linuxmaster1poc~]#mcoshell"echoredhat|passwdroot--stdin"-Ilinux57pocHost:linux57pocStatuscode:0Output:Changingpasswordforuserroot.passwd:allauthenticationtokensupdatedsuccessfully.

备注:更多操作步骤可参考mco shell --help帮助。

警告:基于mcollective的shell插件虽然功能很强大,除了动态显示的命令之外,其它root能操作的,它基本上都能操作。所以操作也非常危险,可根据生产环境实际情况而定。

注意: 接下来测试各种命令的操作组合,这里只举一些例子,更多信息可参考--help或者参考官网

3、组合mcollective各种plugins完成各种任务组合

3.1、停止操作系统为RHEL5.x服务器的crond任务

先查看5.x系统crond的状态,使用插件 service、facts

[root@linuxmaster1poc~]#mcoservicecrondstatus-Foperatingsystemmajrelease=5*[============================================================>]2/2linux57poc:runninglinux58poc:runningSummaryofServiceStatus:running=2Finishedprocessing2/2hostsin184.79ms

然后通过service插件停止服务,使用插件 service、facts

[root@linuxmaster1poc~]#mcoservicecrondstop-Foperatingsystemmajrelease=5*[============================================================>]2/2SummaryofServiceStatus:stopped=2Finishedprocessing2/2hostsin914.76ms

再次查看过滤的主机crond服务是否被停掉,使用插件 service、facts

[root@linuxmaster1poc~]#mcoservicecrondstatus-Foperatingsystemmajrelease=5*[============================================================>]2/2linux57poc:stoppedlinux58poc:stoppedSummaryofServiceStatus:stopped=2Finishedprocessing2/2hostsin125.87ms

也可以通过shell插件实现,使用到插件为shell、service、facts

[root@linuxmaster1poc~]#mcoshell"servicecrondstatus"-Foperatingsystemmajrelease=5Discoveringhostsusingthemcmethodfor2second(s)....2Host:linux57pocStatuscode:3Output:crondisstoppedHost:linux58pocStatuscode:3Output:crondisstopped

3.2、使用mco对自定义fact_apply4=app的主机做一次变更,要求环境为testing,模式为noop

首先查看下那些主机具备有这个自定义fact,使用的插件为find、inventory

[root@linuxmaster1poc~]#foriin`mcofind`;doecho$i;mcoinventory$i|grepfact_apply4;donelinux58pocfact_apply4=>applinux57poclinux64pocfact_apply4=>app

其次按要求做变更即可,使用到的插件为puppet,facts

[root@linuxmaster1poc~]#mcopuppet-vrunonce--environment=testing--noop-Ffact_apply4=appDiscoveringhostsusingthemcmethodfor2second(s)....2*[============================================================>]2/2linux64poc:OK{:summary=>"StartedabackgroundPuppetrunusingthe'puppetagent--onetime--daemonize--color=false--splay--splaylimit30--noop--environmenttesting'command"}linux58poc:OK{:summary=>"StartedabackgroundPuppetrunusingthe'puppetagent--onetime--daemonize--color=false--splay--splaylimit30--noop--environmenttesting'command"}----rpcstats----Nodes:2/2Pass/Fail:2/0StartTime:FriDec1309:10:50+08002013DiscoveryTime:2003.32msAgentTime:884.34msTotalTime:2887.67ms

变更完成后,迅速查看节点运行情况,使用到的插件为puppet [root@linuxmaster1poc ~]# mco puppet status

*[============================================================>]3/3linux64poc:Currentlyidling;lastcompletedrun54secondsagolinux58poc:Currentlyapplyingacatalog;lastcompletedrun1minutes12secondsagolinux57poc:Currentlystopped;lastcompletedrun22minutes57secondsagoSummaryofApplying:false=2true=1SummaryofDaemonRunning:running=2stopped=1SummaryofEnabled:enabled=3SummaryofIdling:false=2true=1SummaryofStatus:idling=1stopped=1applyingacatalog=1Finishedprocessing3/3hostsin263.72ms


3.3、远程改所有系统为RHEL6.4主机root的密码,使用到的插件为shell,facts

[root@linuxmaster1poc~]#mcoshell"echoredhat|passwdroot--stdin"-Foperatingsystemrelease=6.4Discoveringhostsusingthemcmethodfor2second(s)....1Host:linux64pocStatuscode:0Output:Changingpasswordforuserroot.passwd:allauthenticationtokensupdatedsuccessfully.

3.4、查看所有节点puppet和facter安装包的版本信息,使用到的插件为package

[root@linuxmaster1poc~]#mcopackagestatuspuppet*[============================================================>]3/3linux64poc:puppet-2.7.23-1.el6.noarchlinux57poc:puppet-2.7.23-1.el5.noarchlinux58poc:puppet-2.7.23-1.el5.noarchSummaryofArch:noarch=3SummaryofEnsure:2.7.23-1.el5=22.7.23-1.el6=1Finishedprocessing3/3hostsin635.21ms[root@linuxmaster1poc~]#mcopackagestatusfacter*[============================================================>]3/3linux58poc:facter-1.7.3-1.el5.x86_64linux64poc:facter-1.7.3-1.el6.x86_64linux57poc:facter-1.7.3-1.el5.x86_64SummaryofArch:x86_64=3SummaryofEnsure:1.7.3-1.el5=21.7.3-1.el6=1Finishedprocessing3/3hostsin124.99ms

更多的功能可通过以下方式查看:

[root@linuxmaster1poc~]#mcopuppet-hScheduleruns,enable,disableandinterrogatethePuppetAgentUsage:mcopuppet[OPTIONS][FILTERS]<ACTION>[CONCURRENCY|MESSAGE]Usage:mcopuppet<count|enable|status|summary>Usage:mcopuppetdisable[message]Usage:mcopuppetrunonce[PUPPETOPTIONS]Usage:mcopuppetresourcetypenameproperty1=valueproperty2=valueUsage:mcopuppetrunall[--rerunSECONDS][PUPPETOPTIONS]TheACTIONcanbeoneofthefollowing:count-returnatotalcountofrunning,enabled,anddisablednodesenable-enablethePuppetAgentifitwaspreviouslydisableddisable-disablethePuppetAgentpreventingcatalogfrombeingappliedresource-manageindividualresourcesusingthePuppetType(RAL)systemrunall-invokeapuppetrunonmatchingnodes,makingsuretoonlyrunCONCURRENCYnodesatatimerunonce-invokeaPuppetrunonmatchingnodesstatus-showsashortsummaryabouteachPuppetAgentstatussummary-showsresourceandruntimesummaries--forceBypasssplayoptionswhenrunning--serverSERVERConnecttoaspecificserverorport--tags,--tagTAGRestricttheruntospecifictags--noopDoanooprun--no-noopDoarunwithnoopdisabled--environmentENVIRONMENTPlacethenodeinaspecificenvironmentforthisrun--splaySplaytherunbyuptosplaylimitseconds--no-splayDoarunwithsplaydisabled--splaylimitSECONDSMaximumsplaytimeforthisrunifsplayisset--ignoreschedulesDisablescheduleprocessing--rerunSECONDSWhenperformingrunalldosorepeatedlywithaminimumruntimeofSECONDS--np,--no-progressDonotshowtheprogressbar-1,--oneSendrequesttoonlyonediscoverednodes--batchSIZEDorequestsinbatches--batch-sleepSECONDSSleeptimebetweenbatches--limit-seedNUMBERSeedvaluefordeterministicrandombatching--limit-nodes,--ln,--limitCOUNTSendrequesttoonlyasubsetofnodes,canbeapercentage-j,--jsonProduceJSONoutput--displayMODEInfluencehowresultsaredisplayed.Oneofok,allorfailed-c,--configFILELoadconfiguratuionfromfileratherthandefault-v,--verboseBeverbose-h,--helpDisplaythisscreenCommonOptions-T,--targetCOLLECTIVETargetmessagestoaspecificsubcollective--dt,--discovery-timeoutSECONDSTimeoutfordoingdiscovery-t,--timeoutSECONDSTimeoutforcallingremoteagents-q,--quietDonotbeverbose--ttlTTLSetthemessagevalidityperiod--reply-toTARGETSetacustomtargetforreplies--dm,--disc-methodMETHODWhichdiscoverymethodtouse--do,--disc-optionOPTIONOptionstopasstothediscoverymethod--nodesFILEListofnodestoaddressHostFilters-W,--withFILTERCombinedclassesandfactsfilter-S,--selectFILTERCompoundfiltercombiningfactsandclasses-F,--wf,--with-factfact=valMatchhostswithacertainfact-C,--wc,--with-classCLASSMatchhostswithacertainconfigmanagementclass-A,--wa,--with-agentAGENTMatchhostswithacertainagent-I,--wi,--with-identityIDENTMatchhostswithacertainconfiguredidentityTheMarionetteCollective2.2.42、组合mcollective各种plugins完成各种任务组合

2.1、停止操作系统为RHEL5.x服务器的crond任务

先查看5.x系统crond的状态,使用插件 service、facts

[root@linuxmaster1poc~]#mcoservicecrondstatus-Foperatingsystemmajrelease=5*[============================================================>]2/2linux57poc:runninglinux58poc:runningSummaryofServiceStatus:running=2Finishedprocessing2/2hostsin184.79ms

然后通过service插件停止服务,使用插件 service、facts

[root@linuxmaster1poc~]#mcoservicecrondstop-Foperatingsystemmajrelease=5*[============================================================>]2/2SummaryofServiceStatus:stopped=2Finishedprocessing2/2hostsin914.76ms

再次查看过滤的主机crond服务是否被停掉,使用插件 service、facts

[root@linuxmaster1poc~]#mcoservicecrondstatus-Foperatingsystemmajrelease=5*[============================================================>]2/2linux57poc:stoppedlinux58poc:stoppedSummaryofServiceStatus:stopped=2Finishedprocessing2/2hostsin125.87ms

也可以通过shell插件实现,使用到插件为shell、service、facts

[root@linuxmaster1poc~]#mcoshell"servicecrondstatus"-Foperatingsystemmajrelease=5Discoveringhostsusingthemcmethodfor2second(s)....2Host:linux57pocStatuscode:3Output:crondisstoppedHost:linux58pocStatuscode:3Output:crondisstopped

2.2、使用mco对自定义fact_apply4=app的主机做一次变更,要求环境为testing,模式为noop

首先查看下那些主机具备有这个自定义fact,使用的插件为find、inventory

[root@linuxmaster1poc~]#foriin`mcofind`;doecho$i;mcoinventory$i|grepfact_apply4;donelinux58pocfact_apply4=>applinux57poclinux64pocfact_apply4=>app

其次按要求做变更即可,使用到的插件为puppet,facts

[root@linuxmaster1poc~]#mcopuppet-vrunonce--environment=testing--noop-Ffact_apply4=appDiscoveringhostsusingthemcmethodfor2second(s)....2*[============================================================>]2/2linux64poc:OK{:summary=>"StartedabackgroundPuppetrunusingthe'puppetagent--onetime--daemonize--color=false--splay--splaylimit30--noop--environmenttesting'command"}linux58poc:OK{:summary=>"StartedabackgroundPuppetrunusingthe'puppetagent--onetime--daemonize--color=false--splay--splaylimit30--noop--environmenttesting'command"}----rpcstats----Nodes:2/2Pass/Fail:2/0StartTime:FriDec1309:10:50+08002013DiscoveryTime:2003.32msAgentTime:884.34msTotalTime:2887.67ms

变更完成后,迅速查看节点运行情况,使用到的插件为puppet [root@linuxmaster1poc ~]# mco puppet status

*[============================================================>]3/3linux64poc:Currentlyidling;lastcompletedrun54secondsagolinux58poc:Currentlyapplyingacatalog;lastcompletedrun1minutes12secondsagolinux57poc:Currentlystopped;lastcompletedrun22minutes57secondsagoSummaryofApplying:false=2true=1SummaryofDaemonRunning:running=2stopped=1SummaryofEnabled:enabled=3SummaryofIdling:false=2true=1SummaryofStatus:idling=1stopped=1applyingacatalog=1Finishedprocessing3/3hostsin263.72ms


3、远程改所有系统为RHEL6.4主机root的密码,使用到的插件为shell,facts

[root@linuxmaster1poc~]#mcoshell"echoredhat|passwdroot--stdin"-Foperatingsystemrelease=6.4Discoveringhostsusingthemcmethodfor2second(s)....1Host:linux64pocStatuscode:0Output:Changingpasswordforuserroot.passwd:allauthenticationtokensupdatedsuccessfully.

4、查看所有节点puppet和facter安装包的版本信息,使用到的插件为package

[root@linuxmaster1poc~]#mcopackagestatuspuppet*[============================================================>]3/3linux64poc:puppet-2.7.23-1.el6.noarchlinux57poc:puppet-2.7.23-1.el5.noarchlinux58poc:puppet-2.7.23-1.el5.noarchSummaryofArch:noarch=3SummaryofEnsure:2.7.23-1.el5=22.7.23-1.el6=1Finishedprocessing3/3hostsin635.21ms[root@linuxmaster1poc~]#mcopackagestatusfacter*[============================================================>]3/3linux58poc:facter-1.7.3-1.el5.x86_64linux64poc:facter-1.7.3-1.el6.x86_64linux57poc:facter-1.7.3-1.el5.x86_64SummaryofArch:x86_64=3SummaryofEnsure:1.7.3-1.el5=21.7.3-1.el6=1Finishedprocessing3/3hostsin124.99ms

更多的功能可通过以下方式查看:

[root@linuxmaster1poc~]#mcopuppet-hScheduleruns,enable,disableandinterrogatethePuppetAgentUsage:mcopuppet[OPTIONS][FILTERS]<ACTION>[CONCURRENCY|MESSAGE]Usage:mcopuppet<count|enable|status|summary>Usage:mcopuppetdisable[message]Usage:mcopuppetrunonce[PUPPETOPTIONS]Usage:mcopuppetresourcetypenameproperty1=valueproperty2=valueUsage:mcopuppetrunall[--rerunSECONDS][PUPPETOPTIONS]TheACTIONcanbeoneofthefollowing:count-returnatotalcountofrunning,enabled,anddisablednodesenable-enablethePuppetAgentifitwaspreviouslydisableddisable-disablethePuppetAgentpreventingcatalogfrombeingappliedresource-manageindividualresourcesusingthePuppetType(RAL)systemrunall-invokeapuppetrunonmatchingnodes,makingsuretoonlyrunCONCURRENCYnodesatatimerunonce-invokeaPuppetrunonmatchingnodesstatus-showsashortsummaryabouteachPuppetAgentstatussummary-showsresourceandruntimesummaries--forceBypasssplayoptionswhenrunning--serverSERVERConnecttoaspecificserverorport--tags,--tagTAGRestricttheruntospecifictags--noopDoanooprun--no-noopDoarunwithnoopdisabled--environmentENVIRONMENTPlacethenodeinaspecificenvironmentforthisrun--splaySplaytherunbyuptosplaylimitseconds--no-splayDoarunwithsplaydisabled--splaylimitSECONDSMaximumsplaytimeforthisrunifsplayisset--ignoreschedulesDisablescheduleprocessing--rerunSECONDSWhenperformingrunalldosorepeatedlywithaminimumruntimeofSECONDS--np,--no-progressDonotshowtheprogressbar-1,--oneSendrequesttoonlyonediscoverednodes--batchSIZEDorequestsinbatches--batch-sleepSECONDSSleeptimebetweenbatches--limit-seedNUMBERSeedvaluefordeterministicrandombatching--limit-nodes,--ln,--limitCOUNTSendrequesttoonlyasubsetofnodes,canbeapercentage-j,--jsonProduceJSONoutput--displayMODEInfluencehowresultsaredisplayed.Oneofok,allorfailed-c,--configFILELoadconfiguratuionfromfileratherthandefault-v,--verboseBeverbose-h,--helpDisplaythisscreenCommonOptions-T,--targetCOLLECTIVETargetmessagestoaspecificsubcollective--dt,--discovery-timeoutSECONDSTimeoutfordoingdiscovery-t,--timeoutSECONDSTimeoutforcallingremoteagents-q,--quietDonotbeverbose--ttlTTLSetthemessagevalidityperiod--reply-toTARGETSetacustomtargetforreplies--dm,--disc-methodMETHODWhichdiscoverymethodtouse--do,--disc-optionOPTIONOptionstopasstothediscoverymethod--nodesFILEListofnodestoaddressHostFilters-W,--withFILTERCombinedclassesandfactsfilter-S,--selectFILTERCompoundfiltercombiningfactsandclasses-F,--wf,--with-factfact=valMatchhostswithacertainfact-C,--wc,--with-classCLASSMatchhostswithacertainconfigmanagementclass-A,--wa,--with-agentAGENTMatchhostswithacertainagent-I,--wi,--with-identityIDENTMatchhostswithacertainconfiguredidentityTheMarionetteCollective2.2.4返回主目录交流方式:

微信公众号:puppet2014,可微信搜索加入,也可以扫描以下二维码进行加入

微信公众号

QQ交流群:296934942