0

Somehow, ohai picked up the ipaddress of one of my LXC containers on a particular host instead of the ip address associated with the eth0 interface.

$ knife node show my-obscured-host -a ipaddress
my-obscured-host:
  ipaddress: 172.24.0.243

When I re-chef, ohai is run again, yet it still picks up the incorrect ipaddress.

However, if I run ohai as a standalone execution (i.e. not inside a chef-run), it picks up the correct eth0 address.

This does not make sense. Why do you think it is not changing the address?

Also, is there anyway I can change the ipaddress using knife (i.e. without using a recipe)?

Thanks-in-advance

1 Answers1

1

There is some planned work to make this more configurable, but for now if you know you want eth0, use the data in node['network']['interfaces']['eth0'] instead.

coderanger
  • 52,400
  • 4
  • 52
  • 75
  • Thanks @coderanger. Good idea. I take it, that there is really no other way to modify it on the chef server? The alternative does require a bit re-factoring of our code. –  Sep 16 '16 at 05:01
  • You would instead need a custom ohai plugin. We are doing [such thing](https://github.com/TYPO3-cookbooks/t3-openvz/blob/master/templates/default/ohai/openvz-ipaddress.rb) to fix `ipaddress` detection within OpenVZ. – StephenKing Sep 16 '16 at 05:13
  • The Server isn't involved at that point so yeah, you would need to fix it within Ohai or Chef. This in particular is a known source of frustration for many, and like I said there is a theoretical plan to fix it some day :( – coderanger Sep 16 '16 at 07:28