How to install plug-in for knife-ec2?

OSX, 10.9.2:

$ ruby -v ruby 2.0.0p247 (2013-06-27 revision 41674) [universal.x86_64-darwin13] $ knife -v Chef: 11.10.4 

When I run:

 $ knife ec2 server list 

I get:

 FATAL: Cannot find sub command for: 'ec2 server list' The ec2 commands were moved to plugins in Chef 0.10 You can install the plugin with `(sudo) gem install knife-ec2 

I have a stone installed:

 sudo gem install knife-ec2 

works without errors. And the gem list shows that it is installed:

 $ sudo gem list|grep knife-ec2 knife-ec2 (0.8.0) 

The stone seems to be installed correctly:

 ls /Library/Ruby/Gems/2.0.0/gems/knife-ec2-0.8.0/ ... 

/ usr / bin / knife first hand is excellent. Most likely, this is somehow connected with the fact that the knife is looking for plugins, but what to do with this is unclear.

+6
source share
4 answers

I had this or a similar problem when I installed chefdk after I already had an ec2 chef / knife / knife installed through gems (in an attempt to get the barkshuff tramp to work if you're interested).

What I discovered is that when you install chefdk, the built-in cook ruby ​​is used by the binary key of the knife in your path, not the ruby ​​of the system, so you need to install your gems on the built-in ruby ​​of the chef.

On OSX, I did it like this:

 /opt/chefdk/embedded/bin/gem install knife-ec2 

Edit: It looks like the chef team has done this already:

 chef gem install knife-ec2 
+8
source

What is the result of running gem install knife ? gem uses different paths when starting with sudo

You can run the knife with sudo:

 sudo knife ec2 server list 

Or set gem as the current user:

 gem install knife-ec2 

If the latter does not work, use RVM:

 \curl -sSL https://get.rvm.io | bash rvm install 2.0.0p247 gem install knife-ec2 
+3
source

You install things in your ruby ​​system (which is not recommended). You need to use sudo in front of your knife command in this case.

+1
source

Yes, it's complicated ... Reason: There are 2 GEM binaries in your system. One is "rubygems in / bin / gem" and the other is a chef in "/ opt / chef / embedded / bin / gem"

The knife uses a binary stone in a chef's setting.

Solution: Therefore, you should install the plugins as / opt / chef / embedded / bin / gem install the knife-ec2 / opt / chef / embedded / bin / gem install

Enjoy:) ...

0
source

All Articles