Chef workstation is unable to find knife.rb unless in "chef-repo" -
when run
knife node listwhile in/home/ec2-usercomplains"warning: no knife configuration file found
error: private key not loaded /etc/chef/client.pem check configuration file , ensure private key readable"when run
knife node listwhile in/home/ec2-user/chef-repoexecutes successfully
chef-repodirectory contains.chef/knife.rb
my knife.rb located in /home/ec2-user/chef-repo/.chef/knife.rb
my knife.rb contents:
log_level :info log_location stdout node_name 'admin' client_key '/home/ec2-user/chef-repo/.chef/admin.pem' validation_client_name 'chef-validator' validation_key '/home/ec2-user/chef-repo/.chef/chef-validator.pem' chef_server_url 'https://xx.xx.xx.xx:443' syntax_check_cache_path '/home/ec2-user/chef-repo/.chef/syntax_check_cache' cookbook_path [ '~/chef-repo/cookbooks/cookbooks' ]
if want have "global per-user" config, either set knife_home environment variable .chef directory or copy/symlink knife.rb /home/ec2-user/.chef/knife.rb
specification: https://github.com/chef/chef/blob/master/spec/unit/workstation_config_loader_spec.rb#l51
implementation: https://github.com/chef/chef/blob/master/lib/chef/workstation_config_loader.rb#l97-l124
Comments
Post a Comment