Chef:在资源'包[httpd]'上执行动作`install`时出错

时间:2014-06-24 06:37:31

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

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

我使用以下命令创建了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)

请帮我解决这个问题。

1 个答案:

答案 0 :(得分:0)

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

我用来创建centos机器的命令也一样。