How to Install and Configure Foreman on CentOS 7
Foreman is a free and open source configuration management and provisioning tool for physical and virtual servers. Foreman performs the repetitive and other configuration tasks using the tools like puppet, chef and Ansible. For provisioning, Foreman make the use of DHCP, DNS, TFTP and kickstart file.Though in this article we are going to use puppet tool with Foreman.
Foreman provides a dashboard from where system administrator can perform all configuration and audit task, we can also get the reports like how many nodes are managed by foreman and what configuration has been pushed on the nodes.
In this post i am going to demonstrate how to install and configure latest version of Foreman 1.24 with puppet on CentOS 7 system.
Below are details of my server on which i will install and configure Foreman.
- OS(Operating System) = CentOS 7.x
- IP Address = 192.168.1.5
- Hostname = foreman.example.com
- SeLinux = Enabled
- Firewall = Enabled
I have my own local DNS server for the domain example.com, in case you don’t have the DNS server then you have to put entries in the ‘/etc/hosts‘ file for name to ip resolution.
Step:1 Enable puppetlabs repo and install foreman installer
Open the terminal and run the following commands one after the other.
Step:2 Start the Installation using foreman installer
To start the foreman installation , run the command “foreman-installer” , it will be non-interactive installation. In case you want the interactive installation use ‘-i‘ option in the command like “foreman-installer -i”
Once the foreman installation is completed we will get the output like below :
We can see that initial credentials have been created for the foreman dashboard and moreover puppetmaster is also installed which is running in 8140 port.
Before Accessing the dashboard, it is recommended to open the required ports in the OS firewall. Execute the beneath commands one after the other.
Step:3 Access Foreman Dashboard
To access foreman dashboard , type “https://<Hostname_OR_IP_Foreman_Server>”
In My Case dashboard can be accessed from the url : https://foreman.example.com
Use the initial credentials which is created during foreman installation
By default foreman server itself is registered in foreman dashboard. To check the host information,
click on Hosts options —> then all hosts.
Let’s install ntp module on the foreman server and import it from dashboard. NTP is very much required for puppet to work smoothly. Use the below command to download ntp module.
Now import the NTP module from dashboard. Click on Configure —-> Classes
Click on Import option, it will import the NTP module in foreman dashboard, example is shown below :
Select the Module and click on Update.
Click on ‘ntp’ class name and the select ‘Smart Class Parameter’
Select the override option in case you want to specify your own NTP Servers. Change the Key type Value from “String” to “Array” and Specify the NTP Server’s name in the Default value Box and then click on Submit. Example is shown below.
Now it’s time to add ntp class to the host, for that go to Hosts options and Select the host (foreman.example.com), Click on Edit. Go to the ‘Puppet Classes‘ Tab and Click on ‘+‘ option to add ntp class on the host and then click on submit
Now Run the following puppet command from the foreman server to configure the NTP Service automatically.
Now Check the reports from the Dashboard for the host.
Go To Hosts—> Click on hosts{foreman.example.com}—> Click on Reports.
As we know that puppet makes the use of SSL Certificates to set up the secure communication between puppet server and its nodes. Once Puppet Server sign the certificates of its node, then only communication can occur.
Let’s create a autosign entry for puppet nodes which are on the domain “example.com”
In the Forman Dashboard , Go To Infrastructure —> Select Smart Proxies —> Select Autosign under Action Tab
Click on New to create new ‘autosign’ entry. Specify the domain name and then click on Save.
At this point, now we can say that our foreman server is ready to manage servers.
Step:4 Add New hosts to Foreman Dashboard.
To add new hosts or servers in the foreman dashboard we have to install puppet agent on the hosts and execute the following puppet command from the host.
Let’s suppose we want to add Ubuntu server { ubuntu-server.example.com – 192.168.1.14 }
Now verify the host in dashboard.
Now Add puppet Classes to this host in the same way that we do for the host “foreman.example.com” in the above steps.
Note : Command to remove puppet module.
That’s conclude the article, Please share your feedback and Comments
Tidak ada komentar:
Posting Komentar