How can you tell if a chef is working in a virtual machine (i.e. the Vagrant)

I have a chef recipe that can run on virtual machines or on real machines. I need to understand the difference between the chefs, because I need to treat them differently. I found something on the Internet that said I should just use

if node[:instance_role] == 'vagrant'

but that doesn't seem to work for me. node [: instance_role] is just empty.

Do you know any other way to do this?

I am using chef_solo with a setting for strollers

+4
source share
1 answer

node['virtualization'] VM. Vagrant VM, . , Vagrant, node Vagrantfile .

+5

All Articles