Configuring the pem file to use for chef push


#1

Hi,

I have a root user trying to use chef push command. I’m getting the error that it can’t find /root/.chef/ourkey.pem. The pem file already exists in /etc/chef. Root user does not have a .chef directory. Why is it trying to load from a home directory? My client.rb in /etc/chef is as follows:

chef_server_url        "https://ourchef-server.net/organizations/ourorg/"
validation_client_name "our-validator"
validation_key         "/etc/chef/our-validator.pem"
ssl_verify_mode        :verify_none
policy_group           "ourcookbooks"
policy_name            "ourcookbooks"

Error:

WARN: Failed to read the private key /root/.chef/ourkey.pem: #<Errno::ENOENT: No such file or directory @ rb_sysopen - /root/.chef/ourkey.pem>

Where do I specify to not look in home directory and to check /etc/chef?


#2

Hi. The chef-client and the knife configuration are two different things. For push jobs you need to configure knife just like you did on your workstation (https://docs.chef.io/config_rb_knife.html). Of course you can point that configuration then to your /etc/chef/client.pem.