configuration was kept in the master only

1) puppet master

sudo apt-get install puppetmaster



/etc/puppet/manifests/site.pp ( to install git on agent )

node "pong-VirtualBox" {
package { "git-core":
ensure => "installed"

NOTE : site.pp is the main file to call all pp
by using

import "xx.pp"

ensure => “installed” v.s. ensure=>”present”
see the different in https://ask.puppetlabs.com/question/4947/is-it-better-to-use-present-or-installed/

or we can add another

: require => Package[“another-packagename”], require => File[“foldername”]

more about npm/gem install : https://dsin.wordpress.com/2017/11/29/puppet-package-gem-install-bundler-npm-install-bower/

more about file : https://dsin.wordpress.com/2017/11/29/puppet-file/


service { "servicename":
enable => true, ensure => running,
require => Package["packagename"],

NOTE : pp can be imported, For example,

import nodes/*.pp
sudo service puppetmaster restart

ถ้าใครอยากดูพวกข้อความต่างๆ บน Master แบบ Real-Time ให้รันแบบนี้แทน

sudo puppet master --verbose --no-daemonize

list cert of agent

sudo puppet cert list

NOTE : –all sign cert

sudo puppet cert sign puppetClientInTheServerEtcHostsFile

use it efficiently try Puppetmasterd https://docs.puppetlabs.com/guides/passenger.html


2) puppet agent

sudo apt-get install puppet



Default internal is 30 minutes polling, but we can change runinterval=10

sudo service puppet restart

enable agent to begin poll to master

sudo puppet agent --enable

This will store PID in the /var/run/puppet/agent.pid or in the process

puppet 1794 0.2 2.0 129260 41212 ? Ssl 09:18 0:03 /usr/bin/ruby1.8 /usr/bin/puppet master --masterport=8140
root 2833 0.0 2.0 132992 41224 ? Ss 09:34 0:00 /usr/bin/ruby1.8 /usr/bin/puppet agent

poll now

sudo puppet agent --test
info: Caching catalog for pong-virtualbox
info: Applying configuration version '1450775961'
info: Creating state file /var/lib/puppet/state/state.yaml
notice: /Stage[main]//Node[pong-virtualbox]/File[/root/helloworld.txt]/ensure: created
notice: Finished catalog run in 0.01 seconds

ref : http://www.kanouivirach.com/2014/11/puppet-master-and-agent-on-local/ http://manuel.kiessling.net/2014/03/26/building-manageable-server-infrastructures-with-puppet-part-1/


3) puppet module Download from : https://forge.puppetlabs.com/ puppet version 2.7.11 did not have the module subcommand, so /etc/puppet/puppet.conf



ref : http://serverfault.com/questions/349046/could-not-find-class-and-yet-it-is-there



  • modulepath is a search path for modules.
  • puppet.conf references is here. -> https://docs.puppetlabs.com/references/4.3.latest/configuration.html



ref : http://docs.puppetlabs.com/puppet/latest/reference/modules_installing.html


Create own module



|__ init.pp ( contains modulename class ) 


|__whatever.js.whatever.erb init.pp
class modulename($whatever_param="value"){
package{ ... }
file{ ... }

calling class

class { "modulename": whatever_param=> "vv" }

ref : https://docs.puppetlabs.com/puppet/latest/reference/lang_conditional.html

NOTE: we can use in template <%= whatever_param %> <% if @whatever_param == true %> <% end %>

ref : https://docs.puppetlabs.com/pe/latest/quick_writing_nix.html

Problem when purging logstash

userdel: user logstash is currently logged in
mv /opt/logstash /opt/_logstash

Then we can purge logstash.





Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s