Puppet: system configuration and manage tool
and , computer manage and configuration data manage . for IaaS, Paas, Saas , , computer . for data , how to manage , configuration these Scale computer node , for data as well as all to .
Puppet is a system configuration manage tool , has as well as ; simultaneously , Puppet provide has system configuration as well as , very manage and Scalesystem .
Puppet system
Puppet use C/S , Puppet Server and Puppet Node.
1. Puppet

Puppet Server
Puppet Server is configuration and manage , manage all node . system manage in Puppet Server Puppet has configuration node configuration file (manifest), configuration file node status —— . these can is file , service , . node Puppet Server, configuration file , and in these configuration file , and status to configuration file to .
Puppet Node(Agent)
Puppet Master manage computer node Puppet node. Puppet node Puppet Master, configuration file , and in . in configuration file , Puppet node provide Puppet Master, and . system manage can in Puppet Node command , let Puppet Node Puppet Server configuration file , and in .
Puppet
Puppet can : , , , .
2. Puppet

(Define)
manage node configuration file , configuration file node need as well as . these can is file , service , , can command . Puppet configuration manage for these provide , configuration file .
(Simulate)
according to node configuration file , we can to node need and status . configuration file node status , not is configuration . Puppet will configuration file Manifest configuration file Catalog. via Catalog, Puppet according to node status , node to status need .
(Enforce)
node Puppet Server configuration file . Puppet will node status and node configuration file status , according to to need , for node operation , to configuration file status .
(Report)
, node all Puppet Server , node status , and .
Puppet configuration Introduction
Puppet configuration manage is , can is a , a file , service . a node status can as well as . manage not need configuration and system , Puppet need manage system status , as well as . Puppet according to node has status will configuration file and .
in Puppet , is ; is . Puppet provide some and , simultaneously user can and . via and use , configuration and very .
Installation and Configuration
Environment Configuration
Puppet Server and between nodes via , need can via to for IP Address. can via configuration DNS or configuration /ets/hosts file implement .
Installation Preparation
in provide Puppet , Puppet Server and agent need all (Puppet for Linux all has provide support , Ubuntu 14.04 system ):
:
|
1
|
wget https://apt.puppetlabs.com/puppetlabs-release-pc1-trusty.deb |
:
|
1
2
|
sudo dpkg -i puppetlabs-release-pc1-trusty.debsudo apt-get update |
Installation Puppet Server
|
1
|
sudo apt-get install puppetserver |
Start PuppetServer
|
1
|
sudo service puppetservice start |
Installation PuppetAgent
|
1
|
sudo apt-get install puppet-agent |
/etc/puppetlabs/puppet/puppet.conf file , setting agent puppet server Address:
|
1
2
|
[main]server = puppetmaster |
: puppetmaster is puppetserver .
Start puppet service
|
1
|
sudo /opt/puppetlabs/bin/puppet resource service puppet ensure=running enable=true |
a configuration file
a Hello World configuration file
a configuration file , we let node : in /etc/file a file helloworld.txt, file is ”hello world from puppet!/n”.
we in puppetserver /etc/puppetlabs/code/environments/production/manifests file , site.pp file :
|
1
2
3
4
5
6
7
8
9
10
11
12
|
node puppetagent {file { 'helloworld': path => '/etc/helloworld.txt', owner => 'root', group => 'root', mode => '655', content => "hello world from puppet!/n", }} |
site.pp is node configuration file , can for node configuration . in configuration file , ”puppetagent”is node . in puppetagent configuration is node .
configuration file , node PuppetServer configuration file in . Puppet support configuration . in , we via method perform configuration Update. we in PuppetAgent command :
|
1
2
3
4
5
6
7
8
9
10
11
12
13
|
root@puppetAgent:/opt/puppetlabs/bin# ./puppet agent --test2016-05-21 14:24:14.858673 WARN puppetlabs.facter - locale environment variables were bad; continuing with LANG=C LC_ALL=CInfo: Using configured environment 'production'Info: Retrieving pluginfactsInfo: Retrieving pluginInfo: Caching catalog for puppetagentInfo: Applying configuration version '1463811856'Notice: /Stage[main]/Main/Node[puppetagent]/File[helloworld]/ensure: defined content as '{md5}c3aa68786c58c94ef6f3e2399920f268'Notice: Applied catalog in 0.02 secondsroot@puppetAgent:/opt/puppetlabs/bin# cat /etc/helloworld.txt hello world from puppet! |
we to node from Puppet Server configuration file , and in , for file .
:
, we node can some . we node can from PuppetServer a command Script, and .
we in /etc/puppetlabs/code/environments/production/modules a ”test” , in test a ”files”file . in this file file is can node . then we in this ”files”file a shell Script test.sh, :
/etc/puppetlabs/code/environments/production/modules/test/files/test.sh
test.sh file :
|
1
2
|
touch /etc/helloworld.logecho "helloworld" >> /etc/helloworld.log |
in /etc/directory helloworld.log file , then in file ”hello world”.
directory /etc/puppetlabs/code/environments/production/manifests, then we site.pp file :
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
node puppetagent {file { 'test.sh': path => '/etc/test.sh', owner => 'root', group => 'root', mode => '655', source => 'puppet:///modules/test/test.sh', }exec { 'execute ': command => 'bash /etc/test.sh', require => File['test.sh'], path => ["/bin/"],}} |
, we : a file and a command . simultaneously has , command file , Puppet file . command in file in .
we :
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
root@puppetAgent:/opt/puppetlabs/bin# ./puppet agent --test2016-05-21 15:39:39.817370 WARN puppetlabs.facter - locale environment variables were bad; continuing with LANG=C LC_ALL=CInfo: Using configured environment 'production'Info: Retrieving pluginfactsInfo: Retrieving pluginInfo: Caching catalog for puppetagentInfo: Applying configuration version '1463816381'Notice: /Stage[main]/Main/Node[puppetagent]/File[test.sh]/ensure: defined content as '{md5}2ce060ad2ddab2fe416ca8fb6f8da32a'Notice: /Stage[main]/Main/Node[puppetagent]/Exec[execute ]/returns: executed successfullyNotice: Applied catalog in 0.05 secondsroot@puppetAgent:/opt/puppetlabs/bin# cat /etc/helloworld.log helloworld |
we can to , helloworld.log file , file .
Puppet is Ruby system configuration and manage tool , provide system configuration system manage manage and configuration system process . Introduction Puppet system and , and Introduction Puppet system configuration , we IntroductionInstallation and Configuration Puppet . , Introductionhow to in Puppet node configuration file , to file and command . can for system manage , Puppet has Help.
https://www.ibm.com/developerworks/cn/opensource/os-cn-puppet/index.html