Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
270 views
in Technique[技术] by (71.8m points)

Accepting Chef Infra Client license agreement for version >= 14

I'm trying to bootstrap a node using chef by using the command knife bootstrap <host> --ssh-user '<username>' -i <my-identity>.pem --sudo --use-sudo-password --node-name <node-name> --run-list 'recipe[<cookbook-name>::default]'

However, its failing because I can't accept the license

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)?

And I can't input the answer from the host machine. I used to be able to run the chef boostrap command easily before chef 14.0. It seems like they upgraded to Chef 14.0 and the new upgrade has a mandatory requirement for the license agreement. How do I agree the license into the client machine from the host machine?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Basically, based on my findings, this problem can occur in two different scenarios:

  1. When you're running the kitchen converge. This can be solved very easily by adding a piece of code inside the kitchen.yml as

    provisioner:
      client_rb:
        chef_license: accept
    
  2. When you're running the knife bootstrap, this can be a little bit of extra work. This page explains all that needs to be done. Inside the .chef directory.

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

Find the line that part that says

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

and replace it with

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

Next, run the command 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]'. That took care of it.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...