I am currently using Puppet with Foreman 1.17 and puppetlabs/apache version 3.1.0. All virtual hosts are defined using a .yaml file:
apache::vhost:
vm12345_ssl:
servername: my.example.com
docroot: /home/my.example.com/web
logroot: /home/my.example.com/log
(... more configuration)
Now I would like to specify also the required Apache modules via Hiera / yaml file. But I could not find any documentation or example how to do this. One website recommends apache::mod::proxy: true
; I tried this and also variants of it but could not get it to work.
What I want to accomplish: I am using the Puppet roles and profiles pattern and my webapp profile files each contain the lines below:
class profile::webapp::my_webapp_01 (
... some parameters
) {
include profile::java
include apache
apache::mod { 'proxy': }
apache::mod { 'proxy_ajp': }
apache::mod { 'proxy_http': }
... more webapp-specific configuration
And my node looks like:
node 'vm12345' {
...
include profile::webapp::my_webapp_01
include profile::webapp::my_webapp_02
include profile::webapp::my_webapp_03
}
When I include just one webapp per VM all is well, but as soon as I include several webapps in the VM I get a "Duplicate declaration" error. I think the proper way to resolve this is to use Hiera to specify the Apache modules, instead of explicitly defining them into the profile.
Please advise how to specify Apache modules via Hiera and a yaml file, or if maybe the whole approach is broken, please advise how to write the profile declarations for the Apache modules such that they can be included multiple times.