【问题标题】:Chef:Error executing action `install` on resource 'package[httpd]'厨师:在资源“包 [httpd]”上执行操作“安装”时出错
【发布时间】:2014-06-24 06:37:30
【问题描述】:

我正在使用 chef 在 AWS Amazon Environment 中使用刀 ec2 插件创建服务器。

我已经使用以下命令创建了 EC2 服务器:

knife ec2 server create --image ami-7c807d14 --flavor t1.micro --region us-east-1 --security-group-ids sg-ID --ebs-size 10 --ebs-no-delete-on-term --tags Name=Test_Server --server-connect-attribute private_ip_address  --subnet subnet-ID --ssh-user ec2-user --identity-file ~/.ssh/key.pem --environment Testing --node-name Redhat-Server

当我 ssh 到 Chef 节点并运行以下命令 sudo chef-client 在节点上安装 apache 时,它​​给了我一个错误:

[2014-06-24T07:44:55+00:00] WARN:
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
SSL validation of HTTPS requests is disabled. HTTPS connections are still
encrypted, but chef is not able to detect forged replies or man in the middle
attacks.

To fix this issue add an entry like this to your configuration file:

```
  # Verify all HTTPS connections (recommended)
  ssl_verify_mode :verify_peer

  # OR, Verify only connections to chef-server
  verify_api_cert true
```

To check your SSL configuration, or troubleshoot errors, you can use the
`knife ssl check` command like so:

```
  knife ssl check -c /etc/chef/client.rb
```

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

Starting Chef Client, version 11.12.8
resolving cookbooks for run list: ["apache-tutorial-1"]
Synchronizing Cookbooks:
  - apache-tutorial-1
Compiling Cookbooks...
Converging 4 resources
Recipe: apache-tutorial-1::default
  * package[httpd] action install
================================================================================
Error executing action `install` on resource 'package[httpd]'
================================================================================


Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '1'
---- Begin output of /usr/bin/python /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.8/lib/chef/provider/package/yum-dump.py --options --installed-provides ----
STDOUT: [option installonlypkgs] kernel kernel-devel kernel-source installonlypkg(kernel) installonlypkg(kernel-module) installonlypkg(vm)
STDERR: yum-dump Repository Error: failure: repodata/repomd.xml from amzn-main: [Errno 256] No more mirrors to try.
---- End output of /usr/bin/python /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.8/lib/chef/provider/package/yum-dump.py --options --installed-provides ----
Ran /usr/bin/python /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.8/lib/chef/provider/package/yum-dump.py --options --installed-provides returned 1


Resource Declaration:
---------------------
# In /var/chef/cache/cookbooks/apache-tutorial-1/recipes/default.rb

 11: package 'httpd' do
 12:   action :install
 13: end
 14:



Compiled Resource:
------------------
# Declared in /var/chef/cache/cookbooks/apache-tutorial-1/recipes/default.rb:11:in `from_file'

package("httpd") do
  action [:install]
  retries 0
  retry_delay 2
  guard_interpreter :default
  package_name "httpd"
  cookbook_name "apache-tutorial-1"
  recipe_name "default"
end




Running handlers:
[2014-06-24T07:45:04+00:00] ERROR: Running exception handlers
Running handlers complete

[2014-06-24T07:45:04+00:00] ERROR: Exception handlers complete
[2014-06-24T07:45:04+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
Chef Client failed. 0 resources updated in 9.101137934 seconds
[2014-06-24T07:45:04+00:00] ERROR: package[httpd] (apache-tutorial-1::default line 11) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of /usr/bin/python /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.8/lib/chef/provider/package/yum-dump.py --options --installed-provides ----
STDOUT: [option installonlypkgs] kernel kernel-devel kernel-source installonlypkg(kernel) installonlypkg(kernel-module) installonlypkg(vm)
STDERR: yum-dump Repository Error: failure: repodata/repomd.xml from amzn-main: [Errno 256] No more mirrors to try.
---- End output of /usr/bin/python /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.8/lib/chef/provider/package/yum-dump.py --options --installed-provides ----
Ran /usr/bin/python /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.8/lib/chef/provider/package/yum-dump.py --options --installed-provides returned 1
[2014-06-24T07:45:05+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

请帮我解决这个问题。

【问题讨论】:

  • 也许你应该在ServerFault上问这个问题。
  • 但是我也看到了关于 SO 的 Chef 相关问题!!!!
  • 那我的错对不起。

标签: amazon-web-services amazon-ec2 chef-recipe bootstrapping


【解决方案1】:

就我而言,Linux AMI 上的 yum 存在一些问题。

我运行创建 centos 机器的相同命令有效。

【讨论】:

    猜你喜欢
    • 2015-04-11
    • 1970-01-01
    • 1970-01-01
    • 2019-01-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多