How to Install Puppet Server


AllCloud Blog:
Cloud Insights and Innovation

Introduction

Puppet is an IT automation software that help you provision, configure and manage your infrastructure.

In this guide I will show how to install puppet server with puppet dashboard.

Tested On

OS: CentOS release 6.3 x86_64
Puppet version: 3.0.2
Puppet-Dashboard version: 1.2.19
Hardware: Virtual Box 4.2.6

Install Puppet

  • Install Puppet repository
rpm -ihv https://yum.puppetlabs.com/el/6/products/x86_64/puppetlabs-release-6-6.noarch.rpm
  • Install puppet-server and puppet-dashboard packages
yum install puppet-server puppet-dashboard mysql-server -y
  • Start Puppet server and configure it to start on boot
service puppetmaster start
chkconfig puppetmaster on
  • Configure mysql to to allow 32MB maximum packet
vi /etc/my.cnf
...
# Allowing 32MB allows an occasional 17MB row with plenty of spare room
max_allowed_packet = 32M
...
  • Restart Mysql Server and configure it to run at boot
service mysqld restart
chkconfig mysqld on
  • Create new database for puppet dashboard (use your own username and password)
mysql
CREATE DATABASE dashboard CHARACTER SET utf8;
CREATE USER 'dashboard'@'localhost' IDENTIFIED BY 'dashboard';
GRANT ALL PRIVILEGES ON dashboard.* TO 'dashboard'@'localhost';
q
  • Configure puppet-dashboard database configuration file to use the new created database
vi /usr/share/puppet-dashboard/config/database.yml
production:
  database:

dashboard

  username:

dashboard

  password:

dashboard

  encoding: utf8
  adapter: mysql

development:
  database:

dashboard

  username:

dashboard

  password:

dashboard

  encoding: utf8
  adapter: mysql
  • Run rake on puppet-dashboard
cd /usr/share/puppet-dashboard
rake RAILS_ENV=production db:migrate
  • Configure Puppet agent to send reports to Puppet Dashboard
vi /etc/puppet/puppet.conf
[main]
    # The Puppet log directory.
    # The default value is '$vardir/log'.
    logdir = /var/log/puppet

    # Where Puppet PID files are kept.
    # The default value is '$vardir/run'.
    rundir = /var/run/puppet

    # Where SSL certificates are kept.
    # The default value is '$confdir/ssl'.
    ssldir = $vardir/ssl

reports = store, httpreporturl = https://localhost:80/reports/upload

...
  • Restart Puppet server and check the running config
service puppetmaster restart
puppet config print | less
  • Install EPEL repository and passenger module for Puppet Dashboard
rpm -ihv https://ftp.heanet.ie/pub/fedora/epel/6/i386/epel-release-6-8.noarch.rpm
yum install mod_passenger -y
  • Create VirtualHost configuration for Puppet Dashboard
cp /usr/share/puppet-dashboard/ext/passenger/dashboard-vhost.conf /etc/httpd/conf.d/
vi /etc/httpd/conf.d/dashboard-vhost.conf
PassengerHighPerformance on
PassengerMaxPoolSize 12
PassengerPoolIdleTime 1500
# PassengerMaxRequests 1000
PassengerStatThrottleRate 120
RailsAutoDetect On

<VirtualHost *:80>
           ServerName *:80
           DocumentRoot /usr/share/puppet-dashboard/public/
<Directory /usr/share/puppet-dashboard/public/>
           Options None
           Order allow,deny
           allow from all
</Directory>
           ServerSignature On

</VirtualHost>
  • Restart apache and configure it to run on boot, also restart puppet-dashboard-workers service and configure it to run on boot
service httpd restart
chkconfig httpd on
service puppet-dashboard-workers start
chkconfig puppet-dashboard-workers on
  • When you install a new client and configure it to use your Puppet server you must sign the client with a new certificate. With the following command you can check pending requests and sing them
puppet cert list
puppet cert sign "agent1"

That’s all. Now you need to install new puppet agents and manage through your puppet server.

Please visit https://puppetlabs.com/ for more information about Puppet configuration and usage.

Lahav Savir

Founder and CTO, Cloud Platforms

Read more posts by Lahav Savir