Install chefdk on windows for chef server core

Hello guys.

I am trying to install ChefDK on a windows workstation (hostname: workstation01) for a chef server core.

I’ve installed chef server on a CentOS7 (hostname: chef01.domain.corp), I’ve create the organization (chef-org) and admin user.

I’ve installed ChefDK on my windows machine, I’ve create a folder c:\Projects\chef

In it, I’ve run chef generate app chef-repo, I’ve created .chef folder where I’ve copied the organization and user pem files and I’ve create a knife.rb file with the following content:

current_dir = File.dirname(__FILE__)
log_level                :info
log_location             STDOUT
node_name                'workstation01'
client_key               "#{current_dir}/user.pem"
validation_client_name   'chef-validator'
validation_key           "#{current_dir}/chef-org.pem"
chef_server_url          'https://chef01.domain.corp/organizations/chef-org'
cache_type               'BasicFile'
cache_options( :path => "#{ENV['HOME']}/.chef/checksums" )
cookbook_path            ["#{current_dir}/../cookbooks"]

I’ve run knife ssl fetch and the response was:

WARNING: Certificates from chef01.domain.corp will be fetched and placed in your trusted_cert
directory (d:\projects\chef\.chef\trusted_certs).

Knife has no means to verify these are the correct certificates. You should
verify the authenticity of these certificates after downloading.

Adding certificate for chef01_global_sdl_corp in d:\projects\chef\.chef\trusted_certs/chef01_global_sdl_corp.crt

When running knife ssh check, i get this:

Connecting to host chef01.domain.corp:443
Successfully verified certificates from `chef01.domain.corp'

But when I run knife node list, I get this:

ERROR: Failed to authenticate to https://chef01.domain.corp/organizations/chef-org as workstation1 with key D:/projects/chef/.chef/user.pem
Response:  Failed to authenticate as 'workstation01'. Ensure that your node_name and client key are correct.

The question is… having no webUI, how do I register my workstation as node for chef server?

Thank you,

Try removing node_name from knife.rb.

1 Like

Your node_name should match the user for which the user.pem has been created. So it should be your admin user as far as I understood what you did

1 Like