-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How do I use "ohai.primary_nic" with Chef's Kitchen CI? #7
Comments
looking at the kitchen-vagrant readme i think the solution is to use the |
@avishai-ish-shalom Did you get this working ? I have tried both ways vagrantfiles and vagrantfile_erb and neither has worked. Any insight would be appreciated. I inserted the lines in a local erb file. From the following
Kitchen created the following vagrant file:
Here is the config from the machine :
And the resulting ohai command.
I also tried the
With the contents of
Which give me the same result. The created Vagrant file is :
I am using : chef exec vagrant plugin list |
your config looks ok. can you ran in debug mode to see if the plugin is loading? |
Do you mean :
So I can become a little more self-sufficient - what am I looking for ? And I'm looking for the plugin loading pretty early in the run ? Right now - I'm not seeing anything obvious telling me the plugin is loaded (or any plugin). I'll redo a minimum cookbook and run it again. |
it seems test-kitchen will not run vagrant with the vagrant --debug flag. On Tue, Aug 25, 2015 at 11:08 PM alainchiasson [email protected]
|
Ok ... Here are some "parts" Plugins seem to be there
and loaded
2 Interfaces are being created on the VBox
Doing the DHCP discovery on eth1
and the installation of the OHAI plugins
After that chef is installed and nothing else. In /etc/chef/ohai_plugins, there are 2 files :
The following are the outputs:
Running ohai on debug :
Going through IRB on the node - and this is pretty new to me - I can't tell if it is loaded or not. Do attache the log file to this ? or does it go somewhere else? |
|
Yes - it is via DHCP - I cannot just pick IP's. I need a bridged interface so that I can get external access to this machine. My ultimate goal is to get the "bridge ip" registered with a DNS.
NOTE I rebooted the VM ...so the IP has changed:
|
This is really strange. As far as I can see it should work. I now suspect the |
I was reading through Customizing Chef (yeah - that new) and thought I would see inside :
Though I don't see differences. |
|
|
This has been a great help. Can you provide the output of |
I tried dragging it in ...
|
huh, ipaddress in the output of ohai is correct! can it be the problem is chef config file? are you using chef-client or chef-solo? can you check test-kitchen's chef config file on the instance? it's probably in /tmp |
Here is something different. :
Also this is not using kitchen but straight from Vagrant. I did a minimal environment for this ... here is the vagrant file (minus my org stuff) :
|
More stuff ... Tell me if this is useful - I'm playing with the paths. It's not what I though - I must say that I'm doing "stabs in the dark".
|
i suspect test-kitchen is using its own chef provisioning and is ignoring vagrant's chef config file. i think the easiest solution would be to add the |
So it seems to be a config issue: No results on the general run for the vagrant.rb file
But there is when we run with the -d defined.
|
Ok ... It seems to work now, but this is very much and environment issue - or where things get up loded : I added :
To the Vagrant file detailed above. Going back on the machine and running OHAI, still gave me the wrong result :
But the machine registers with Chef-server with the proper IP.
I can move forward a - but I will keep trying to find what's going on. |
I will also test my original .kitchen.yml files. |
So in using the .kithchen - either by the vagrant.erb method or the vagrant insert, nothing gets placed on the VM. /etc/chef/ohai_plugins contains only a README. The Vagrant file is correct - but it is not even loading the ohai plugin. |
yes, the plugin modifies vagrant's client.rb to add the ohai plugin path - but test kitchen uses its own separate version of client.rb over which the plugin has no control. As suggested above the fix would be to include the |
Let me start by thanking you for the help in trouble shootin ghtis. I am not ignoring you - just have not had the time to dig deeper. When running from vagrant using ohai::default The IP is properly pushed back to chef server - but ohai ipaddress still gives me the eth0 ip. Trying the same things from kitchen (just adding the recipe ohai::default to the runlist and nothing else) the oahi plugin is not even installed on the system (/etc/ohai/plugins contains only a README) I only had about 10 minutes to run the test, and have not had the time to come back to it. I'm hoping to have time this weekend to go much more in depth. |
Running The plugin is to be installed in I will try to run a test myself with test-kitchen but this is not likely to happen before tuesday. |
Still appears to be an issue.
|
@Spechal are you running with test-kitchen? |
No, just logging into the machine and running ohai ipaddress, although my test-kitchen would also fail due to an invalid IP and/or my load balancer tests would fail because it would add the wrong IPs into the pools. After poking around a bit, it looks like there isn't a good way to solve this and issues are closed saying it's a virtual box issue. |
For anyone running into this issue, I went with pulling In your kitchen suite: suites:
- name: mesos-master
driver:
pre_create_command: docker-compose up -d zookeeper || true
run_list:
- recipe[vagrant-ohai] # will pull the correct IP
- recipe[mesos::master] |
Hello!
How do I set up a primary nic which is not a private network, e.g. when using a bridge, using the primary_nic option when using Vagrant and Chef under Kitchen CI?
In other words, how best do I translate the Vagrantfile entry into the .kitchen.yml?
config.ohai.primary_nic = "eth1"
I've tried the following, neither of which work:
.kitchen.yml, under driver:
From .kitchen.yml, under suites:
The use case is a set of local VMs, each of which have an internal IP on the 10.x.x.x range, and a private_network (psuedo public IP) on the 33.x.x.x range. Ideally I'd like to pull attributes for both out of Ohai. I'd appreciate any insight on how best to go about doing that.
Regards,
Joe Reid
The text was updated successfully, but these errors were encountered: