使用Puppet和Vagrant配置Apache

3
我是第一次在一个项目中使用Vagrant和Puppet,这与IT技术有关。我遇到了一个问题。我使用PuPHPet作为起点,在我的default.pp清单中有以下代码片段:
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',
}

当我运行它时,总是会得到以下错误:
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 ]

第46行是apache::vhost规则的结尾。我想设置它允许使用htaccess进行覆盖,但是我看不出我哪里错了。有人能看到问题在哪里吗?

1个回答

6
PuPHPet使用Example42 Apache Puppet模块,请参阅README文件。该模块在vhost资源中没有directories参数:

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

只有Puppet Labs Apache模块具有directories参数,但这是一个不同的模块:

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

您可以使用Example42模块中的目录参数,类似于vhost资源中的示例。
#  apache::vhost { 'my.other.site':
#    docroot                    => '/path/to/docroot',
#    directory                  => '/path/to',
#    directory_allow_override   => 'All',
#  }

3
请注意,几个月前我将PuPHPet切换到了puppetlabs-apache模块,因此这个答案已经不正确了。 - Juan Treminio
对于所有使用example42模块的人来说,这仍然是正确的,并且非常有用。 - Guillaume Fache

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接