Integrate Puppet to Foreman

Continue with my previous post – Build Foreman as Puppet ENC. Now it’s the time to integrate the Puppet to Foreman.

On the foreman server (foreman.mylab.local):

1) Add the puppet smart proxy


2) Import the environments via the smart proxy


On puppet master (puppet.mylab.local):

1) Create the two executable ruby scripts to push/pull facts to/from foreman:


2) Add the two entries in the [master] section in  /etc/puppet/puppet.conf

external_nodes = /etc/puppet/external_node.rb
node_terminus = exec

3) Create a cron job (crontab -e) to push the facts to foreman every 30 minutes.

# Push puppet node facts to foreman
30 * * * * /etc/puppet/push_facts.rb

You can manually run it once to check whether it works for you. If it works, you should be able to see the hosts in foreman.


4) Update the sudo file (visudo) to allow foreman-proxy to run some puppet commands.

# Allow foreman-proxy
foreman-proxy ALL = NOPASSWD: /usr/sbin/puppetca *
Defaults:foreman-proxy !requiretty

Defaults:foreman-proxy !requiretty
foreman-proxy ALL = NOPASSWD: /usr/bin/puppet *

5) Create the following file to enable uploading reports to foreman.


6) Enable the reports in /etc/puppet/puppet.conf

for puppet master, add the entry in [master] section
reports = foreman, log

for puppet node, add the entry in [agent] section
report = true

Wait for 30 minutes (max), then check the foreman page.




One thought on “Integrate Puppet to Foreman

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s