Sha256: 8a7a955ac5e23837e524c1d1389e49c55f1198d992bd5e234d31f8ce7ebf5cc2

Contents?: true

Size: 1.23 KB

Versions: 42

Compression:

Stored size: 1.23 KB

Contents

---
title: About the virtualization Resource
platform: linux
---

# virtualization

Use the `virtualization` InSpec audit resource to test the virtualization platform on which the system is running.

<br>

## Syntax

An `virtualization` resource block declares the virtualization platform that should be tested:

    describe virtualization do
      its('system') { should MATCHER 'value' }
    end

where

* `('system')` is the name of the system information of the virtualization platform (e.g. docker, lxc, vbox, kvm, etc)
* `MATCHER` is a valid matcher for this resource
* `'value'` is the value to be tested

<br>

## Examples

The following examples show how to use this InSpec audit resource.

### Test for Docker

    describe virtualization do
      its('system') { should eq 'docker' }
    end

### Test for VirtualBox

    describe virtualization do
      its('system') { should eq 'vbox' }
      its('role') { should eq 'guest' }
    end

### Detect the virtualization platform

    if virtualization.system == 'vbox'
      describe package('name') do
        it { should be_installed }
      end
    end

<br>

## Matchers

For a full list of available matchers, please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).

Version data entries

42 entries across 42 versions & 2 rubygems

Version Path
inspec-2.0.45 docs/resources/virtualization.md.erb
inspec-2.0.16 docs/resources/virtualization.md.erb