Running knife ssh question

Question.

I’m running knife ssh “role:web” “uptime”; works great. But alas, I want to EXCLUDE web03, and maybe web05 also, how would I do that?

Thanks!

Best Regards,
JJ Asghar
e: jj.asghar@peopleadmin.com | c: 512.619.0722 | o: 512.977.5876

On Thursday, February 14, 2013 at 9:19 AM, JJ Asghar wrote:

Question.

I'm running knife ssh "role:web" "uptime"; works great. But alas, I want to EXCLUDE web03, and maybe web05 also, how would I do that?
What is special about these hosts?

Thanks!

Best Regards,
JJ Asghar
e: jj.asghar@peopleadmin.com (mailto:jj.asghar@peopleadmin.com) | c: 512.619.0722 | o: 512.977.5876

--
Daniel DeLeo

Nothing, but incase I wanted to exclude them.

I have a bunch of machines with the role, but I don’t want to run something on every single machine. Take for instance I have a bunch of web servers and I needed to delete something on every one except web03 and web05. If I have 20 odd machines doing knife ssh –m “web01 web02 web04 web06 web07…web20” “rm ~/somefile” that would annoying right? Knife ssh “role:web –exclude web03 web05” “rm ~/somefile” would be so much better?

Thoughts?

Best Regards,
JJ Asghar
e: jj.asghar@peopleadmin.com | c: 512.619.0722 | o: 512.977.5876

From: Daniel DeLeo <dan@kallistec.commailto:dan@kallistec.com>
Reply-To: "chef@lists.opscode.commailto:chef@lists.opscode.com" <chef@lists.opscode.commailto:chef@lists.opscode.com>
Date: Thursday, February 14, 2013 11:33 AM
To: "chef@lists.opscode.commailto:chef@lists.opscode.com" <chef@lists.opscode.commailto:chef@lists.opscode.com>
Subject: [chef] Re: Running knife ssh question

On Thursday, February 14, 2013 at 9:19 AM, JJ Asghar wrote:

Question.

I’m running knife ssh “role:web” “uptime”; works great. But alas, I want to EXCLUDE web03, and maybe web05 also, how would I do that?
What is special about these hosts?

Thanks!

Best Regards,
JJ Asghar
e: jj.asghar@peopleadmin.commailto:jj.asghar@peopleadmin.com | c: 512.619.0722 | o: 512.977.5876


Daniel DeLeo

On Thursday, February 14, 2013 at 9:55 AM, JJ Asghar wrote:

Nothing, but incase I wanted to exclude them.

I have a bunch of machines with the role, but I don't want to run something on every single machine. Take for instance I have a bunch of web servers and I needed to delete something on every one except web03 and web05. If I have 20 odd machines doing knife ssh –m "web01 web02 web04 web06 web07…web20" "rm ~/somefile" that would annoying right? Knife ssh "role:web –exclude web03 web05" "rm ~/somefile" would be so much better?

Thoughts?
If the machines are actually different for some reason, then presumably there should be a difference in the searchable data, so you can just modify your search query to look for a particular attribute value that distinguishes them.

Best Regards,
JJ Asghar
e: jj.asghar@peopleadmin.com (mailto:jj.asghar@peopleadmin.com) | c: 512.619.0722 | o: 512.977.5876

--
Daniel DeLeo

You can test out your queries with knife search first:

knife search node "role:web AND NOT name:web03"

The search query is actually a Solr query, so knowing some Solr query
search syntax will help. The particular gotcha with this is never lead
off with a NOT parameter, because that means something non-intuitive
in Solr land. If you need to find anything that's NOT something, do
": AND NOT foo:bar".

http://wiki.apache.org/solr/SolrQuerySyntax?highlight=((SolrQuerySyntax))

Michael Della Bitta


Appinions
18 East 41st Street, 2nd Floor
New York, NY 10017-6271

Where Influence Isn’t a Game

On Thu, Feb 14, 2013 at 12:55 PM, JJ Asghar jj.asghar@peopleadmin.com wrote:

Nothing, but incase I wanted to exclude them.

I have a bunch of machines with the role, but I don't want to run something
on every single machine. Take for instance I have a bunch of web servers
and I needed to delete something on every one except web03 and web05. If I
have 20 odd machines doing knife ssh –m "web01 web02 web04 web06
web07…web20" "rm ~/somefile" that would annoying right? Knife ssh "role:web
–exclude web03 web05" "rm ~/somefile" would be so much better?

Thoughts?

Best Regards,
JJ Asghar
e: jj.asghar@peopleadmin.com | c: 512.619.0722 | o: 512.977.5876

From: Daniel DeLeo dan@kallistec.com
Reply-To: "chef@lists.opscode.com" chef@lists.opscode.com
Date: Thursday, February 14, 2013 11:33 AM
To: "chef@lists.opscode.com" chef@lists.opscode.com
Subject: [chef] Re: Running knife ssh question

On Thursday, February 14, 2013 at 9:19 AM, JJ Asghar wrote:

Question.

I'm running knife ssh "role:web" "uptime"; works great. But alas, I want to
EXCLUDE web03, and maybe web05 also, how would I do that?

What is special about these hosts?

Thanks!

Best Regards,
JJ Asghar
e: jj.asghar@peopleadmin.com | c: 512.619.0722 | o: 512.977.5876

--
Daniel DeLeo

Awesome!

Thanks, exactly what I was looking for!

Best Regards,
JJ Asghar
e: jj.asghar@peopleadmin.com | c: 512.619.0722 | o: 512.977.5876

On 2/14/13 12:11 PM, "Michael Della Bitta"
michael.della.bitta@appinions.com wrote:

You can test out your queries with knife search first:

knife search node "role:web AND NOT name:web03"

The search query is actually a Solr query, so knowing some Solr query
search syntax will help. The particular gotcha with this is never lead
off with a NOT parameter, because that means something non-intuitive
in Solr land. If you need to find anything that's NOT something, do
": AND NOT foo:bar".

http://wiki.apache.org/solr/SolrQuerySyntax?highlight=((SolrQuerySynta
x%29%29

Michael Della Bitta


Appinions
18 East 41st Street, 2nd Floor
New York, NY 10017-6271

www.appinions.com

Where Influence Isn’t a Game

On Thu, Feb 14, 2013 at 12:55 PM, JJ Asghar jj.asghar@peopleadmin.com
wrote:

Nothing, but incase I wanted to exclude them.

I have a bunch of machines with the role, but I don't want to run
something
on every single machine. Take for instance I have a bunch of web
servers
and I needed to delete something on every one except web03 and web05.
If I
have 20 odd machines doing knife ssh –m "web01 web02 web04 web06
web07…web20" "rm ~/somefile" that would annoying right? Knife ssh
"role:web
–exclude web03 web05" "rm ~/somefile" would be so much better?

Thoughts?

Best Regards,
JJ Asghar
e: jj.asghar@peopleadmin.com | c: 512.619.0722 | o: 512.977.5876

From: Daniel DeLeo dan@kallistec.com
Reply-To: "chef@lists.opscode.com" chef@lists.opscode.com
Date: Thursday, February 14, 2013 11:33 AM
To: "chef@lists.opscode.com" chef@lists.opscode.com
Subject: [chef] Re: Running knife ssh question

On Thursday, February 14, 2013 at 9:19 AM, JJ Asghar wrote:

Question.

I'm running knife ssh "role:web" "uptime"; works great. But alas, I
want to
EXCLUDE web03, and maybe web05 also, how would I do that?

What is special about these hosts?

Thanks!

Best Regards,
JJ Asghar
e: jj.asghar@peopleadmin.com | c: 512.619.0722 | o: 512.977.5876

--
Daniel DeLeo

hey, i've done exactly this :slight_smile:

use case: all the hosts are having issues...

  1. pull one from the load balancer
  2. on that one, discover that I need to remove some specific thing, then
    restart the service
  • In the process of that discovery, I do the work. I don't want to do it
    again.
  1. now apply to the rest: knife ssh "role:myrole AND NOT
    name:themachineialreadyfixed" "remove_the_thing && restart_the_service"

On Thu, Feb 14, 2013 at 1:13 PM, JJ Asghar jj.asghar@peopleadmin.comwrote:

Awesome!

Thanks, exactly what I was looking for!

Best Regards,
JJ Asghar
e: jj.asghar@peopleadmin.com | c: 512.619.0722 | o: 512.977.5876

On 2/14/13 12:11 PM, "Michael Della Bitta"
michael.della.bitta@appinions.com wrote:

You can test out your queries with knife search first:

knife search node "role:web AND NOT name:web03"

The search query is actually a Solr query, so knowing some Solr query
search syntax will help. The particular gotcha with this is never lead
off with a NOT parameter, because that means something non-intuitive
in Solr land. If you need to find anything that's NOT something, do
": AND NOT foo:bar".

http://wiki.apache.org/solr/SolrQuerySyntax?highlight=((SolrQuerySynta

x%29%29

Michael Della Bitta


Appinions
18 East 41st Street, 2nd Floor
New York, NY 10017-6271

www.appinions.com

Where Influence Isn’t a Game

On Thu, Feb 14, 2013 at 12:55 PM, JJ Asghar jj.asghar@peopleadmin.com
wrote:

Nothing, but incase I wanted to exclude them.

I have a bunch of machines with the role, but I don't want to run
something
on every single machine. Take for instance I have a bunch of web
servers
and I needed to delete something on every one except web03 and web05.
If I
have 20 odd machines doing knife ssh –m "web01 web02 web04 web06
web07…web20" "rm ~/somefile" that would annoying right? Knife ssh
"role:web
–exclude web03 web05" "rm ~/somefile" would be so much better?

Thoughts?

Best Regards,
JJ Asghar
e: jj.asghar@peopleadmin.com | c: 512.619.0722 | o: 512.977.5876

From: Daniel DeLeo dan@kallistec.com
Reply-To: "chef@lists.opscode.com" chef@lists.opscode.com
Date: Thursday, February 14, 2013 11:33 AM
To: "chef@lists.opscode.com" chef@lists.opscode.com
Subject: [chef] Re: Running knife ssh question

On Thursday, February 14, 2013 at 9:19 AM, JJ Asghar wrote:

Question.

I'm running knife ssh "role:web" "uptime"; works great. But alas, I
want to
EXCLUDE web03, and maybe web05 also, how would I do that?

What is special about these hosts?

Thanks!

Best Regards,
JJ Asghar
e: jj.asghar@peopleadmin.com | c: 512.619.0722 | o: 512.977.5876

--
Daniel DeLeo

+1 on this use case to roll out fixes and/or new features/configs in a
"one, many, all" fashion.

On Thu, Feb 14, 2013 at 5:49 PM, Jesse Campbell hikeit@gmail.com wrote:

hey, i've done exactly this :slight_smile:

use case: all the hosts are having issues...

  1. pull one from the load balancer
  2. on that one, discover that I need to remove some specific thing, then
    restart the service
  • In the process of that discovery, I do the work. I don't want to do it
    again.
  1. now apply to the rest: knife ssh "role:myrole AND NOT
    name:themachineialreadyfixed" "remove_the_thing && restart_the_service"

On Thu, Feb 14, 2013 at 1:13 PM, JJ Asghar jj.asghar@peopleadmin.comwrote:

Awesome!

Thanks, exactly what I was looking for!

Best Regards,
JJ Asghar
e: jj.asghar@peopleadmin.com | c: 512.619.0722 | o: 512.977.5876

On 2/14/13 12:11 PM, "Michael Della Bitta"
michael.della.bitta@appinions.com wrote:

You can test out your queries with knife search first:

knife search node "role:web AND NOT name:web03"

The search query is actually a Solr query, so knowing some Solr query
search syntax will help. The particular gotcha with this is never lead
off with a NOT parameter, because that means something non-intuitive
in Solr land. If you need to find anything that's NOT something, do
": AND NOT foo:bar".

http://wiki.apache.org/solr/SolrQuerySyntax?highlight=((SolrQuerySynta

x%29%29

Michael Della Bitta


Appinions
18 East 41st Street, 2nd Floor
New York, NY 10017-6271

www.appinions.com

Where Influence Isn’t a Game

On Thu, Feb 14, 2013 at 12:55 PM, JJ Asghar jj.asghar@peopleadmin.com
wrote:

Nothing, but incase I wanted to exclude them.

I have a bunch of machines with the role, but I don't want to run
something
on every single machine. Take for instance I have a bunch of web
servers
and I needed to delete something on every one except web03 and web05.
If I
have 20 odd machines doing knife ssh –m "web01 web02 web04 web06
web07…web20" "rm ~/somefile" that would annoying right? Knife ssh
"role:web
–exclude web03 web05" "rm ~/somefile" would be so much better?

Thoughts?

Best Regards,
JJ Asghar
e: jj.asghar@peopleadmin.com | c: 512.619.0722 | o: 512.977.5876

From: Daniel DeLeo dan@kallistec.com
Reply-To: "chef@lists.opscode.com" chef@lists.opscode.com
Date: Thursday, February 14, 2013 11:33 AM
To: "chef@lists.opscode.com" chef@lists.opscode.com
Subject: [chef] Re: Running knife ssh question

On Thursday, February 14, 2013 at 9:19 AM, JJ Asghar wrote:

Question.

I'm running knife ssh "role:web" "uptime"; works great. But alas, I
want to
EXCLUDE web03, and maybe web05 also, how would I do that?

What is special about these hosts?

Thanks!

Best Regards,
JJ Asghar
e: jj.asghar@peopleadmin.com | c: 512.619.0722 | o: 512.977.5876

--
Daniel DeLeo