How to start a interactive Chef client just like start a rails by “rails console”?

StackOverflow https://stackoverflow.com/questions/8585618

  •  23-03-2021
  •  | 
  •  

문제

In chef workstation client, I want to start an interactive console to debug and check the role/recipe, or use search api, e.g.

 chef-client > nodes=search ("node","name:*")
 chef-client > puts "#{nodes}"

...

Just like in rails, use "rails console" to load all your rails environment into irb.

How to do it?

도움이 되었습니까?

해결책

The "shef" tool may be what you're looking for, it starts an IRB session in your chef environment where you can do things like search, browse and manipulate your nodes, roles, etc. There's even a debugger to step through your recipes using the "breakpoint" resource.

Here's a real basic example

chef > nodes.list
=> [node[db1-production], node[worker1-production], node[app1-production]]
chef > nodes.show('app1-production').class
 => Chef::Node 

etc.. check out the OpsCode wiki page about it: http://wiki.opscode.com/display/chef/Shef

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top