Knife ssh search results missing


#1

knife-ssh is not working on all nodes. If I use knife-search, results are as expected:

$ knife search ‘chef_environment:production’ -i
4 items found

apps

zcast-resourcemanager

database

resourcebase

But with knife-ssh I’m not so lucky.

$ knife ssh ‘chef_environment:production’ 'uptime’
10.0.1.160 17:53:30 up 2 days, 23:29, 3 users, load average: 0.48, 0.47, 0.52

What could be the problem, and how do I fix it? This is an OSS Chef Server, server and all clients are all on latest Chef versions.

Cheers,

Cassiano Leal
http://cassianoleal.com
http://twitter.com/cassianoleal


#2

Hey Cassiano,

Do you see public_hostname or public_ipv4 data catalogued in your node
data? Are you operating in EC2?

$ knife search ‘chef_environment:production’ -a ec2.public_hostname

-or-

$ knife search ‘chef_environment:production’ -a public_ipv4

-K.

On Mon, Jul 22, 2013 at 1:57 PM, Cassiano Leal cassianoleal@gmail.com wrote:

knife-ssh is not working on all nodes. If I use knife-search, results are as
expected:

$ knife search ‘chef_environment:production’ -i

4 items found

apps

zcast-resourcemanager

database

resourcebase

But with knife-ssh I’m not so lucky.

$ knife ssh ‘chef_environment:production’ ‘uptime’

10.0.1.160 17:53:30 up 2 days, 23:29, 3 users, load average: 0.48, 0.47,
0.52

What could be the problem, and how do I fix it? This is an OSS Chef Server,
server and all clients are all on latest Chef versions.

Cheers,

Cassiano Leal
http://cassianoleal.com
http://twitter.com/cassianoleal


Kevin Karwaski
Manager, Cloud Operations @ {Fiksu}


#3

Whoops, the second search example I meant was:

$ knife search ‘chef_environment:production’ -a ec2.public_ipv4

On Mon, Jul 22, 2013 at 2:10 PM, Kevin Karwaski kkarwaski@fiksu.com wrote:

Hey Cassiano,

Do you see public_hostname or public_ipv4 data catalogued in your node
data? Are you operating in EC2?

$ knife search ‘chef_environment:production’ -a ec2.public_hostname

-or-

$ knife search ‘chef_environment:production’ -a public_ipv4

-K.

On Mon, Jul 22, 2013 at 1:57 PM, Cassiano Leal cassianoleal@gmail.com wrote:

knife-ssh is not working on all nodes. If I use knife-search, results are as
expected:

$ knife search ‘chef_environment:production’ -i

4 items found

apps

zcast-resourcemanager

database

resourcebase

But with knife-ssh I’m not so lucky.

$ knife ssh ‘chef_environment:production’ ‘uptime’

10.0.1.160 17:53:30 up 2 days, 23:29, 3 users, load average: 0.48, 0.47,
0.52

What could be the problem, and how do I fix it? This is an OSS Chef Server,
server and all clients are all on latest Chef versions.

Cheers,

Cassiano Leal
http://cassianoleal.com
http://twitter.com/cassianoleal


Kevin Karwaski
Manager, Cloud Operations @ {Fiksu}


Kevin Karwaski
Manager, Cloud Operations @ {Fiksu}


#4

Hi Kevin,

Neither attributes are set, but they shouldn’t make any difference. Yes, I’m on EC2, inside a VPC (which is probably why both public attributes are null).

I have

knife[:ssh_attribute] = 'ec2.local_ipv4’

on knife.rb so it uses that for connecting to the hosts.

I have tried setting it explicitly on the CLI as well:

$ knife ssh ‘chef_environment:production’ ‘uptime’ -a 'ec2.local_ipv4’

but no dice.


Cassiano Leal
http://cassianoleal.com
http://twitter.com/cassianoleal

On July 22, 2013 at 15:12:12, Kevin Karwaski (kkarwaski@fiksu.com) wrote:

knife search ‘chef_environment:production’ -a ec2.public_hostname


#5

Hey Cassiano,

Take a look at this:

http://lists.opscode.com/sympa/arc/chef/2013-06/msg00354.html

http://lists.opscode.com/sympa/arc/chef/2013-06/msg00363.html

Andrew had a similar problem and it was related to the way VPCs handle
address assignment. Maybe this doesn’t apply to your particular
configuration but If you’re launching outside of US-EAST perhaps it’s
valid. Regardless, I hope it helps.

-K.

On Mon, Jul 22, 2013 at 2:27 PM, Cassiano Leal cassianoleal@gmail.com wrote:

Hi Kevin,

Neither attributes are set, but they shouldn’t make any difference. Yes, I’m
on EC2, inside a VPC (which is probably why both public attributes are
null).

I have

knife[:ssh_attribute] = 'ec2.local_ipv4’

on knife.rb so it uses that for connecting to the hosts.

I have tried setting it explicitly on the CLI as well:

$ knife ssh ‘chef_environment:production’ ‘uptime’ -a 'ec2.local_ipv4’

but no dice.


Cassiano Leal
http://cassianoleal.com
http://twitter.com/cassianoleal

On July 22, 2013 at 15:12:12, Kevin Karwaski (kkarwaski@fiksu.com) wrote:

knife search ‘chef_environment:production’ -a ec2.public_hostname


Kevin Karwaski
Manager, Cloud Operations @ {Fiksu}


#6

Also, do all the instances have a valid value for ‘ec2.local_ipv4’?
Are the security groups tuned correctly? Just thinking out loud…

On Mon, Jul 22, 2013 at 2:37 PM, Kevin Karwaski kkarwaski@fiksu.com wrote:

Hey Cassiano,

Take a look at this:

http://lists.opscode.com/sympa/arc/chef/2013-06/msg00354.html

http://lists.opscode.com/sympa/arc/chef/2013-06/msg00363.html

Andrew had a similar problem and it was related to the way VPCs handle
address assignment. Maybe this doesn’t apply to your particular
configuration but If you’re launching outside of US-EAST perhaps it’s
valid. Regardless, I hope it helps.

-K.

On Mon, Jul 22, 2013 at 2:27 PM, Cassiano Leal cassianoleal@gmail.com wrote:

Hi Kevin,

Neither attributes are set, but they shouldn’t make any difference. Yes, I’m
on EC2, inside a VPC (which is probably why both public attributes are
null).

I have

knife[:ssh_attribute] = 'ec2.local_ipv4’

on knife.rb so it uses that for connecting to the hosts.

I have tried setting it explicitly on the CLI as well:

$ knife ssh ‘chef_environment:production’ ‘uptime’ -a 'ec2.local_ipv4’

but no dice.


Cassiano Leal
http://cassianoleal.com
http://twitter.com/cassianoleal

On July 22, 2013 at 15:12:12, Kevin Karwaski (kkarwaski@fiksu.com) wrote:

knife search ‘chef_environment:production’ -a ec2.public_hostname


Kevin Karwaski
Manager, Cloud Operations @ {Fiksu}


Kevin Karwaski
Manager, Cloud Operations @ {Fiksu}


#7

Seems like ec2.local_ipv4 was the culprit. I changed the attribute to ‘ipaddress’ and now all are accessible.

Thanks for the help!

Cassiano Leal
http://cassianoleal.com
http://twitter.com/cassianoleal

On July 22, 2013 at 15:46:01, Kevin Karwaski (kkarwaski@fiksu.com) wrote:

Also, do all the instances have a valid value for ‘ec2.local_ipv4’?
Are the security groups tuned correctly? Just thinking out loud…

On Mon, Jul 22, 2013 at 2:37 PM, Kevin Karwaski kkarwaski@fiksu.com wrote:

Hey Cassiano,

Take a look at this:

http://lists.opscode.com/sympa/arc/chef/2013-06/msg00354.html

http://lists.opscode.com/sympa/arc/chef/2013-06/msg00363.html

Andrew had a similar problem and it was related to the way VPCs handle
address assignment. Maybe this doesn’t apply to your particular
configuration but If you’re launching outside of US-EAST perhaps it’s
valid. Regardless, I hope it helps.

-K.

On Mon, Jul 22, 2013 at 2:27 PM, Cassiano Leal cassianoleal@gmail.com wrote:

Hi Kevin,

Neither attributes are set, but they shouldn’t make any difference. Yes, I’m
on EC2, inside a VPC (which is probably why both public attributes are
null).

I have

knife[:ssh_attribute] = 'ec2.local_ipv4’

on knife.rb so it uses that for connecting to the hosts.

I have tried setting it explicitly on the CLI as well:

$ knife ssh ‘chef_environment:production’ ‘uptime’ -a 'ec2.local_ipv4’

but no dice.


Cassiano Leal
http://cassianoleal.com
http://twitter.com/cassianoleal

On July 22, 2013 at 15:12:12, Kevin Karwaski (kkarwaski@fiksu.com) wrote:

knife search ‘chef_environment:production’ -a ec2.public_hostname


Kevin Karwaski
Manager, Cloud Operations @ {Fiksu}


Kevin Karwaski
Manager, Cloud Operations @ {Fiksu}


#8

Awesome, happy to help! :slight_smile:

On Mon, Jul 22, 2013 at 3:25 PM, Cassiano Leal cassianoleal@gmail.com wrote:

Seems like ec2.local_ipv4 was the culprit. I changed the attribute to
‘ipaddress’ and now all are accessible.

Thanks for the help!


Cassiano Leal
http://cassianoleal.com
http://twitter.com/cassianoleal

On July 22, 2013 at 15:46:01, Kevin Karwaski (kkarwaski@fiksu.com) wrote:

Also, do all the instances have a valid value for ‘ec2.local_ipv4’?
Are the security groups tuned correctly? Just thinking out loud…

On Mon, Jul 22, 2013 at 2:37 PM, Kevin Karwaski kkarwaski@fiksu.com wrote:

Hey Cassiano,

Take a look at this:

http://lists.opscode.com/sympa/arc/chef/2013-06/msg00354.html

http://lists.opscode.com/sympa/arc/chef/2013-06/msg00363.html

Andrew had a similar problem and it was related to the way VPCs handle
address assignment. Maybe this doesn’t apply to your particular
configuration but If you’re launching outside of US-EAST perhaps it’s
valid. Regardless, I hope it helps.

-K.

On Mon, Jul 22, 2013 at 2:27 PM, Cassiano Leal cassianoleal@gmail.com
wrote:

Hi Kevin,

Neither attributes are set, but they shouldn’t make any difference. Yes,
I’m
on EC2, inside a VPC (which is probably why both public attributes are
null).

I have

knife[:ssh_attribute] = 'ec2.local_ipv4’

on knife.rb so it uses that for connecting to the hosts.

I have tried setting it explicitly on the CLI as well:

$ knife ssh ‘chef_environment:production’ ‘uptime’ -a 'ec2.local_ipv4’

but no dice.


Cassiano Leal
http://cassianoleal.com
http://twitter.com/cassianoleal

On July 22, 2013 at 15:12:12, Kevin Karwaski (kkarwaski@fiksu.com) wrote:

knife search ‘chef_environment:production’ -a ec2.public_hostname


Kevin Karwaski
Manager, Cloud Operations @ {Fiksu}


Kevin Karwaski
Manager, Cloud Operations @ {Fiksu}


Kevin Karwaski
Manager, Cloud Operations @ {Fiksu}