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,並且工作正常。
建議表示讚賞...