azurechef-infrabootstrappingohai-gem

Chef bootstrapping on Azure doesn't populate the cloud_v2 attribute


Running Chef's knife bootstrap command successfully populates the cloud_v2 attribute via Ohai when I bootstrap VMs created on Google Cloud and Rackspace, but on Azure VMs bootstraping via knife leaves the cloud_v2 hash very empty -- it only gets populated with one attribute: provder: azure.

In contrast, Ohai successfully populates Google Cloud and Rackspace nodes with something that looks like:

cloud_v2: public_ipv4_addrs 0: xxx.xxx.xxx.85 local_ipv4_addrs 0: 10.240.0.2 provider: gce local_hostname: myhostname.projectname.internal public_ipv4: xxx.xxx.xxx.85 local_ipv4: 10.240.0.2

Is this a bug in Azure's Ohai plugin? How can I get the Knife bootstrap command to include more of the default Ohai attributes? Most specifically I need the public_ipv4 so I can use this attribute to run the knife ssh commands.


Solution

  • Ohai only supports limited auto-detection of Azure. If you touch the hint file (mydir -p /etc/chef/ohai/hints && touch /etc/chef/ohai/hints/azure.json) it should see things better. This is generally handled for you automatically if you use the relevant knife-$cloud plugin but with plain knife bootstrap you need to do it either via the --hint option or manually as above.