Ubuntu 10.04 Puppet和Apache,apache服务无法启动

时间:2013-03-07 04:52:01

标签: ubuntu apache2 puppet

目前正在运行一个关于使用puppet配置vm以自动创建服务器环境的基本教程

目前我正在运行

puppet    3.1.0
apache2   2.2.14-5ubuntu Apache HTTP Server metapackage

我有一个非常基本的init文件来加载apache2并确保它正在运行。

package {
  "apache2":
  ensure => present
}
service {"apache2":
  ensure => true,
  enable => true,
}

当我尝试在此文件上运行sudo puppet时,我收到以下错误

Error: Could not start Service[apache2]: Execution of '/etc/init.d/apache2 start' returned 1: 
Error: /Stage[main]//Service[apache2]/ensure: change from stopped to running failed: Could not start Service[apache2]: Execution of '/etc/init.d/apache2 start' returned 

如何解决此问题?

1 个答案:

答案 0 :(得分:4)

需要安装软件包才能启动该服务。所以要成为一个要求:

package { 'apache2':
  ensure => present,
}

service { 'apache2':
  ensure  => running,
  enable  => true,
  require => Package['apache2'],
}

如果仍然出现错误,请查看服务器日志。