Test kitchen using vagrant - ssh issue

Its been quite a while from test kitchen. I am trying to setup the test kitchen with vagrant and virtualbox. So, when i run kitchen create it fails at the point where it tries to ssh connect to the nodes.

UPDATED: my workstation: ubuntu 16.04

chef -v
Chef Development Kit Version: 0.18.30
chef-client version: 12.14.89
delivery version: master (d86679335580be3de22996ef294b20d525889d8d)
berks version: 5.1.0
kitchen version: 1.13.2

○ → vagrant --version
Vagrant 1.9.0

○ → vboxmanage --version
5.1.10r112026

the .kitchen.yml file


driver:
name: vagrant

provisioner:
name: chef_zero

verifier:
name: inspec

platforms:

  • name: centos-7.2

suites:

  • name: default
    run_list:
    • recipe[xxxxxxxt]
      attributes:

The kitchen create, produce this entries:

kitchen create
-----> Starting Kitchen (v1.13.2)
-----> Creating …
Bringing machine ‘default’ up with ‘virtualbox’ provider…
==> default: Checking if box ‘bento/centos-7.2’ is up to date…
==> default: Machine not provisioned because --no-provision is specified.
Waiting for SSH service on 127.0.0.1:2222, retrying in 3 seconds
Waiting for SSH service on 127.0.0.1:2222, retrying in 3 seconds
Waiting for SSH service on 127.0.0.1:2222, retrying in 3 seconds
Waiting for SSH service on 127.0.0.1:2222, retrying in 3 seconds
Waiting for SSH service on 127.0.0.1:2222, retrying in 3 seconds
Waiting for SSH service on 127.0.0.1:2222, retrying in 3 seconds


I know, i have set these up in the past. but i just cant recall to set up this ssh handshake for vagrant box. Is there a way where i can set the authorized_keys in the box via the kitchen,yml? so that i can use my private key?

=================================

update:

after inputs from IRC chat and with many trials, vagrant seems to work. As the below commands works:

  1. sudo vagrant init bento/centos-7.2
  2. vagrant up
  3. vagrant ssh

But things fails with the ‘test kitchen’

So, the below commands ‘kitchen create’ or ‘chef exec kitchen create’ fails at the point where it tries to ssh into the box.

I ran into a similar issue and it was something to do with the version of vagrant and virtualbox. I will check on Monday what versions I have running ok at work.

I remember that I once had issues with a specific version of Vagrant where the insecure key has been replaced incorrectly. Try to disable insert_key [1] and see if it works.

[1] http://ermaker.github.io/blog/2015/11/18/change-insecure-key-to-my-own-key-on-vagrant.html

The virtual machine may be off, but Test Kitchen thinks it is on still from
the last time it was on. Have you run a kitchen destroy before kitchen
create?

Not sure what was the issue, but i finally got it to work after a series of uninstall and re-install. Just for the records, below are the stuff versions that is working now:

chef -v
Chef Development Kit Version: 0.18.30
chef-client version: 12.14.89
delivery version: master (d86679335580be3de22996ef294b20d525889d8d)
berks version: 5.1.0
kitchen version: 1.13.2

vboxmanage --version
5.1.10r112026

vagrant --version
Vagrant 1.9.0

I don’t think it will be the issue but, this is also something that i had to fix. i.e. the chef ruby in the PATH. the chef ruby was not in the PATH. even after setting the shell init in the ~/.bash_profile. Its weird but my Ubuntu 16.04 workstation seem to source the ~/.bashrc and not the ~/.bash_profile file.

Using HP laptop? I had an issue using Vagrant with VirtualBox on HP machine. The root cause of the issue was that the PC system not enabled with VTx technology. To enable VTx option on HP laptop:

  1. Reboot the system and then hit “Esc” key
  2. Jump into “device configuration” to set device bios options
  3. Select “Advanced” tab
  4. Check the option on “Vitualization Technology(VTx)”, save it and exit
  5. Reboot the system