[chef] Re: Re: Re: Re: Simple command to get node info when logged in on node through SSH


Chronological Thread 
  • From: Morgan Blackthorne < >
  • To: " " < >
  • Subject: [chef] Re: Re: Re: Re: Simple command to get node info when logged in on node through SSH
  • Date: Thu, 20 Jun 2013 07:51:58 -0700

Thanks for this thread. I just added a script to /etc/update-motd.d with the following:

#!/bin/sh

echo "Chef information:"
echo ""
knife node show $(hostname -f) -c /etc/chef/client.rb -u $(hostname -f) -a chef_environment -a run_list
echo ""

Works great!

--
~*~ StormeRider ~*~

"Every world needs its heroes [...] They inspire us to be better than we are. And they protect from the darkness that's just around the corner."

(from Smallville Season 6x1: "Zod")

On why I hate the phrase "that's so lame"... http://bit.ly/Ps3uSS


On Thu, Jun 20, 2013 at 6:34 AM, Bryan Stenson < " target="_blank"> > wrote:
maybe grep the client.log file and put interesting things into your PS1....

not sure how informed you'd like to be. :)


On Thu, Jun 20, 2013 at 4:41 AM, Maxime Brugidou < " target="_blank"> > wrote:
Hi Chirag, knife status has the same problem than knife node show: it does not work "out of the box" when you are logged in on a node. You need to specify the client.rb config, the node name... etc.

The goal is to get the Chef data of the node you are currently logged in.


On Wed, Jun 19, 2013 at 9:49 AM, Chirag Jog < " target="_blank"> > wrote:
How about knife status : http://docs.opscode.com/knife_status.html ?
That gives a status of all the nodes including most recent chef-client run. 

Regards,
Chirag Jog
Chief Technology Officer, 
Clogeny Technologies | http://clogeny.com 
(M) 0091-9766619440 | Skype: chirag.jog



On Wed, Jun 19, 2013 at 12:58 PM, Maxime Brugidou < " target="_blank"> > wrote:
Ohai all,

This is a simple question, we have many many nodes with various names and we make the node name match the FQDN with a pretty standard naming convention.

However when logged in on a machine it is very very useful to know what's its Chef state. Currently multiple possibilities:

* Use the motd cookbook that will give you some last run static info when you login
* Use a command like knife node show $(hostname -f) -c /etc/chef/client.rb -u $(hostname -f)

I like the command (because it's very flexible) but I'd expect it to be simpler, I know i can do a simple alias, deploy a simple script on my nodes or anything, but this has to be something that other people need right ?

So if we go the knife way, here are my suggestions:
* Why not make knife look for a client.rb file in /etc/chef/client.rb if no configuration is available?
* Why do i have to specify the node_name conf through -u option? it should be default if none available
* Why not make knife node show without arguments show the current node if any ?

Please enlighten me if you know a better way (or if you don't care).

Cheers,
Maxime







Archive powered by MHonArc 2.6.16.

§