厨师警告“未找到配置文件:/solo.rb。改为使用命令行选项。”

时间:2019-05-23 17:13:17

标签: chef

我试图在无业游民的机器上安装apache2服务器。 Ubuntu 16.04是我的随身物品箱,使用Chef作为基础架构配置工具。当我尝试执行sudo chef-solo -c solo.rb命令时,显示以下冲突,但未安装任何软件。

vagrant@chef:/vagrant$ sudo chef-solo -c solo.rb
[2019-05-23T15:01:24+00:00] WARN: *****************************************
[2019-05-23T15:01:24+00:00] WARN: Did not find config file: /solo.rb. Using command line options instead.
[2019-05-23T15:01:24+00:00] WARN: *****************************************
[2019-05-23T15:01:24+00:00] WARN: No cookbooks directory found at or above current directory.  Assuming /var/chef.
[2019-05-23T15:01:24+00:00] WARN: *****************************************
[2019-05-23T15:01:24+00:00] WARN: Did not find config file: /solo.rb. Using command line options instead.
[2019-05-23T15:01:24+00:00] WARN: *****************************************
Starting Chef Client, version 14.12.9
resolving cookbooks for run list: []
Synchronizing Cookbooks:
Installing Cookbook Gems:
Compiling Cookbooks...
[2019-05-23T15:01:28+00:00] WARN: Node chef has an empty run list.
Converging 0 resources

Running handlers:
Running handlers complete
Chef Client finished, 0/0 resources updated in 02 seconds

这是我的项目目录结构:- enter image description here

node.json:-

{
    "run_list":[
        "recipe[webserver::install_apache]"
    ]
}

要烹饪的食谱是install_apache.rb:-

package "apache2" do
    action :install
end
# A resource
service "apache2" do
    action [:start,:enable]
end

配置文件solo.rb:-

CHEF_ROOT="/vagrant"
cookbook_path "#{CHEF_ROOT}/cookbooks"
json_attribs "#{CHEF_ROOT}/node.json"

我检查了solo.rb,cookbooks目录的许可,发现一切正常。

首席--version:-

Chef Development Kit Version: 3.10.1
chef-client version: 14.12.9
delivery version: master (9d07501a3b347cc687c902319d23dc32dd5fa621)
berks version: 7.0.8
kitchen version: 1.24.0
inspec version: 3.9.3

我刚刚开始学习Chef,还没有发现任何警告提示的提示!

2 个答案:

答案 0 :(得分:0)

之所以引起这个问题,是因为它没有路径搜索为/ file,只是给出了initMap命令。给出文件的标准路径。我假设处于/ vagrant中,sudo chef-solo -c solo.rb也可以工作。我只是将命令编辑为-c ./solo.rb并执行了nic

答案 1 :(得分:0)

Ubuntu 18.04 或其他Linux发行版上,传递规范的路径仅使其起作用。

sudo chef-solo -c $PWD/solo.rb -j $PWD/mconf-live-standalone.json

示例:

admin@mclive:~/downloads/mconf-live-solo-master$
admin@mclive:~/downloads/mconf-live-solo-master$ sudo chef-solo -c solo.rb -j mconf-live-standalone.json
[2019-08-09T04:31:33-07:00] WARN: *****************************************
[2019-08-09T04:31:33-07:00] WARN: Did not find config file: /solo.rb. Using command line options instead.
[2019-08-09T04:31:33-07:00] WARN: *****************************************
[2019-08-09T04:31:33-07:00] WARN: No cookbooks directory found at or above current directory.  Assuming /var/chef.
[2019-08-09T04:31:33-07:00] WARN: *****************************************
[2019-08-09T04:31:33-07:00] WARN: Did not find config file: /solo.rb. Using command line options instead.
[2019-08-09T04:31:33-07:00] WARN: *****************************************
[2019-08-09T04:31:33-07:00] FATAL: Cannot load configuration from mconf-live-standalone.json
admin@mclive:~/downloads/mconf-live-solo-master$
admin@mclive:~/downloads/mconf-live-solo-master$
admin@mclive:~/downloads/mconf-live-solo-master$
admin@mclive:~/downloads/mconf-live-solo-master$
admin@mclive:~/downloads/mconf-live-solo-master$
admin@mclive:~/downloads/mconf-live-solo-master$
admin@mclive:~/downloads/mconf-live-solo-master$ sudo chef-solo -c $PWD/solo.rb -j $PWD/mconf-live-standalone.json
[2019-08-09T04:35:25-07:00] INFO: Started Chef Infra Zero at chefzero://localhost:1 with repository at /home/admin/downloads/mconf-live-solo-master
  One version per cookbook

Starting Chef Infra Client, version 15.2.20
[2019-08-09T04:35:25-07:00] INFO: *** Chef Infra Client 15.2.20 ***
[2019-08-09T04:35:25-07:00] INFO: Platform: x86_64-linux
[2019-08-09T04:35:25-07:00] INFO: Chef-client pid: 20406
[2019-08-09T04:35:32-07:00] INFO: Setting the run_list to ["recipe[bigbluebutton::abort-if-being-used]", "recipe[apt::default]", "recipe[chef_handler::default]", "recipe[mconf-utils::reboot-requestor]", "recipe[reboot-handler]", "recipe[mconf-utils::base]", "recipe[logrotate::default]", "recipe[bigbluebutton]", "recipe[mconf-live]"] from CLI options
[2019-08-09T04:35:32-07:00] INFO: Run List is [recipe[bigbluebutton::abort-if-being-used], recipe[apt::default], recipe[chef_handler::default], recipe[mconf-utils::reboot-requestor], recipe[reboot-handler], recipe[mconf-utils::base], recipe[logrotate::default], recipe[bigbluebutton], recipe[mconf-live]]
[2019-08-09T04:35:32-07:00] INFO: Run List expands to [bigbluebutton::abort-if-being-used, apt::default, chef_handler::default, mconf-utils::reboot-requestor, reboot-handler, mconf-utils::base, logrotate::default, bigbluebutton, mconf-live]
[2019-08-09T04:35:32-07:00] INFO: Starting Chef Infra Client Run for mclive
[2019-08-09T04:35:32-07:00] INFO: Running start handlers
[2019-08-09T04:35:32-07:00] INFO: Start handlers complete.
resolving cookbooks for run list: ["bigbluebutton::abort-if-being-used", "apt::default", "chef_handler::default", "mconf-utils::reboot-requestor", "reboot-handler", "mconf-utils::base", "logrotate::default", "bigbluebutton", "mconf-live"]
[2019-08-09T04:35:33-07:00] INFO: Loading cookbooks [bigbluebutton@1.0.11, apt@6.1.0, chef_handler@1.1.6, mconf-utils@0.1.1, reboot-handler@1.0.0, logrotate@1.9.2, mconf-live@1.0.6, ffmpeg@0.4.4, libvpx@1.1.0, sudo@2.11.0, cron@4.1.1, x264@0.5.1, git@4.0.2, build-essential@2.0.6, yasm@1.0.0, compat_resource@12.19.0, dmg@2.2.0, windows@1.34.2, runit@1.7.6, yum@3.2.4, yum-epel@0.4.0, packagecloud@0.1.1]
Synchronizing Cookbooks:
[2019-08-09T04:35:33-07:00] INFO: Storing updated cookbooks/bigbluebutton/README.md in the cache.
[2019-08-09T04:35:33-07:00] INFO: Storing updated cookbooks/bigbluebutton/templates/default/bigbluebutton.erb in the cache.
[2019-08-09T04:35:33-07:00] INFO: Storing updated cookbooks/bigbluebutton/templates/default/bigbluebutton.nginx.erb in the cache.
[2019-08-09T04:35:33-07:00] INFO: Storing updated cookbooks/bigbluebutton/templates/default/remove-recordings-raw.erb in the cache.
[2019-08-09T04:35:33-07:00] INFO: Storing updated cookbooks/bigbluebutton/recipes/gem-deps.rb in the cache.
[2019-08-09T04:35:33-07:00]