Persistently create a new Apache VirtualHost alongside Foreman

Say I want the Foreman Server to host some configuration files and expose those through HTTP using a non default port (e.g 8080), what’s the best way to do it persistently?
Whenever I edit apache config files, it gets overwritten every time the server restarts.

With foreman-installer this can be done in a sort of hacky way by using custom-hiera.yaml. Note that this is untested and there may be typos.

# add additional Puppet classes, but merge them with the existing ones
    merge: unique

# Actually include the class. You can also include others here like apache::mod::status
  - apache::vhosts

# Define the vhost - see apache/manifests/vhost.pp for parameters
    docroot: /var/www/html
    port: 8080
1 Like

Thanks a lot! This works perfectly on both new and existing foreman installations!
For Ubuntu systems…here’s the file you need to edit: /etc/foreman-installer/custom-hiera.yaml