I am new to Serverspec testing tool.
When running test, I got the following error.
[root@ost-svr004 serverspec]# rake spec
/usr/bin/ruby -I/usr/lib/ruby/gems/2.1.0/gems/rspec-support-3.1.2/lib:/usr/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.7/lib /usr/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.7/exe/rspec --pattern spec/www.example.jp/\*_spec.rb
/usr/lib/ruby/gems/2.1.0/gems/net-ssh-2.9.1/lib/net/ssh/transport/session.rb:70:in `initialize': getaddrinfo: Name or service not known (SocketError)
from /usr/lib/ruby/gems/2.1.0/gems/net-ssh-2.9.1/lib/net/ssh/transport/session.rb:70:in `open'
from /usr/lib/ruby/gems/2.1.0/gems/net-ssh-2.9.1/lib/net/ssh/transport/session.rb:70:in `block in initialize'
from /usr/lib/ruby/2.1.0/timeout.rb:76:in `timeout'
from /usr/lib/ruby/2.1.0/timeout.rb:127:in `timeout'
from /usr/lib/ruby/gems/2.1.0/gems/net-ssh-2.9.1/lib/net/ssh/transport/session.rb:67:in `initialize'
from /usr/lib/ruby/gems/2.1.0/gems/net-ssh-2.9.1/lib/net/ssh.rb:202:in `new'
from /usr/lib/ruby/gems/2.1.0/gems/net-ssh-2.9.1/lib/net/ssh.rb:202:in `start'
.....
/usr/bin/ruby -I/usr/lib/ruby/gems/2.1.0/gems/rspec-support-3.1.2/lib:/usr/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.7/lib /usr/lib/ruby/gems/2.1.0/gems/rspec-core-3.1.7/exe/rspec --pattern spec/www.example.jp/\*_spec.rb failed
During the Serverspec installation, I followed the instructions from http://serverspec.org/. As the prerequisite, I also installed the "Developer Tools", Ruby and RubyGem.
In fact, when running the serverspec test for localhost Exec (local)
, it is okay and there is no problem occurred. But when running test for remote hosts, it is failed and this problem is occurred.
Finally , I got the solution from this link.
http://www.firedaemon.com/blog/passwordless-root-ssh-public-key-authentication-on-centos-6
I created SSH RSA key on the client machine (ie. the one you are SSH'ing from) and copy it to remote host.
.