首页 > 解决方案 > 接受版本 >= 14 的 Chef Infra Client 许可协议

问题描述

我正在尝试通过使用命令使用厨师引导节点knife bootstrap <host> --ssh-user '<username>' -i <my-identity>.pem --sudo --use-sudo-password --node-name <node-name> --run-list 'recipe[<cookbook-name>::default]'

但是,它失败了,因为我不能接受许可证

4 -----> Existing Chef installation detected
137.252.24.94 Starting the first Chef Client run...
137.252.24.94 +---------------------------------------------+
137.252.24.94             Chef License Acceptance
137.252.24.94
137.252.24.94 Before you can continue, 2 product licenses
137.252.24.94 must be accepted. View the license at
137.252.24.94 https://www.chef.io/end-user-license-agreement/
137.252.24.94
137.252.24.94 Licenses that need accepting:
137.252.24.94   * Chef Infra Client
137.252.24.94   * Chef InSpec
137.252.24.94
137.252.24.94 Do you accept the 2 product licenses (yes/no)?

而且我无法从主机输入答案。chef boostrap在 chef 14.0 之前,我曾经能够轻松运行命令。似乎他们升级到 Chef 14.0 并且新升级对许可协议有强制性要求。我如何同意从主机进入客户端机器的许可?

标签: chef-infrachef-recipecookbook

解决方案


基本上,根据我的发现,这个问题可能出现在两种不同的情况下:

  1. 当你运行kitchen converge. kitchen.yml通过在as中添加一段代码可以很容易地解决这个问题

    provisioner:
      client_rb:
        chef_license: accept
    
  2. 当您运行 时knife bootstrap,这可能是一些额外的工作。这个页面 解释了所有需要做的事情。目录里面.chef

> mkdir bootstrap
> cd bootstrap && touch template.erb
> find /opt/chefdk/embedded/lib/ruby -type f -name chef-full.erb -exec cat {} \; > template.erb

找到那部分说的那行

cat > /etc/chef/client.rb <<'EOP
<%= config_content %>
EOP

并将其替换为

cat > /etc/chef/client.rb <<'EOP'
<%= config_content %>
chef_license "accept"
EOP

接下来,运行命令knife bootstrap <host> --ssh-user '<username>' -i <my-identity>.pem --sudo --use-sudo-password --node-name <node-name> --boostrap-template "template" --run-list 'recipe[<cookbook-name>::default]'。那照顾了它。


推荐阅读