0

I'm configuring a Vagrant box (Ubuntu) with a puppet manifest - Everything is working except when I visit a site on the Vagrant host I get an error:

Invalid command 'Header'

Which I believe is due to Apache's mod_header not being loaded. The puppet manifest for apache2 is simple:

class { 'apache2':
    document_root => '/path/to/docroot',
}

How do I tell puppet to provision the Vagrant box to enable mod_headers?

user4984
  • 105
  • 5
  • What apache module are you using? This does not look like `puppetlabs-apache`. – Felix Frank Jun 02 '14 at 14:33
  • When the Vagrant machine is provisioned, it looks like it's loading a default puppet module: puppet.module_path = "puppet/modules" that contains the apache configuration. Thx – user4984 Jun 02 '14 at 14:57
  • So is this a premade `vagrant` config you downloaded somewhere? I'm interested in the source of `puppet/modules/apache2`, for that is key to your answer. – Felix Frank Jun 02 '14 at 15:17
  • Yes - from here: https://github.com/matthewsplant/magento-vagrant-puppet – user4984 Jun 02 '14 at 15:34
  • Ah, that is unfortunate - the author included a custom `apache2` module that does not give you the option to include modules. You could try and replace `modules/apache2` with a clone of https://github.com/puppetlabs/puppetlabs-apache. If you change your question into "how to do that", I shall try and come up with a simple answer. – Felix Frank Jun 02 '14 at 15:56
  • Thanks Felix - appreciate the deep dive. – user4984 Jun 02 '14 at 16:35

1 Answers1

0

If the module provided in the vagrant config is not appropriate for your needs, I suggest you add and use the official apache module. Install it into puppet/modules.

Instead of class { 'apache2': document_root => '/path/to/docroot' }, configure apache with the new module as follows:

include apache

# keep using original template for simplicity's sake
file { '/etc/apache2/sites-available/default':
    ensure => file,
    content => template('apache2/vhost_default.erb'),
}

# activate mod_headers
include apache::mod::headers
Felix Frank
  • 8,125
  • 1
  • 23
  • 30