gpt4 book ai didi

chef-infra - Chef-solo乱序安装MySql和Apache2

转载 作者:行者123 更新时间:2023-12-04 02:39:07 25 4
gpt4 key购买 nike

我正在与 chef 和 vagrant 合作,以更好地自动化一些机器构建过程,但我遇到了一个我似乎无法弄清楚的问题。问题是,无论我们做什么,只要我们包含我们的 php 服务器说明书,它就会以某种方式将 apache2 弹出到运行列表的顶部。 mysql也是一样。我们想使用 remi repos,而不是被 PHP 5.3.3 困住,但我不能,因为 apache 和 mysql 首先安装。 IE,预期的安装顺序是这样的:

  1. 运行 yum/apt update 并安装基线包(
  2. baseline-linux-server recipes) 安装 apache2/php 安装 mysql
  3. 服务器

但是我看到了:

  1. 安装apache2
  2. 安装mysql服务器
  3. 开始按预期顺序安装所有内容——包括再次查看 php/apache2/mysql 服务器。

vagrantfile 中的运行列表如下所示:

chef.add_recipe "company-baseline-linux-server::enterprise-linux"
chef.add_recipe "company-baseline-linux-server"
chef.add_recipe "company-php-server"
chef.add_recipe "company-mysql-server"
chef.add_recipe "company-php-server::setup-website"
chef.add_recipe "company-wordpress-app"
chef.add_recipe "company-wordpress-app::copy-assets"
chef.add_recipe "company-wordpress-app::load-wordpress-db"

company-php::default 配方是:

#set apache ports
node.default['apache']['listen_ports'] = node['listen_ports']

#setup apache default modules
node.default['apache']['default_modules'] = %w(status alias rewrite headers deflate dir env mod_proxy mod_proxy_http mime negotiation setenvif authz_default authz_host log_config logio)
include_recipe "apache2"
include_recipe "apache2::mod_ssl"

#set apache to autostart
execute "auto start apache" do
command "chkconfig httpd on"
end

#add php
include_recipe "php"
include_recipe "apache2::mod_php5"
include_recipe "php::module_mysql"

#disable iptables for now
include_recipe "iptables::disabled"

#kill default site
apache_site "default" do
enable false
end

company-mysql::default 配方是:

node.default["mysql"]["remove_anonymous_users"] = true

include_recipe "mysql::server"

#setup remote database user
include_recipe "database"
include_recipe "database::mysql"

mysql_connection_info = {
:host => node['dbserver'],
:username => 'root',
:port => node['mysql']['port'],
:password => node['mysql']['server_root_password']
}

dbuser = node['remote_root_user']
dbpassword = node['remote_root_password']

mysql_database_user dbuser do
connection mysql_connection_info
password dbpassword
host '%'
grant_option true
action :grant
only_if { node['remote_root_user'] }
end

mysql_database_user dbuser do
connection mysql_connection_info
password dbpassword
host 'localhost'
grant_option true
action :grant
only_if { node['remote_root_user'] }
end

当我运行所有这些时,我得到以下输出,其中可以看到首先安装 httpd,然后是 mysql,然后是从 EPEL 安装开始的 baseline-linux-cookbooks:

[2013-11-29T00:53:48+00:00] INFO: Forking chef instance to converge...
[2013-11-29T00:53:48+00:00] INFO: *** Chef 11.6.0 ***
[2013-11-29T00:53:48+00:00] INFO: Setting the run_list to ["recipe[company-baseline-linux-server::enterprise-linux]", "recipe[company-baseline-linux-server]", "recipe[company-php-server]", "recipe[company-mysql-server]", "recipe[company-php-server::setup-website]", "recipe[company-wordpress-app]", "recipe[company-wordpress-app::copy-assets]", "recipe[company-wordpress-app::load-wordpress-db]"] from JSON
[2013-11-29T00:53:48+00:00] INFO: Run List is [recipe[company-baseline-linux-server::enterprise-linux], recipe[company-baseline-linux-server], recipe[company-php-server], recipe[company-mysql-server], recipe[company-php-server::setup-website], recipe[company-wordpress-app], recipe[company-wordpress-app::copy-assets], recipe[company-wordpress-app::load-wordpress-db]]
[2013-11-29T00:53:48+00:00] INFO: Run List expands to [company-baseline-linux-server::enterprise-linux, company-baseline-linux-server, company-php-server, company-mysql-server, company-php-server::setup-website, company-wordpress-app, company-wordpress-app::copy-assets, company-wordpress-app::load-wordpress-db]
[2013-11-29T00:53:48+00:00] INFO: Starting Chef Run for localhost
[2013-11-29T00:53:48+00:00] INFO: Running start handlers
[2013-11-29T00:53:48+00:00] INFO: Start handlers complete.
[2013-11-29T00:53:49+00:00] WARN: Cloning resource attributes for service[apache2] from prior resource (CHEF-3694)
[2013-11-29T00:53:49+00:00] WARN: Previous service[apache2]: /tmp/vagrant-chef-1/chef-solo-1/cookbooks/apache2/recipes/default.rb:24:in `from_file'
[2013-11-29T00:53:49+00:00] WARN: Current service[apache2]: /tmp/vagrant-chef-1/chef-solo-1/cookbooks/apache2/recipes/default.rb:210:in `from_file'
[2013-11-29T00:53:49+00:00] WARN: Cloning resource attributes for file[/etc/httpd/conf.d/ssl.conf] from prior resource (CHEF-3694)
[2013-11-29T00:53:49+00:00] WARN: Previous file[/etc/httpd/conf.d/ssl.conf]: /tmp/vagrant-chef-1/chef-solo-1/cookbooks/apache2/recipes/default.rb:84:in `block in from_file'
[2013-11-29T00:53:49+00:00] WARN: Current file[/etc/httpd/conf.d/ssl.conf]: /tmp/vagrant-chef-1/chef-solo-1/cookbooks/apache2/recipes/mod_ssl.rb:28:in `from_file'
[2013-11-29T00:53:49+00:00] WARN: Cloning resource attributes for template[/etc/httpd/ports.conf] from prior resource (CHEF-3694)
[2013-11-29T00:53:49+00:00] WARN: Previous template[/etc/httpd/ports.conf]: /tmp/vagrant-chef-1/chef-solo-1/cookbooks/apache2/recipes/default.rb:185:in `from_file'
[2013-11-29T00:53:49+00:00] WARN: Current template[/etc/httpd/ports.conf]: /tmp/vagrant-chef-1/chef-solo-1/cookbooks/apache2/recipes/mod_ssl.rb:34:in `from_file'
[2013-11-29T00:53:49+00:00] WARN: Cloning resource attributes for execute[a2dissite default] from prior resource (CHEF-3694)
[2013-11-29T00:53:49+00:00] WARN: Previous execute[a2dissite default]: /tmp/vagrant-chef-1/chef-solo-1/cookbooks/apache2/definitions/apache_site.rb:34:in `block in from_file'
[2013-11-29T00:53:49+00:00] WARN: Current execute[a2dissite default]: /tmp/vagrant-chef-1/chef-solo-1/cookbooks/apache2/definitions/apache_site.rb:34:in `block in from_file'
[2013-11-29T00:53:49+00:00] WARN: Cloning resource attributes for directory[/var/lib/mysql] from prior resource (CHEF-3694)
[2013-11-29T00:53:49+00:00] WARN: Previous directory[/var/lib/mysql]: /tmp/vagrant-chef-1/chef-solo-1/cookbooks/mysql/recipes/server.rb:117:in `block in from_file'
[2013-11-29T00:53:49+00:00] WARN: Current directory[/var/lib/mysql]: /tmp/vagrant-chef-1/chef-solo-1/cookbooks/mysql/recipes/server.rb:117:in `block in from_file'
[2013-11-29T00:53:49+00:00] WARN: Cloning resource attributes for template[/etc/my.cnf] from prior resource (CHEF-3694)
[2013-11-29T00:53:49+00:00] WARN: Previous template[/etc/my.cnf]: /tmp/vagrant-chef-1/chef-solo-1/cookbooks/mysql/recipes/server.rb:134:in `from_file'
[2013-11-29T00:53:49+00:00] WARN: Current template[/etc/my.cnf]: /tmp/vagrant-chef-1/chef-solo-1/cookbooks/mysql/recipes/server.rb:194:in `from_file'
[2013-11-29T00:53:49+00:00] INFO: Could not find previously defined grants.sql resource
[2013-11-29T00:54:36+00:00] INFO: package[mysql] installing mysql-5.1.69-1.el6_4 from updates repository
[2013-11-29T00:54:47+00:00] INFO: package[mysql-devel] installing mysql-devel-5.1.69-1.el6_4 from updates repository
[2013-11-29T00:55:18+00:00] WARN: Cloning resource attributes for mysql_database_user[wordpress-dba] from prior resource (CHEF-3694)
[2013-11-29T00:55:18+00:00] WARN: Previous mysql_database_user[wordpress-dba]: /tmp/vagrant-chef-1/chef-solo-1/cookbooks/company-mysql-server/recipes/default.rb:27:in `from_file'
[2013-11-29T00:55:18+00:00] WARN: Current mysql_database_user[wordpress-dba]: /tmp/vagrant-chef-1/chef-solo-1/cookbooks/company-mysql-server/recipes/default.rb:36:in `from_file'
[2013-11-29T00:55:18+00:00] WARN: Cloning resource attributes for link[/etc/httpd/sites-enabled/cabletechtalk] from prior resource (CHEF-3694)
[2013-11-29T00:55:18+00:00] WARN: Previous link[/etc/httpd/sites-enabled/cabletechtalk]: /tmp/vagrant-chef-1/chef-solo-1/cookbooks/company-php-server/recipes/setup-website.rb:14:in `from_file'
[2013-11-29T00:55:18+00:00] WARN: Current link[/etc/httpd/sites-enabled/cabletechtalk]: /tmp/vagrant-chef-1/chef-solo-1/cookbooks/company-php-server/recipes/setup-website.rb:19:in `from_file'
[2013-11-29T00:55:18+00:00] WARN: Cloning resource attributes for link[/srv/websites/cabletechtalk/webroot/wp-config.php] from prior resource (CHEF-3694)
[2013-11-29T00:55:18+00:00] WARN: Previous link[/srv/websites/cabletechtalk/webroot/wp-config.php]: /tmp/vagrant-chef-1/chef-solo-1/cookbooks/company-wordpress-app/recipes/default.rb:13:in `from_file'
[2013-11-29T00:55:18+00:00] WARN: Current link[/srv/websites/cabletechtalk/webroot/wp-config.php]: /tmp/vagrant-chef-1/chef-solo-1/cookbooks/company-wordpress-app/recipes/default.rb:18:in `from_file'
[2013-11-29T00:55:18+00:00] WARN: Cloning resource attributes for service[httpd] from prior resource (CHEF-3694)
[2013-11-29T00:55:18+00:00] WARN: Previous service[httpd]: /tmp/vagrant-chef-1/chef-solo-1/cookbooks/company-php-server/recipes/setup-website.rb:23:in `from_file'
[2013-11-29T00:55:18+00:00] WARN: Current service[httpd]: /tmp/vagrant-chef-1/chef-solo-1/cookbooks/company-wordpress-app/recipes/default.rb:22:in `from_file'
[2013-11-29T00:55:18+00:00] INFO: Adding RPM-GPG-KEY-EPEL-6 GPG key to /etc/pki/rpm-gpg/
[2013-11-29T00:55:18+00:00] INFO: remote_file[/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6] created file /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
[2013-11-29T00:55:23+00:00] INFO: remote_file[/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6] updated file contents /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
[2013-11-29T00:55:23+00:00] INFO: remote_file[/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6] mode changed to 644
[2013-11-29T00:55:23+00:00] INFO: remote_file[/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6] sending run action to execute[import-rpm-gpg-key-RPM-GPG-KEY-EPEL-6] (immediate)
[2013-11-29T00:55:24+00:00] INFO: execute[import-rpm-gpg-key-RPM-GPG-KEY-EPEL-6] ran successfully
[2013-11-29T00:55:24+00:00] INFO: Adding epel repository to /etc/yum.repos.d/epel.repo
[2013-11-29T00:55:24+00:00] INFO: template[/etc/yum.repos.d/epel.repo] created file /etc/yum.repos.d/epel.repo
[2013-11-29T00:55:24+00:00] INFO: template[/etc/yum.repos.d/epel.repo] updated file contents /etc/yum.repos.d/epel.repo
[2013-11-29T00:55:24+00:00] INFO: template[/etc/yum.repos.d/epel.repo] mode changed to 644
[2013-11-29T00:55:24+00:00] INFO: template[/etc/yum.repos.d/epel.repo] sending run action to execute[yum-makecache-epel] (immediate)

我已经尝试了大多数明显的技巧,例如将对此的调用直接推送到我们的 wordpress-app 配方中,并将运行列表声明为 run_list 而不是一堆包含。我怀疑这是简单而愚蠢的事情,但我似乎无法得出答案。

最佳答案

我对 Chef 的了解有限(阅读:几乎没有),所以我看不到您的问题。但是,如果您还没有尝试过,我会提出一些建议:

  • 查找可能导致异常的任何 overrideforce-override 属性类型。

  • 在任何 metadata.rb 文件中寻找 depends apache2

  • 就像编写代码一样,逐步构建您的 Vagrantfile 并查看导致问题的第一件事,以尝试定位您的问题。

祝你好运!

关于chef-infra - Chef-solo乱序安装MySql和Apache2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20265472/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com