Thursday, April 23, 2015

Installing Puppet (open-source) and Puppet Dashboard on Oracle Linux 6.5 (UEK) 64-bit

Well, I had to provision a replacement Ops Management server recently, which meant configuring a new instance of Puppet, Puppet Dashboard, and getting the Puppet Clients to check in to the new server. I thought it would be a good time to document the process. The following is performed on an Oracle Linux 6.5 64-bit machine running the Unbreakable kernel.


Installing Puppet Master


Ensure we can get out over a corporate proxy:
# export http_proxy=http://DOMAIN\\USERNAME:PASSWORD@DOMAIN_PROXY_ADDRESS:PORT
# export https_proxy=http://DOMAIN\\USERNAME:PASSWORD@DOMAIN_PROXY_ADDRESS:PORT

 

Install Puppet Master:
# rpm -ivh https://yum.puppetlabs.com/el/6.5/products/x86_64/puppetlabs-release-6-11.noarch.rpm
# yum install puppet-server


Turn the service on and ensure it turns on the next time the system boots:
# chkconfig puppetmaster on
# service puppetmaster start



Installing Puppet Dashboard


Install packages required:
# yum install mysql mysql-server puppet-dashboard

Configure MYSQl and turn on:
# vi /etc/my.cnf (add the following)
max_allowed_packet = 32M

# chkconfig mysqld on; service mysqld start

# vi /usr/share/puppet-dashboard/config/settings.yml
(change the following)
time_zone: 'YOUR_TIME_ZONE'

 

Note: run ‘cd /usr/share/puppet-dashboard; sudo -u puppet-dashboard RAILS_ENV=production rake time:zones:local' to find your timezones

Create and configure the dashboard DB, user and permissions:
# mysql
mysql> CREATE DATABASE dashboard CHARACTER SET utf8;
mysql> CREATE USER 'dashboard'@'localhost' IDENTIFIED BY 'my_password';
mysql> GRANT ALL PRIVILEGES ON dashboard.* TO 'dashboard'@'localhost';
mysql> quit


# cd ~puppet-dashboard; rake gems:refresh_specs
# vi /usr/share/puppet-dashboard/config/database.yml

(change production database from dashboard_production to database. Also add the password of my_password)

# cd ~puppet-dashboard && rake RAILS_ENV=production db:migrate

Configure Puppet Master:
# cp /etc/puppet/puppet.conf /etc/puppet/puppet.conf.orig
# service puppetmaster stop


# vi /etc/puppet/puppet.conf

(it should look like this..)

-------------------------------
[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

    # Puppet Module Path
    modulepath = /etc/puppet/modules:/usr/share/puppet/modules

    # Import Custom Facts
    pluginsync = true


[agent]
    # The file in which puppetd stores a list of the classes
    # associated with the retrieved configuratiion.  Can be loaded in
    # the separate ``puppet`` executable using the ``--loadclasses``
    # option.
    # The default value is '$confdir/classes.txt'.
    classfile = $vardir/classes.txt

    # Where puppetd caches the local configuration.  An
    # extension indicating the cache format is added automatically.
    # The default value is '$confdir/localconfig'.
    localconfig = $vardir/localconfig

[master]
    # puppet certificate name
    certname=puppet.YOUR_DOMAIN

    # Set autosign on
    autosign = true

    reports = puppet_dashboard
    reportdir = /var/lib/puppet/reports
    reporturl = http://puppet.YOUR_DOMAIN:3000/reports/upload

    node_terminus  = exec
    external_nodes = /usr/bin/env PUPPET_DASHBOARD_URL=http://localhost:3000 /usr/share/puppet-dashboard/bin/external_node

-------------------------------

File configuration and permission changes:
# cp /usr/share/puppet-dashboard/ext/puppet/puppet_dashboard.rb /usr/lib/ruby/site_ruby/1.8/puppet/reports/
# mkdir /var/lib/puppet/reports
# chown puppet-dashboard:puppet-dashboard reports; chmod 766 reports
# touch /usr/share/puppet-dashboard/log/production.log
# chmod 666 /usr/share/puppet-dashboard/log/production.log

 

Turn it all on and ensure it starts on boot:
# chkconfig puppet-dashboard on; service puppet-dashboard start
# chkconfig puppet-dashboard-workers on ; service puppet-dashboard-workers start


Check it worked:
Browse to http://puppet:3000