Can thhe Foreman proxy Puppet module be configured in a hiera config?

Problem: The documentation does not give me hints about configuring the proxy in hiera configs.
I鈥檝e added the module in my Puppetfile as mentioned here: theforeman/foreman_proxy 路 Foreman Smart Proxy configuration 路 Puppet Forge
And now?

In my case I would like to know what is required to let Puppet install the proxy and configure DHCP and TFTP.

Expected outcome: Answering my question :joy: But I think it could also be worth to add some hints in the official docs.

Foreman and Proxy versions: 3.0/3.2

Distribution and version: Ubuntu 20.04 / 18.04

I am not sure where your issue is as the module is nothing special, so I will try to explain the way it works in general and just use foreman_proxy as an example.

With the Hiera integration in Puppet you get the option to separate Puppet code and parametrization.

So you can simply assign a class to the host in a profile or role module or via an external node classifier (ENC) like Foreman. This would be a simple line like include foreman_proxy or assigning the class in the Foreman WebUI.

To change the behaviour of the class, you now change parameter by adding them to your data structure in Hiera in the format class::parameter. In this case if you only want DHCP and TFTP to be enabled with the default settings, you would need this in the hierarchy for the host:

foreman_proxy::dhcp: true
foreman_proxy::tftp: true

If you now want to change the defaults further like switch the dhcp provider from isc to infoblox as an example, you would need to add:

foreman_proxy::dhcp_provider: infoblox

If you have already installed it somewhere, you can look in the answer file from the installer as this is also hiera.

Is this what you needed?

Thanks @dirk for your help. I think missed multiple parts here. Or maybe they were not linked correctly :grimacing:

Following your explanation I was able to create a hiera file like this:

- foreman_proxy
foreman_proxy::omapi_port: 7911
foreman_proxy::settings_directory: /etc/foreman-proxy/settings.d
foreman_proxy::ssl_ca_file: /etc/puppetlabs/puppet/ssl/certs/ca.pem
foreman_proxy::ssl_certificate: /etc/puppetlabs/puppet/ssl/certs/
foreman_proxy::ssl_private_key: /etc/puppetlabs/puppet/ssl/
foreman_proxy::daemon: true
- '*'
foreman_proxy::https_port: 8443
foreman_proxy::log_file: /var/log/foreman-proxy/proxy.log
foreman_proxy::log_level: INFO
foreman_proxy::log_buffer: 2000
foreman_proxy::log_buffer_errors: 1000
foreman_proxy::tftp: true
foreman_proxy::tftp_root: /var/lib/tftpboot
foreman_proxy::dhcp: true
foreman_proxy::dhcp_listen_on: https
foreman_proxy::dhcp_managed: true
foreman_proxy::dhcp_provider: isc
foreman_proxy::config: /etc/dhcp/dhcpd.conf
foreman_proxy::leases: /var/lib/dhcp/dhcpd.leases

I had a lot errors and step by step I had to import the following modules to resolve the errors that appeared.

mod 'theforeman-foreman',               '21.2.0'
mod 'theforeman-foreman_proxy',         '21.0.0'
mod 'theforeman-tftp',                  '8.0.0'
mod 'theforeman-dhcp',                  '8.2.0'
mod 'puppet-extlib',                    '6.0.0'
mod 'puppet-redis',                     '8.5.0'
mod 'richardc-datacat',                 '0.6.2'

It is still not working. Now the next error occurred:

Error: no parameter named 'max_files' (file: /tmp/kitchen/modules/foreman_proxy/manifests/tftp.pp, line: 18) on File[/var/lib/tftpboot/pxelinux.cfg] (file: /tmp/kitchen/modules/foreman_proxy/manifests/tftp.pp, line: 18) on node

Not sure how to solve this one right now.

@dirk While reflecting on your sentence I am not sure where your issue is as the module is nothing special, I can agree only party. I know it is always more or less the same. Adding classes, defining parameters etc.
But how do you know which parameters exist? How do you know which ones are required and which ones are optional? Or which values are allowed? Mixed with the general problem that there are no examples of configuration snippets it is always unnecessary pain.
I bet the information is somewhere, but it is not well enough linked together or mentioned.

Just compare an Ansible documentation page of a tool or function with the one in Puppet forge. At least I prefer always the one in Ansible. There is always a list of all parameters and values, a lot examples and so on and so forth. Usually you take an example modify it and it works.
And this is what I would like to have for Puppet modules in general, but also the Foreman project could improve a bit on this. I know it is not easy to make documentation easy accessible, but maybe a thought worth.

Coming back to the initial question.

What I wanted to do: Installing Foreman proxy with DHCP and TFTP using Puppet

Now remember what I had to do to just install this stuff (and it is not done yet). Reading Puppet forge, reading Github modules page, asking here, searching in answer files, guessing, assuming, testing. And it is still not installed.
If I am specialized in Foreman and Puppet maybe it is pretty obvious. But in my opinion an installation part should have less hard entry points. It鈥檚 just my opinion and don鈥檛 get me wrong. I really like this project and you guys :hugs:
It鈥檚 just feedback of a user :slight_smile:

You could take a look at what I鈥檓 doing for Foreman鈥檚 own infrastructure.

I wrote some minor profile classes and configure it further via Hiera.

You do have quite a few parameters which are also default so I wouldn鈥檛 touch them.

max_files was introduced in some Puppet agent version. I forgot exactly which one, but please make sure your agent version is up to date.

I know we鈥檝e pinned a version. I think to just have it under control.
Let me try to raise the version.