我正在尝试使用Puppet并遇到一个错误,它在没有环境变量的情况下启动apache2。我一直在关注example 1,这是一个非常简单的清单,但它会抛出以下错误;
[Mon May 18 23:18:35.725947 2015] [core:warn] [pid 5312] AH00111: Config variable ${APACHE_LOCK_DIR} is not defined
[Mon May 18 23:18:35.726451 2015] [core:warn] [pid 5312] AH00111: Config variable ${APACHE_PID_FILE} is not defined
[Mon May 18 23:18:35.726538 2015] [core:warn] [pid 5312] AH00111: Config variable ${APACHE_RUN_USER} is not defined
[Mon May 18 23:18:35.726611 2015] [core:warn] [pid 5312] AH00111: Config variable ${APACHE_RUN_GROUP} is not defined
[Mon May 18 23:18:35.726696 2015] [core:warn] [pid 5312] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Mon May 18 23:18:35.750730 2015] [core:warn] [pid 5312] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Mon May 18 23:18:35.751241 2015] [core:warn] [pid 5312] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Mon May 18 23:18:35.751331 2015] [core:warn] [pid 5312] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
AH00526: Syntax error on line 74 of /etc/apache2/apache2.conf:
Invalid Mutex directory in argument file:${APACHE_LOCK_DIR}
我知道问题是它没有加载到envvar文件中,如果我不从Puppet运行它,但我正在寻找解决方案,所以我可以使用puppet来创建服务器。有什么想法吗?
我的Puppet清单如下:
# execute 'apt-get update'
exec { 'apt-update': # exec resource named 'apt-update'
command => '/usr/bin/apt-get update' # command this resource will run
}
# install apache2 package
package { 'apache2':
require => Exec['apt-update'], # require 'apt-update' before installing
ensure => installed,
}
# ensure apache2 service is running
service { 'apache2':
ensure => running,
}
# install mysql-server package
package { 'mysql-server':
require => Exec['apt-update'], # require 'apt-update' before installing
ensure => installed,
}
# ensure mysql service is running
service { 'mysql':
ensure => running,
}
# install php5 package
package { 'php5':
require => Exec['apt-update'], # require 'apt-update' before installing
ensure => installed,
}
# ensure info.php file exists
file { '/var/www/html/info.php':
ensure => file,
content => '<?php phpinfo(); ?>', # phpinfo code
require => Package['apache2'], # require 'apache2' package before creating
}