Puppet and Foreman Installation

What is Puppet?

Puppet is a configuration management system that allows you to define the state of your IT infrastructure, then automatically enforces the correct state. Whether you’re managing just a few servers or thousands of physical and virtual machines, Puppet automates tasks that sysadmins often do manually, freeing up time and mental space so sysadmins can work on the projects that deliver greater business value. http://puppetlabs.com/puppet/what-is-puppet

What is Foreman?

Foreman is an open source project that helps system administrators manage servers throughout their lifecycle, from provisioning and configuration to orchestration and monitoring. Using Puppet or Chef and Foreman’s smart proxy architecture, you can easily automate repetitive tasks, quickly deploy applications, and proactively manage change, both on-premise with VMs and bare-metal or in the cloud. http://theforeman.org/learn_more.html

Installation of Puppet and Foreman (Ubuntu 14.04)

After the installation you will have a fully functional Puppet server with Foreman Web UI.

1. Step: Change your hostname and FQDN and set the desired values. In this example I use “puppetmaster” and “puppetmaster.example.com”. After first step is complete reboot the server.

$ sudo -i
# echo puppetmaster | sudo tee /etc/hostname
# sed -i s/\\tlocalhost/\ puppetmaster.example.com/g /etc/hosts
# sed -i '/puppetmaster.example.com/a puppetmaster.example.com puppetmaster' /etc/hosts

# reboot

2. Step: Add Puppet repos. Install Puppet agent and Puppetmaster. Change the config so that puppetmaster is enabled. Lastly restart Puppetmaster.

# sudo -i
# wget https://apt.puppetlabs.com/puppetlabs-release-trusty.deb
# dpkg -i puppetlabs-release-trusty.deb
# apt-get update
# apt-get install -y puppetmaster puppet
# sed -i s/START=no/START=yes/g /etc/default/puppetmaster
# service puppetmaster restart

3. Step: Add Foreman repos. Install Apache and Foreman-installer. Install Foreman.

# echo "deb http://deb.theforeman.org/ trusty stable" > /etc/apt/sources.list.d/foreman.list
# echo "deb http://deb.theforeman.org/ plugins stable" >> /etc/apt/sources.list.d/foreman.list
# wget -q http://deb.theforeman.org/pubkey.gpg -O- | apt-key add -
# apt-get update
# apt-get install -y apache2 foreman-installer
# foreman-installer > ./foreman.log

4. Step: Configure the Puppet agent on Puppetmaster server.

# sed -i '/\/var\/log\/puppet/a \server=puppetmaster.example.com' /etc/puppet/puppet.conf
# service puppet restart

5. Step: Check the details of foreman.log which includes the user name and password.

# cat foreman.log
* Foreman is running at https://puppetmaster.example.com
Initial credentials are admin / Dw4FHHbYYfTjoMVU
* Foreman Proxy is running at https://puppetmaster.example.com:8443
* Puppetmaster is running at port 8140
The full log is at /var/log/foreman-installer/foreman-installer.log

6. Step: In your browser open https://puppetmaster.example.com and login with the credentials provided in log file.

Congratulations! You have a ready Puppet server with Foreman WebUI.

Puppet and Foreman Installation


We are done with “Puppet and Foreman Installation”