Physical vs. VMware guests in recipe


#1

We’re not about to differentiate physical nodes from VMs as role
definitions, so my logic has gone into a recipe that runs everywhere,
but does nothing on physical hosts.

Is the following a sane way to do that? It’s working, but
that doesn’t mean it’s the ideal method.

recipes/default.rb

return if node[‘virtualization’].nil?
return if node[‘virtualization’][‘system’] != 'vmware’
return if node[‘virtualization’][‘role’] != ‘guest’

actual code here for VMs that are guests…


#2

I did this in the past with a small helper methods in a library.
That wraps the same logic but can be a bit easier to follow in your
recipes.


xen specific but easy to update to your needs.

On Thu, Mar 21, 2013 at 12:51 PM, Jeff Blaine jblaine@kickflop.net wrote:

We’re not about to differentiate physical nodes from VMs as role
definitions, so my logic has gone into a recipe that runs everywhere,
but does nothing on physical hosts.

Is the following a sane way to do that? It’s working, but
that doesn’t mean it’s the ideal method.

recipes/default.rb

return if node[‘virtualization’].nil?
return if node[‘virtualization’][’**system’] != 'vmware’
return if node[‘virtualization’][‘role’] != ‘guest’

actual code here for VMs that are guests…