0
我在使用Chef时非常新鲜:我需要在CentOS 7 上配置我的Apache,所以我创建了一个名为post_inst_config.rb
的小配方,我把它放在我的Chef runlist中这样...厨师配置Apache(http.conf)
"recipe[mapserver_install::inst_apache2]",
"recipe[mapserver_install::post_inst_config]"
在这里,你是我的post_inst_config.rb
#Add to /etc/httpd/conf/httpd.conf the string: ScriptAlias /cgi-bin/ /var/www/cgi-bin/
File.open("/etc/httpd/conf/httpd.conf", 'a') do |file|
file.write "ScriptAlias /cgi-bin/ /var/www/cgi-bin/"
file.write "\n"
end
#Define the following symblink: ln -s /usr/bin/mapserv /var/www/cgi-bin/mapserv
link '/usr/bin/mapserv' do
to '/var/www/cgi-bin/mapserv'
end
#Create the directory for the imagepath ...
directory '/var/www/html/output' do
owner 'root'
group 'root'
mode '0755'
action :create
end
#Restart apache ....
service "httpd" do
action :restart
end
当我尝试执行我的厨师食谱我得到这个错误...
================================================================================
Recipe Compile Error in /var/chef/cache/cookbooks/mapserver_install/recipes/post_inst_config.rb
================================================================================
Errno::ENOENT
-------------
No such file or directory @ rb_sysopen - /etc/httpd/conf/httpd.conf
请注意,如果我尝试执行我的运行列表而没有安装post_inst_config.rb
Apache,并且工作正常。
建议表示赞赏...