Configuring Apache with Puppet and Vagrant

apache, puppet, vagrant

Solution

PuPHPet uses the Example42 Apache Puppet module, see the README file. This module doesn't have a directories parameter in the vhost resource:

https://github.com/puphpet/puphpet-apache/blob/master/manifests/vhost.pp#L100

Only the Puppet Labs Apache module has a directories parameter, but it's a different module:

https://github.com/puppetlabs/puppetlabs-apache/blob/master/manifests/vhost.pp#L25

You can however use the directory parameter in Example42's module similarly to the example which can be found in the vhost resource:

#  apache::vhost { 'my.other.site':
#    docroot                    => '/path/to/docroot',
#    directory                  => '/path/to',
#    directory_allow_override   => 'All',
#  }

Problem

I'm using Vagrant and Puppet for the first time in a project and I keep running into an issue. I've used PuPHPet as a starting point, and I have the following snippet in my default.pp manifest: ``` class { 'apache': } apache::dotconf { 'custom': content => 'EnableSendfile Off', } apache::module { 'rewrite': } apache::vhost { 'awesome.dev': server_name => 'awesome.dev', serveraliases => [ ], docroot => '/var/www', port => '80', directories => [ { path => '/var/www/', allow => 'from all', allow_override => ['All'] } ], env_variables => [], priority => '1', } ``` When I run it, I always get the following error: ``` warning: Could not retrieve fact fqdn Invalid parameter directories at /tmp/vagrant-puppet/manifests/default.pp:46 on node precise32 The following SSH command responded with a non-zero exit status. Vagrant assumes that this means the command failed! cd /tmp/vagrant-puppet/manifests && puppet apply --verbose --modulepath '/etc/puppet/modules:/tmp/vagrant-puppet/modules-0' default.pp --detailed-exitcodes || [ $? -eq 2 ] ``` Line 46 is the end of the apache::vhost rule. I want to set it to allow override using htaccess, but I can't see where I've gone wrong. Can anyone see what the issue is?

Original source