How to generate the pre populated information in metadata.rb in chef?

rajeshkumar created the topic: How to generate the pre populated information in metadata.rb in chef?

How to generate the pre populated information in metadata.rb in chef

You can configure the values in my knife.rb:

cookbookcopyright “Rajesh Kumar”
cookbooklicense “apachev2”
cookbook_email “rajesh@scmgalaxy.com”

Regards,
Rajesh Kumar
Twitt me @ twitter.com/RajeshKumarIn

Tagged :

Error: Could not find cookbook cookbooks_test in your cookbook path, sk

rajeshkumar created the topic: ERROR: Could not find cookbook cookbooks_test in your cookbook path, sk

Error while uploading the cookbooks….

> knife cookbook upload cookbooks_test
ERROR: Could not find cookbook cookbooks_test in your cookbook path, skipping it
ERROR: Failed to upload 1 cookbook.

Solution:

You can pass path of the cookbooks via commend line using…

knife cookbook upload cookbooks_test -o /path/to/cookbook

Also, you can set the path in .chef/knife.rb. If .chef/knife.rb is missing, you can following commands…

knife configure --initial

But if you install the startter kit from manage.chef.io, you just need to replace all the files including .knife.rb

if you cookbooks files many places then you can set your .knife.rb like as below;

cookbook_path [ '.', '..', './cookbooks', '~/git/chef' ]

If you are still getting this error, make sure the metadata.rb has same name which you using to upload the cookbooks.
Regards,
Rajesh Kumar
Twitt me @ twitter.com/RajeshKumarIn

Tagged :

Fatal: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully

rajeshkumar created the topic: FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully

FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully

> knife bootstrap uvo1t75faaktzc532w6.vm.cld.sr -x root -P Br356YS0iy --sudo

Doing old-style registration with the validation key at /Users/rajesh.kumar/chef-repo/.chef/scmgalaxy-validator.pem...
Delete your validation key in order to use your user credentials instead

Connecting to uvo1t75faaktzc532w6.vm.cld.sr
uvo1t75faaktzc532w6.vm.cld.sr
> Existing Chef installation detected
uvo1t75faaktzc532w6.vm.cld.sr Starting first Chef Client run...
uvo1t75faaktzc532w6.vm.cld.sr [2015-08-20T12:01:37-04:00] WARN:
uvo1t75faaktzc532w6.vm.cld.sr * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
uvo1t75faaktzc532w6.vm.cld.sr SSL validation of HTTPS requests is disabled. HTTPS connections are still
uvo1t75faaktzc532w6.vm.cld.sr encrypted, but chef is not able to detect forged replies or man in the middle
uvo1t75faaktzc532w6.vm.cld.sr attacks.
uvo1t75faaktzc532w6.vm.cld.sr
uvo1t75faaktzc532w6.vm.cld.sr To fix this issue add an entry like this to your configuration file:
uvo1t75faaktzc532w6.vm.cld.sr
uvo1t75faaktzc532w6.vm.cld.sr ```
uvo1t75faaktzc532w6.vm.cld.sr # Verify all HTTPS connections (recommended)
uvo1t75faaktzc532w6.vm.cld.sr ssl_verify_mode :verify_peer
uvo1t75faaktzc532w6.vm.cld.sr
uvo1t75faaktzc532w6.vm.cld.sr # OR, Verify only connections to chef-server
uvo1t75faaktzc532w6.vm.cld.sr verify_api_cert true
uvo1t75faaktzc532w6.vm.cld.sr ```
uvo1t75faaktzc532w6.vm.cld.sr
uvo1t75faaktzc532w6.vm.cld.sr To check your SSL configuration, or troubleshoot errors, you can use the
uvo1t75faaktzc532w6.vm.cld.sr `knife ssl check` command like so:
uvo1t75faaktzc532w6.vm.cld.sr
uvo1t75faaktzc532w6.vm.cld.sr ```
uvo1t75faaktzc532w6.vm.cld.sr knife ssl check -c /etc/chef/client.rb
uvo1t75faaktzc532w6.vm.cld.sr ```
uvo1t75faaktzc532w6.vm.cld.sr
uvo1t75faaktzc532w6.vm.cld.sr * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
uvo1t75faaktzc532w6.vm.cld.sr
uvo1t75faaktzc532w6.vm.cld.sr Starting Chef Client, version 11.16.2
uvo1t75faaktzc532w6.vm.cld.sr
uvo1t75faaktzc532w6.vm.cld.sr ================================================================================
uvo1t75faaktzc532w6.vm.cld.sr Chef encountered an error attempting to load the node data for "C2445575914.domain"
uvo1t75faaktzc532w6.vm.cld.sr ================================================================================
uvo1t75faaktzc532w6.vm.cld.sr
uvo1t75faaktzc532w6.vm.cld.sr Authentication Error:
uvo1t75faaktzc532w6.vm.cld.sr
uvo1t75faaktzc532w6.vm.cld.sr Failed to authenticate to the chef server (http 401).
uvo1t75faaktzc532w6.vm.cld.sr
uvo1t75faaktzc532w6.vm.cld.sr Server Response:
uvo1t75faaktzc532w6.vm.cld.sr
uvo1t75faaktzc532w6.vm.cld.sr Failed to authenticate as 'C2445575914.domain'. Ensure that your node_name and client key are correct.
uvo1t75faaktzc532w6.vm.cld.sr
uvo1t75faaktzc532w6.vm.cld.sr Relevant Config Settings:
uvo1t75faaktzc532w6.vm.cld.sr
uvo1t75faaktzc532w6.vm.cld.sr chef_server_url " api.opscode.com/organizations/scmgalaxy "
uvo1t75faaktzc532w6.vm.cld.sr node_name "C2445575914.domain"
uvo1t75faaktzc532w6.vm.cld.sr client_key "/etc/chef/client.pem"
uvo1t75faaktzc532w6.vm.cld.sr
uvo1t75faaktzc532w6.vm.cld.sr If these settings are correct, your client_key may be invalid, or
uvo1t75faaktzc532w6.vm.cld.sr you may have a chef user with the same client name as this node.
uvo1t75faaktzc532w6.vm.cld.sr
uvo1t75faaktzc532w6.vm.cld.sr [2015-08-20T12:01:41-04:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
uvo1t75faaktzc532w6.vm.cld.sr Chef Client failed. 0 resources updated in 3.598799916 seconds
uvo1t75faaktzc532w6.vm.cld.sr [2015-08-20T12:01:41-04:00] ERROR: 401 "Unauthorized"
uvo1t75faaktzc532w6.vm.cld.sr [2015-08-20T12:01:41-04:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

Regards,
Rajesh Kumar
Twitt me @ twitter.com/RajeshKumarIn

rajeshkumar replied the topic: FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited u

I just login to the nodes and deleted all files under /etc/chef/ and rerun the commands and worked like charm.

Regards,
Rajesh Kumar
Twitt me @ twitter.com/RajeshKumarIn

Tagged :

Error: Network Error: getaddrinfo: nodename nor servname provided, or

rajeshkumar created the topic: ERROR: Network Error: getaddrinfo: nodename nor servname provided, or

Issues –

knife bootstrap uvo1t75faaktzc532w6.vm.cld.sr -x root -P Br356YS0iy --sudo --node-name firefox
Doing old-style registration with the validation key at /Users/rajesh.kumar/.chef/scmgalaxy-validator.pem...
Delete your validation key in order to use your user credentials instead

Connecting to uvo1t75faaktzc532w6.vm.cld.sr
uvo1t75faaktzc532w6.vm.cld.sr
> Existing Chef installation detected
uvo1t75faaktzc532w6.vm.cld.sr Starting first Chef Client run...
uvo1t75faaktzc532w6.vm.cld.sr [2015-08-20T12:10:17-04:00] WARN:
uvo1t75faaktzc532w6.vm.cld.sr * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
uvo1t75faaktzc532w6.vm.cld.sr SSL validation of HTTPS requests is disabled. HTTPS connections are still
uvo1t75faaktzc532w6.vm.cld.sr encrypted, but chef is not able to detect forged replies or man in the middle
uvo1t75faaktzc532w6.vm.cld.sr attacks.
uvo1t75faaktzc532w6.vm.cld.sr
uvo1t75faaktzc532w6.vm.cld.sr To fix this issue add an entry like this to your configuration file:
uvo1t75faaktzc532w6.vm.cld.sr
uvo1t75faaktzc532w6.vm.cld.sr ```
uvo1t75faaktzc532w6.vm.cld.sr # Verify all HTTPS connections (recommended)
uvo1t75faaktzc532w6.vm.cld.sr ssl_verify_mode :verify_peer
uvo1t75faaktzc532w6.vm.cld.sr
uvo1t75faaktzc532w6.vm.cld.sr # OR, Verify only connections to chef-server
uvo1t75faaktzc532w6.vm.cld.sr verify_api_cert true
uvo1t75faaktzc532w6.vm.cld.sr ```
uvo1t75faaktzc532w6.vm.cld.sr
uvo1t75faaktzc532w6.vm.cld.sr To check your SSL configuration, or troubleshoot errors, you can use the
uvo1t75faaktzc532w6.vm.cld.sr `knife ssl check` command like so:
uvo1t75faaktzc532w6.vm.cld.sr
uvo1t75faaktzc532w6.vm.cld.sr ```
uvo1t75faaktzc532w6.vm.cld.sr knife ssl check -c /etc/chef/client.rb
uvo1t75faaktzc532w6.vm.cld.sr ```
uvo1t75faaktzc532w6.vm.cld.sr
uvo1t75faaktzc532w6.vm.cld.sr * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
uvo1t75faaktzc532w6.vm.cld.sr
uvo1t75faaktzc532w6.vm.cld.sr Starting Chef Client, version 11.16.2
uvo1t75faaktzc532w6.vm.cld.sr Creating a new client identity for firefox using the validator key.
uvo1t75faaktzc532w6.vm.cld.sr resolving cookbooks for run list: []
uvo1t75faaktzc532w6.vm.cld.sr Synchronizing Cookbooks:
uvo1t75faaktzc532w6.vm.cld.sr Compiling Cookbooks...
uvo1t75faaktzc532w6.vm.cld.sr [2015-08-20T12:10:21-04:00] WARN: Node firefox has an empty run list.
uvo1t75faaktzc532w6.vm.cld.sr Converging 0 resources
uvo1t75faaktzc532w6.vm.cld.sr
uvo1t75faaktzc532w6.vm.cld.sr Running handlers:
uvo1t75faaktzc532w6.vm.cld.sr Running handlers complete
uvo1t75faaktzc532w6.vm.cld.sr Chef Client finished, 0/0 resources updated in 4.732276995 seconds
MAMSIT1026467:.chef rajesh.kumar$ knife bootstrap {{uvo1t75faaktzc532w6.vm.cld.sr}} --ssh-user {{root}} --ssh-password '{{Br356YS0iy}}' --sudo --use-sudo-password --node-name firefox1
Doing old-style registration with the validation key at /Users/rajesh.kumar/.chef/scmgalaxy-validator.pem...
Delete your validation key in order to use your user credentials instead

Connecting to {{uvo1t75faaktzc532w6.vm.cld.sr}}
ERROR: Network Error: getaddrinfo: nodename nor servname provided, or not known
Check your knife configuration and network settings

Solution –

I am not able to find the problem with the above commands but following commands is working perfectly....
knife bootstrap uvo1t75faaktzc532w6.vm.cld.sr -x root -P Br356YS0iy --sudo --node-name firefox

Regards,
Rajesh Kumar
Twitt me @ twitter.com/RajeshKumarIn

Tagged :

You must set your EDITOR environment variable or configure your editor

rajeshkumar created the topic: You must set your EDITOR environment variable or configure your editor

Error

knife node edit firefox
ERROR: You must set your EDITOR environment variable or configure your editor via knife.rb

Solution:

export EDITOR=$(which vi)
To persist this, add it to ~/.bashrc or ~/.bash_profile.
or
knife[:editor] = "vi" in knife.rb

Regards,
Rajesh Kumar
Twitt me @ twitter.com/RajeshKumarIn

Tagged :

Waiting for remote response before bootstrap in windows

rajeshkumar created the topic: Waiting for remote response before bootstrap in windows

When i bootstrap windows node, i get following error..

knife bootstrap windows winrm uvo1eak9a5geec05f7z.vm.cld.sr --winrm-user administrator --winrm-password 'Rx4m7W4PQu' --node-name firefox_win --run-list 'recipe[snc_firefox]'

Waiting for remote response before bootstrap./opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/em-winrm-0.7.0/lib/em-winrm/session.rb:48: warning: epoll is not supported on this platform
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/em-winrm-0.7.0/lib/em-winrm/server.rb:45: warning: epoll is not supported on this platform
../opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/em-winrm-0.7.0/lib/em-winrm/session.rb:48: warning: epoll is not supported on this platform
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/em-winrm-0.7.0/lib/em-winrm/server.rb:45: warning: epoll is not supported on this platform
../opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/em-winrm-0.7.0/lib/em-winrm/session.rb:48: warning: epoll is not supported on this platform
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/em-winrm-0.7.0/lib/em-winrm/server.rb:45: warning: epoll is not supported on this platform
../opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/em-winrm-0.7.0/lib/em-winrm/session.rb:48: warning: epoll is not supported on this platform
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/em-winrm-0.7.0/lib/em-winrm/server.rb:45: warning: epoll is not supported on this platform
../opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/em-winrm-0.7.0/lib/em-winrm/session.rb:48: warning: epoll is not supported on this platform
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/em-winrm-0.7.0/lib/em-winrm/server.rb:45: warning: epoll is not supported on this platform
../opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/em-winrm-0.7.0/lib/em-winrm/session.rb:48: warning: epoll is not supported on this platform
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/em-winrm-0.7.0/lib/em-winrm/server.rb:45: warning: epoll is not supported on this platform
../opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/em-winrm-0.7.0/lib/em-winrm/session.rb:48: warning: epoll is not supported on this platform
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/em-winrm-0.7.0/lib/em-winrm/server.rb:45: warning: epoll is not supported on this platform
../opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/em-winrm-0.7.0/lib/em-winrm/session.rb:48: warning: epoll is not supported on this platform
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/em-winrm-0.7.0/lib/em-winrm/server.rb:45: warning: epoll is not supported on this platform
../opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/em-winrm-0.7.0/lib/em-winrm/session.rb:48: warning: epoll is not supported on this platform
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/em-winrm-0.7.0/lib/em-winrm/server.rb:45: warning: epoll is not supported on this platform
../opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/em-winrm-0.7.0/lib/em-winrm/session.rb:48: warning: epoll is not supported on this platform
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/em-winrm-0.7.0/lib/em-winrm/server.rb:45: warning: epoll is not supported on this platform
../opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/em-winrm-0.7.0/lib/em-winrm/session.rb:48: warning: epoll is not supported on this platform
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/em-winrm-0.7.0/lib/em-winrm/server.rb:45: warning: epoll is not supported on this platform
../opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/em-winrm-0.7.0/lib/em-winrm/session.rb:48: warning: epoll is not supported on this platform
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/em-winrm-0.7.0/lib/em-winrm/server.rb:45: warning: epoll is not supported on this platform
ERROR: No response received from remote node after 1.98 minutes, giving up.
ERROR: WinRM::WinRMAuthorizationError: WinRM::WinRMAuthorizationError

Regards,
Rajesh Kumar
Twitt me @ twitter.com/RajeshKumarIn

Tagged :

Configuration management chef tools projects to test your skills?

rajeshkumar created the topic: Configuration management chef tools projects to test your skills?

Project 1 – Write a cookbook which can add your bash script in crontab on your nodes.

Project 2 – Perforce the following workflow of chef configuration management tools?

— create a new cookbook and add a recipe to it
— upload your cookbook to the Chef server
— configure your node’s run list
— run chef-client to trigger the configuration process on your target node

Project 3 – Write a cookbook with external cookbook_files in Chef?

Project 4 – Write a cookbook which can Set Chef Cookbook Dependencies in metadata file and use it?

Project 5 – Write a cookbook add jenkins slave nodes in jenkins master server using Chef cookbook?

Project 6 – Write a cookbook to configure nginx with chef solo on vagrant?

Project 7 – Write a cookbook to Setting up a MySQL database with a user with Vagrant and chef-solo?

Project 8 – Write a cookbook to track changes made to systems via knife in chef?

Regards,
Rajesh Kumar
Twitt me @ twitter.com/RajeshKumarIn

Tagged :

AWT is not properly configured on this server

rajeshkumar created the topic: AWT is not properly configured on this server

Problem
AWT is not properly configured on this server. Perhaps you need to run your container with “-Djava.awt.headless=true”? See also: wiki.jenkins-ci.org/display/JENKINS/Jenk…awt.headless+problem

Mixlib::ShellOut::ShellCommandFailed
Expected process to exit with [0], but received '2'
---- Begin output of /opt/opscode/embedded/bin/chpst -u opscode -U opscode /opt/opscode/embedded/bin/rabbitmqctl wait /var/opt/opscode/rabbitmq/db/rabbit@localhost.pid
[2016-08-31T22:10:34-04:00] FATAL:
BOOT007: The secrets file (/etc/opscode/private-chef-secrets.json) is present
but the file /etc/opscode/pivotal.pem is missing.

Ensure that private-chef-secrets.json is copied into /etc/opscode from the
first Chef Server node that you brought online, then run
‘chef-server-ctl reconfigure’ again.
FIX1:

your code here

To fix it, I deleted /etc/opscode/private-chef-secrets.json and run again chef-server-ctl reconfigure

FIX2:

cp /opt/opscode/embedded/service/omnibus-ctl/spec/fixtures/pivotal.pem /etc/opscode/

Regards,
Rajesh Kumar
Twitt me @ twitter.com/RajeshKumarIn

Tagged :

Error executing action `run` on resource ‘execute[/opt/opscode/embedded/bin/chps

rajeshkumar created the topic: Error executing action `run` on resource ‘execute[/opt/opscode/embedded/bin/chps

Error executing action `run` on resource ‘execute[/opt/opscode/embedded/bin/chpst -u opscode -U opscode /opt/opscode/embedded/bin/rabbitmqctl wait /var/opt/opscode/rabbitmq/db/rabbit@localhost.pid]’

Fix 1
So obviously RabbitMq is running, on port 5672, which can be verified through
> netstat -ltnp
tcp 0 0 127.0.0.1:5672 0.0.0.0:* LISTEN 1111/beam.smp

Fix 2
> /etc/init.d/rabbitmq-server stop

Fix 3:
Check your /etc/hosts file. That is not defined well.

Reference
discourse.chef.io/t/chef-server-missing-…and-pivotal-pem/7756
serverfault.com/questions/663310/chef-se…-fails-with-rabbitmq
discourse.chef.io/t/chef-12-server-dead-…nfigure-bombs/7435/7

Regards,
Rajesh Kumar
Twitt me @ twitter.com/RajeshKumarIn

Tagged :