Chef's Knife Creates Failure to Create API User

It seems like it's easy to do, but I just can't get the knife to create a new user for me. I am a custom chef server with a control panel. I created an admin user with an initial command knife configure --initial

with a root user. Now I am trying to create an api user for a local user named "myuser" for example.

So, I do this:

myuser@chefserver:~$ knife configure --initial
Overwrite /home/myuser/.chef/knife.rb? (Y/N)y
Please enter the chef server URL: [https://chefserver:443] 
Please enter a name for the new user: [myuser]
Please enter the existing admin name: [admin]
Please enter the location of the existing admin private key: [/etc/chef-server/admin.pem] 
Please enter the validation clientname: [chef-validator] 
Please enter the location of the validation key: [/etc/chef-server/chef-validator.pem] 
Please enter the path to a chef repository (or leave blank): 
Creating initial API user...
Please enter a password for the new user: 
ERROR: The data in your request was invalid
Response: Field 'display_name' missing


Why can't I create an API user?


source to share

2 answers

knife configure

does not work with Chef Server 12 at this time. The easiest way to do the initial setup for Chef Server 12 is to use the premium WebUI feature. It's free for up to 25 nodes, otherwise you should check with Chef Software for pricing. You can do the customization using command line tools, but this is currently undocumented and not very viable for most people.



The comment below assumes that you have already created an organization and a user for that organization on the core server. And that you've copied the user and organization keys .pem to your local workstation and are now ready to install the workstation.

The user is an administrator and the organization is bwengineering, the user must belong to the organization. Fully qualified domain name of the main server -

Also note that you need to fetch master crt files with this:

knife ssl fetch


Make sure to cd into your chef-repo folder to do all this.

In chef 12 DO NOT use knife configure --initial

. Pass the arguments as flags instead. Like this:

knife configure -s -r ~/chef-repo --admin-client-key ~/chef-repo/.chef/admin.pem --admin-client-name admin -c ~/chef-repo/.chef/knife.rb --validation-client-name bwengineering-validator --validation-key ~/chef-repo/.chef/chef-validator.pem


After that export the chefdk binaries to your .bash_profile and THEN upload your nodes. How to do this depends on your node configuration. If you can log in as root, use it directly, otherwise use the --sudo flag.



All Articles