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

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

  •  23-03-2021
  •  | 
  •  

Pregunta

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?

¿Fue útil?

Solución

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

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top