运行cook book后,无法完成httpd安装

时间 2019-01-29
阅读 21
点赞 0
收藏 0
连接shc

我写了厨师食谱来安装httpd,并启用和启动它。但是得到下面的错误。

Recipe: (chef-apply cookbook)::(chef-apply recipe)
  * apt_package[httpd] action install

    ================================================================================
    Error executing action 
install我尝试了很多解决方案,比如在运行配方之前进行apt-get-update,但是没有用。 on resource 'apt_package[httpd]'
    ================================================================================

    Chef::Exceptions::Package
    -------------------------
    httpd is a virtual package provided by multiple packages, you must explicitly select one

    Resource Declaration:
    ---------------------
    # In server.rb

      6: package 'httpd' do
      7:        action :install
      8: end
      9: 

    Compiled Resource:
    ------------------
    # Declared in server.rb:6:in 
run_chef_recipe'

    apt_package("httpd") do
      package_name "httpd"
      action [:install]
      default_guard_interpreter :default
      declared_type :package
      cookbook_name "(chef-apply cookbook)"
      recipe_name "(chef-apply recipe)"
    end

    System Info:
    ------------
    chef_version=14.8.12
    platform=ubuntu
    platform_version=18.04
    ruby=ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-linux]
    program_name=/usr/bin/chef-apply
    executable=/opt/chefdk/bin/chef-apply

[2019-01-29T10:14:30+00:00] FATAL: Stacktrace dumped to /home/devopsdevops95/.chef/cache/chef-stacktrace.out
[2019-01-29T10:14:30+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2019-01-29T10:14:30+00:00] FATAL: Chef::Exceptions::Package: apt_package[httpd] ((chef-apply cookbook)::(chef-apply recipe) line 6) had an error: Chef::Exceptions::Package: httpd is a virtual package provided by multiple packages, you must explicitly select one

我希望它能毫无问题地安装httpd。

chef -v
Chef Development Kit Version: 3.6.57
chef-client version: 14.8.12
delivery version: master (5fb4908da53579c9dcf4894d4acf94d2d9ee6475)
berks version: 7.0.7
kitchen version: 1.24.0
inspec version: 3.2.6

OS -
NAME="Ubuntu"
VERSION="18.04.1 LTS (Bionic Beaver)"

package 'httpd' do
        action :install
end

file '/var/www/html/index.html' do 
        content '<h1>Hello, world!</h1>'
end

service 'httpd' do

建议答案

我终于完成了。

  1. HTTPD烹饪手册已不再使用。-https://supermarket.chef.io/cookbooks/httpd
  2. 我用了下面的食谱

执行“sudo apt get update”do 命令'sudo apt get update' 结束 apt_包'apache2'do 动作:安装 结束

文件'/var/www/html/index.html'do 内容“

你好,世界!

’ 结束

服务“apache2”do 操作[:启用,:启动]

结束

👍 0