Pages

Monday 27 January 2014

Trouobleshooting chef-server and chef

Trouobleshooting chef-server and chef

  1. had an error: Net::HTTPServerException: 403 "Forbidden"
    1. Solutions
      1. long running recipes cause Forbidden errors. So, increase timeout value
        1. create a file /etc/chef-server/chef-server.rb that contains "erchef['s3_url_ttl'] = 3600"
           chef-server-ctl reconfigure
        2. On "Private Chef" the variable to change turns out to be slightly different:
                opscode_erchef['s3_url_ttl'] = 3600
      2. http://stackoverflow.com/questions/11870336/chef-client-connection-errors-after-executing-knife-bootstrap
  2. lost private keys
    1. Lost of admin.pem file
      1. Visit webui 
        1. Edit account >> Edit >> Regnerate private key
      2. Lost chef-validator private key
    2. cleanse chef-server and start from scratch
      1. sudo chef-server-ctl cleanse
  3. ERROR: TypeError: can't convert nil into String
    1. Most probably argument error. I get this while executing following cookbook command:
        $ knife cookbook create apache
      • Reason it give me this error was my knife.rb file was incomplete. I didn't specify cookbook_path variable. This mean i've to explicitly specify cookbook path while executing knife commands.
      • I solved this by adding "cookbook_path" variable in my knife.rb file
        OR
      • giving -o argument to specify cookbook directory
        $ knife cookbook create MYCOOKBOOK -o /path/to/my/cookbook_dir
  4. Not able to communicate with chef-server
    1. /opt/chef/embedded/lib/ruby/1.9.1/net/http.rb:763:in `initialize': Connection re
    2.  
    3. used - connect(2) (Errno::ECONNREFUSED)
    • Most probably chef-server is not configured with right parameters like server name
    • Visit chef-server and cd /etc/chef-server  or wherever your chef-server is installed
    • make chef-server.rb file and enter following parameters

      server_name = "192.168.56.11"
      api_fqdn server_name
      nginx['url'] = "https://#{server_name}"
      nginx['server_name'] = server_name
      lb['fqdn'] = server_name
      bookshelf['vip'] = server_name
    • verify chef-server configuration :
      $ sudo chef-server-ctl show-config
    • More info here: http://stackoverflow.com/questions/19586040/install-chef-server-11-on-ec2-instance
  5. Old recipes are getting run on node 
    1. Most probably you forget to commit your changes and upload on chef-server
      1. $ knife cookbook upload cookbook_02


    1. Path to chef_repo is incorrect in knife.rb file. Please update it to point to current chef_repo
  6. Unable to set environment on a node during bootstrap
    1. Somehow knife is not setting environment if environment command line parameter is in the middle or the last option.
      using "knife bootstrap <hostname|IP> -E environment ... " work fine - environment option is first in the list.
      eg .
      knife bootstrap IP -E 'Development




Reference:
  1. https://wiki.opscode.com/display/chef/Common+Errors
  2. http://stackoverflow.com/questions/11870336/chef-client-connection-errors-after-executing-knife-bootstrap
  3. https://tickets.opscode.com/browse/CHEF-2614

No comments:

Post a Comment