Ohai on a AWS VPC instance


#1

Ohai Chefs!

I’m seeing an issue with running a AWS instance in a VPC that has an Elastic IP
associated to it, the issue that I see is that I’m expecting node[cloud] and
node[cloud][public_ipv4] and its not there on the VPC instance.

Here is what I’m running on the VPC node:
ii chef 11.8.2-1.ubuntu.12.04
amd64 The full stack of chef
root@ip-10-0-16-121:~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 12.10
Release: 12.10
Codename: quantal

Quick output from a host in a VPC w/EIP and a non-VPC host w/EIP:

VPC host:
ohai | grep cloud
"label": “cloudimg-rootfs”
"/dev/disk/by-label/cloudimg-rootfs": {

Non-VPC:
ohai | grep cloud
"cloud": {
“label”: “cloudimg-rootfs”
"/dev/disk/by-label/cloudimg-rootfs": {

As you can see the non-VPC host has node[cloud] and the non-vpc host does not.
Here is a full output of ohai on the VPC host

https://gist.github.com/edwardvfluke/8527113

Any Ideas on why this is happening?

Thanks,
ev-


#2

Hi Edward,

Afaik that attribute is created if there is an ohai hint called ‘ec2.json’. The knife-ec2 plugin automatically sets this hint during bootstrap (if you use that bootstrap method). Is it possible that the VPC nodes were bootstrapped in a way that would have skipped this step?

The relevant codey bits…
Where knife-ec2 sets the hint:


Where the bootstrap process drops it on the node:
https://github.com/opscode/chef/blob/master/lib/chef/knife/bootstrap/chef-full.erb#L54

Hope this helps…

Eric

On Jan 20, 2014, at 2:39 PM, Edward edward@digitalnetz.net wrote:

Ohai Chefs!

I’m seeing an issue with running a AWS instance in a VPC that has an Elastic IP
associated to it, the issue that I see is that I’m expecting node[cloud] and
node[cloud][public_ipv4] and its not there on the VPC instance.

Here is what I’m running on the VPC node:
ii chef 11.8.2-1.ubuntu.12.04
amd64 The full stack of chef
root@ip-10-0-16-121:~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 12.10
Release: 12.10
Codename: quantal

Quick output from a host in a VPC w/EIP and a non-VPC host w/EIP:

VPC host:
ohai | grep cloud
"label": “cloudimg-rootfs”
"/dev/disk/by-label/cloudimg-rootfs": {

Non-VPC:
ohai | grep cloud
"cloud": {
“label”: “cloudimg-rootfs”
"/dev/disk/by-label/cloudimg-rootfs": {

As you can see the non-VPC host has node[cloud] and the non-vpc host does not.
Here is a full output of ohai on the VPC host

https://gist.github.com/edwardvfluke/8527113

Any Ideas on why this is happening?

Thanks,
ev-


#3

For further explanation, VPC mode in EC2 breaks ohai’s auto detection of EC2. Ohai’s hint system is a workaround for cases where we can not reliably auto detect some feature of the platform we’re on, so you need to create a hint file as referenced in the previous post to tell ohai to gather EC2 data.

HTH,


Daniel DeLeo

On Monday, January 20, 2014 at 11:45 AM, Eric Herot wrote:

Hi Edward,

Afaik that attribute is created if there is an ohai hint called ‘ec2.json’. The knife-ec2 plugin automatically sets this hint during bootstrap (if you use that bootstrap method). Is it possible that the VPC nodes were bootstrapped in a way that would have skipped this step?

The relevant codey bits…
Where knife-ec2 sets the hint:
https://github.com/opscode/knife-ec2/blob/3ac33a5938c30002d06b3e1279ff2a660ea02897/lib/chef/knife/ec2_server_create.rb#L528
Where the bootstrap process drops it on the node:
https://github.com/opscode/chef/blob/master/lib/chef/knife/bootstrap/chef-full.erb#L54

Hope this helps…

Eric

On Jan 20, 2014, at 2:39 PM, Edward <edward@digitalnetz.net (mailto:edward@digitalnetz.net)> wrote:

Ohai Chefs!

I’m seeing an issue with running a AWS instance in a VPC that has an Elastic IP
associated to it, the issue that I see is that I’m expecting node[cloud] and
node[cloud][public_ipv4] and its not there on the VPC instance.

Here is what I’m running on the VPC node:
ii chef 11.8.2-1.ubuntu.12.04
amd64 The full stack of chef
root@ip-10-0-16-121: (mailto:root@ip-10-0-16-121:)~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 12.10
Release: 12.10
Codename: quantal

Quick output from a host in a VPC w/EIP and a non-VPC host w/EIP:

VPC host:
ohai | grep cloud
"label": “cloudimg-rootfs”
"/dev/disk/by-label/cloudimg-rootfs": {

Non-VPC:
ohai | grep cloud
"cloud": {
“label”: “cloudimg-rootfs”
"/dev/disk/by-label/cloudimg-rootfs": {

As you can see the non-VPC host has node[cloud] and the non-vpc host does not.
Here is a full output of ohai on the VPC host

https://gist.github.com/edwardvfluke/8527113

Any Ideas on why this is happening?

Thanks,
ev-