RLabs: Foreman and Puppet integration

Foreman already comes with Puppet. In fact, when you run foreman-installer it uses Puppet to install and configure Foreman.

Even if you won´t manage servers with Puppet, it´s useful to install the Puppet agent on all hosts connected to Foreman so you´ll have reports and inventory.

Here we´ll talk about adding hosts to the Puppet Server running on Foreman.

Install and configure Puppet agent on client hosts

You should have a host already subscribed with Katello, so it will see the Puppet repository mirror.

Install the puppet-agent package, configure it to point to the Foreman host and run it:

yum install puppet-agent
echo "server = foreman.ext.dc1.lab" >> /etc/puppetlabs/puppet/puppet.conf
. /etc/profile && puppet agent -t

Enable puppet service and start it:

systemctl enable puppet
systemctl start puppet

You´re DONE !
You can now see the hosts Facts (inventory).

Adding Puppet stuff to Foreman

Foreman can be a ENC (External Node Classifier) to Puppet so you can use the Foreman web interface to manage puppet classes and apply them to hosts.
We won´t do it here. We´ll just get to the point you can use it, but we´ll let to explain how to do it on the next post.

Download Puppet modules

You can import Puppet modules from Puppet Forge, but I´ll use my own modules to demonstrate it as I´ll talk about them futurely.

Go to the Puppet modules directory on the Foreman host:

cd /etc/puppetlabs/code/environments/production/modules/

Download my Puppet modules:

git clone https://github.com/andreramoni/puppet-rbaselines.git rbaselines && cd rbaselines && ./deps.sh
git clone https://github.com/andreramoni/puppet-rservers.git rservers && cd rservers && ./deps.sh


Import them onto Foreman

Go to Configure->Puppet Classes->Import. Select the checkbox and click Update.

You should see a list of all Puppet classes available on the modules installed.

Ok, let´s stop for now. In the next posts I´ll show you how to use them.




Um comentário em “RLabs: Foreman and Puppet integration

Os comentários estão encerrados.