Foreman installation and Configuration

What is Foreman ?

Foreman as name suggesting for a SUPERVISOR, is an open source Life Cycle Management Tool for servers, which can be used:

  • To Provision physical or Virtaul machines or Servers on Cloud.
  • Management of software and Configuration (Configuration Managemnt)
  • Monitoring of servers (Reporting and graphs)

Why Foreman ?

Due to it’s User friendly web UI and deep integration with different CM tools (Puppet, Ansible or Chef) through various plugins (API) it helps to deploy, automate and manage different server and server components.

It has has ability to provide Bare Metal Provisioning on Physical, Virtualized or Cloud based infrastructure by its PXE based installation with help of its DNS/DHCP and TFTP services.

LAB Setup

Foreman can run on Puppet Server itself or separately on some other node. In our example we will be deploying foreman on same node as puppet master. Also we will see puppet run reporting through it.

Hostname: master.lab.example.com
IP: 172.25.250.116/24
Spec: 3Gb Ram, 2 CPU, 25Gb HDD, CentOS 7

Installation

It can be installed directly, but if you are not comfortable with Puppet itself, we will suggest you to check you below blogs to Deploy & Using Puppet or can directly install using : https://github.com/HemantGangwar/puppetSetup

- https://learningtechnix.wordpress.com/2019/12/07/deploying-puppet-tool-using-ansible-just-for-fun/
- https://learningtechnix.wordpress.com/2020/04/15/hindi-video-puppet-6-installation-and-configuration-on-linux/

Configuring Pre-Requisite Repositories/Packages:

# yum install centos-release-scl-rh -y
# yum --enablerepo=centos-sclo-rh-testing install rh-postgresql12-postgresql-server -y
# rpm -ivh https://yum.theforeman.org/releases/latest/el7/x86_64/foreman-release-2.0.0-1.el7.noarch.rpm
# yum install https://download-ib01.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-12.noarch.rpm -y

Installing Foreman & Basic Configuration

# yum -y install foreman-installer
# foreman-installer
OR
# foreman-installer --foreman-initial-admin-username=myadmin --foreman-initial-admin-password=redhat
  • Once it is deployed, configure firewall to allow 443 & 8443 tcp port
[root@master ~]# firewall-cmd --permanent --add-port=8443/tcp
success
[root@master ~]# firewall-cmd --permanent --add-port=443/tcp
success
[root@master ~]# firewall-cmd --reload
success
[root@master ~]# firewall-cmd --list-ports
8140/tcp 8443/tcp 443/tcp
[root@master ~]#
  • Modify your basemodulepath in puppet configuration and restart puppet service
[root@master ~]# cat /etc/puppetlabs/puppet/puppet.conf | grep -i basemodulepath
basemodulepath = /etc/puppetlabs/code/environments/production/modules:/etc/puppetlabs/code/environments/common:/etc/puppetlabs/code/modules:/opt/puppetlabs/puppet/modules:/usr/share/puppet/modules
[root@master ~]#
[root@master ~]# systemctl restart puppetserver
[root@master ~]#

We have created a video link for Puppet setup & Foreman Installation and basic setup

Getting Started

Now when we have configured Foreman Successfully, it’s time to dirty our hands.

Accessing GUI

Login to GUI using https://master.lab.example.com & provide credentials set above:

MANAGED HOSTS

So we can see the host view to identify the hosts managed by puppetmaster and reporting to Foreman by Navigation the left most column:

Hosts > All Hosts

CONFIGURING CLASSES

Let’s quickly create a puppet module to deploy few Packages

[root@master production]# mkdir -p modules/globalpackage/manifests
[root@master production]# vi modules/globalpackage/manifests/init.pp
[root@master production]# cat modules/globalpackage/manifests/init.pp
class globalpackage {
$mycustompackage = [ 'vsftpd', 'vim-enhanced', 'tree', 'mlocate', 'telnet', 'curl', 'links' ]
package { $mycustompackage: ensure => 'present', } }
[root@master production]#
[root@master production]# echo 'include globalpackage' > manifests/site.pp
[root@master production]# systemctl restart puppetserver
[root@master production]#

Uploading the class to Foreman GUI :

Configure > Classes > Import environments from master.lab.example.com

Select the environments and press Update

HOST REPORTING

To see more details using a host, select Hosts > All Hosts > Select host of your choice

By default it will give details about various system specs and hosts facts. try exploring all the tabs to see what information they are providing.

Now to see what changes came in last run or puppet report, Select Reports Tab

Dashboard Info

Select Monitor > Dashboard to see the dashboard view, here you can add or remove widgets of your choice. Try exploring other potions provided with Monitor tab.

Conclusion

Till now we expect, you have a fair idea about Foreman and you should be able to deploy and test it in your custom environment, by following the steps in this blog. Though we only touch the tip of iceberg yet, still Do let us know if you face any challenged, and we will try to answer those by all proper means.

Please like, share, comment and subscribe if you like our work, and support our Profit free venture to distributing knowledge.

Thank You …

Leave a comment