inspec/docs/resources/mount.md.erb

84 lines
1.6 KiB
Text
Raw Normal View History

2016-09-22 12:43:57 +00:00
---
title: About the mount Resource
---
# mount
Use the `mount` InSpec audit resource to test the mount points on FreeBSD and Linux systems.
2016-09-22 12:43:57 +00:00
## Syntax
2016-09-22 12:43:57 +00:00
An `mount` resource block declares the synchronization settings that should be tested:
describe mount('path') do
it { should MATCHER 'value' }
end
where
* `('path')` is the path to the mounted directory
* `MATCHER` is a valid matcher for this resource
* `'value'` is the value to be tested
## Matchers
2016-09-22 12:43:57 +00:00
This InSpec audit resource has the following matchers:
### be
2016-09-22 12:43:57 +00:00
<%= partial "/shared/matcher_be" %>
### be_mounted
2016-09-22 12:43:57 +00:00
The `be_mounted` matcher tests if the file is accessible from the file system:
it { should be_mounted }
### cmp
2016-09-22 12:43:57 +00:00
<%= partial "/shared/matcher_cmp" %>
### device
2016-09-22 12:43:57 +00:00
The `device` matcher tests the device from the `fstab` table:
its('device') { should eq '/dev/mapper/VolGroup-lv_root' }
### eq
2016-09-22 12:43:57 +00:00
<%= partial "/shared/matcher_eq" %>
### include
2016-09-22 12:43:57 +00:00
<%= partial "/shared/matcher_include" %>
### match
2016-09-22 12:43:57 +00:00
<%= partial "/shared/matcher_match" %>
### options
2016-09-22 12:43:57 +00:00
The `options` matcher tests the mount options for the file system from the `fstab` table:
its('options') { should eq ['rw', 'mode=620'] }
### type
2016-09-22 12:43:57 +00:00
The `type` matcher tests the file system type:
its('type') { should eq 'ext4' }
## Examples
2016-09-22 12:43:57 +00:00
The following examples show how to use this InSpec audit resource.
### Test a the mount point on '/'
2016-09-22 12:43:57 +00:00
describe mount('/') do
it { should be_mounted }
its('device') { should eq '/dev/mapper/VolGroup-lv_root' }
its('type') { should eq 'ext4' }
its('options') { should eq ['rw', 'mode=620'] }
end