Puppet-dashboard on CentOS.

I had to setup Puppet-dashboard for some company. Below is a description of how this has been done.

Setup puppetlabs repo:

root~# rpm -ivh http://yum.puppetlabs.com/el/6/products/i386/puppetlabs-release-6-7.noarch.rpm

Install Puppet Master:

root~# yum -y install puppet-server ruby-rdoc

Setup Puppet fileserver, The Puppet fileserver will serve configuration files, etc. out nodes in your network:

root~# mkdir /etc/puppet/files
root~# cp /etc/hosts /etc/puppet/files/

Edit /etc/puppet/fileserver.conf to point to /etc/puppet/files

root~# echo "[files]" > /etc/puppet/fileserver.conf
root~# echo "path /etc/puppet/files" >> /etc/puppet/fileserver.conf

Edit /etc/puppet/auth.conf and add the lines below to allow servers to connect to fileserver path above.

# Path to Puppet fileserver
path /files
auth any
allow *
# This should be insert above of this:
# deny everything else; this ACL is not strictly necessary, but
# illustrates the default policy.
path /
auth any

Create the initial site manifest /etc/puppet/manifests/site.pp where all configuration management will be defined.

root~# vi /etc/puppet/manifests/site.pp

node default {
file { '/etc/motd' :
source => 'puppet:///files/motd',
mode => 0644,
owner => "root",
group => "root",
}
}

This manifest will replace motd file on all clients to controlled by Puppet server.

And then restart a puppetmaster service by running the following:

root~# /etc/init.d/./puppetmaster restart

The puppet dashboard stores data in DB. So we have to install DB and create databases:

root~# yum -y install mysql-server
root~# /etc/init.d/mysqld start

root~# /usr/bin/mysql -u root

mysql> create database dashboard_production;
mysql> create database dashboard_development;
mysql> create database dashboard_test;
mysql> grant all on dashboard_production.* to dashboard@localhost identified by 'puppet';
mysql> grant all on dashboard_development.* to dashboard@localhost identified by 'puppet';
mysql> grant all on dashboard_test.* to dashboard@localhost identified by 'puppet';
mysql> quit;

Add previously created password to /usr/share/puppet-dashboard/config/database.yml file, so the file will look like this:

–cut
# At the moment, "adapter" can only be "mysql", and "encoding" should always
# be "utf8".
#
production:
database: dashboard_production
username: dashboard
password: puppet
encoding: utf8
adapter: mysql

development:
database: dashboard_development
username: dashboard
password: puppet
encoding: utf8
adapter: mysql

test:
database: dashboard_test
username: dashboard
password: puppet
encoding: utf8
adapter: mysql

–cut

The database configuration file also contains definitions for connecting to the development and test databases. Many operations on the dashboard are performed with rake. By default rake will assume the development environment. In order to perform operations on the production database, you need to specify this with the RAILS_ENV variable. If you’re not going to run the production and development on the same dashboard server, this might be cumbersome. You can set the same definition for production and development as this removes the need of having the specify the RAILS_ENV before every rake command.

At this point the tables should be created in the database.

root~# rake RAILS_ENV=production db:migrate
(in /usr/share/puppet-dashboard)
== BasicSchema: migrating ====================================================
-- create_table(:assignments, {:force=>true})
-> 0.0501s
...

And then restart puppet-dashboard service:

root~# /etc/init.d/puppet-dashboard restart

So now on you can connect to puppet-dashboard – http://your_IP_or_domain:3000/

Leave a Reply

Your email address will not be published. Required fields are marked *

*