Foreman is more than a Web Front End for puppet it provides a really nice interface to interact with puppet, it helps you to do the provisioning tasks that projects like cobbler does, but all in one place, it also shows the reports, facts and a bunch of very useful statistics in a cool way.
Foreman lately released the latest version 0.1-6 that provides support to the latest major puppet version 2.6.x. I want to share a quick installation of foreman and few screenshots of how it looks like in the latest version.
- DB(mysql, sqlite3, postgresql)
In this Example:
- Debian squeeze/sid
- puppet 2.6.2
- ruby 1.8.7
- rubygems 1.3.7
- rake 1.2.1
- rack 0.8.7
- mysql 5.1.49
- libdbd-mysql-ruby 0.4.4
If Stored Configs are not used, then it’s required to create the DB on which foreman will store all the data received from puppet.
Data Base Creation:
echo "CREATE DATABASE puppet; CREATE USER 'puppet'@'localhost' IDENTIFY BY 'mypassword'; GRANT ALL ON puppet.* TO 'puppet'@'localhost';" | mysql -uroot -p
Get Foreman(from a tarball):
pushd /opt wget http://theforeman.org/attachments/download/174/foreman-0.1-6.tar.bz2 tar xjf foreman-0.1-6.tar.bz2 popd
Foreman DB Configuration:
[/opt/foreman/config/database.yml] production: adapter: mysql database: puppet username: puppet password: mypassword host: localhost socket: "/var/run/mysqld/mysqld.sock"
Secure that file to be read only for the owner:
chmod 600 /opt/foreman/config/database.yml
DB Migration(and creation when it’s empty):
$ sudo RAIL_ENV="production" rake db:migrate == CreateHosts: migrating == ---output of all the DB migration---
Running the service:
$ sudo /opt/foreman/script/server -e production => Booting WEBrick => Rails 2.3.5 application starting on http://0.0.0.0:3000 /opt/foreman/script/../config/../vendor/rails/railties/lib/rails/gem_dependency.rb:119:Warning: Gem::Dependency#version_requirements is deprecated and will be removed on or after August 2010. Use #requirement => Call with -d to detach => Ctrl-C to shutdown server [2010-11-11 23:40:24] INFO WEBrick 1.3.1 [2010-11-11 23:40:24] INFO ruby 1.8.7 (2010-08-16) [x86_64-linux] [2010-11-11 23:40:29] INFO WEBrick::HTTPServer#start: pid=18276 port=3000
Open your browser into http://localhost:3000
Now we need some data to be able to display with foreman, as the data comes from puppet we need to import that data into foreman.
Importing Hosts and Facts into foreman(puppetmaster and foreman living in the same machine):
rake puppet:import:hosts_and_facts RAILS_ENV=”production”
Importing from /var/lib/puppet/yaml/facts
Making Available the Foreman Reports on Puppet:
Copy the foreman reports ruby script:
sudo cp /opt/foreman/extras/puppet/foreman/files/foreman-report.rb /usr/lib/ruby/1.8/puppet/reports/foreman.rb
Modify the forman_url to point to the correct server in this case localhost:
From: $foreman_url="http://foreman:3000" To: $foreman_url="http://localhost:3000"
Enable Foreman Reports in puppet.conf:
Modify the puppetmaster configuration under the main section.
[/etc/puppet/puppet.conf] # Adding reports for foreman reports=log,foreman
Don’t forget to Restart the puppetmaster server.
These are some screenshots of how foreman looks like.
 – http://www.theforeman.org/projects/foreman
 – http://www.puppetlabs.com
 – https://fedorahosted.org/cobbler