2016-09-22 12:43:57 +00:00
|
|
|
---
|
|
|
|
title: About the sys_info Resource
|
|
|
|
---
|
|
|
|
|
|
|
|
# sys_info
|
|
|
|
|
|
|
|
Use the `sys_info` InSpec audit resource to test for operating system properties for the named host, and then returns that info as standard output.
|
|
|
|
|
2016-09-27 19:03:23 +00:00
|
|
|
## Syntax
|
2016-09-22 12:43:57 +00:00
|
|
|
|
|
|
|
An `sys_info` resource block declares the hostname to be tested:
|
|
|
|
|
|
|
|
describe sys_info do
|
|
|
|
its('hostname') { should eq 'value' }
|
|
|
|
end
|
|
|
|
|
2016-09-27 19:03:23 +00:00
|
|
|
## Matchers
|
2016-09-22 12:43:57 +00:00
|
|
|
|
|
|
|
This InSpec audit resource has the following matchers:
|
|
|
|
|
2016-09-27 19:03:23 +00:00
|
|
|
### be
|
2016-09-22 12:43:57 +00:00
|
|
|
|
|
|
|
<%= partial "/shared/matcher_be" %>
|
|
|
|
|
2016-09-27 19:03:23 +00:00
|
|
|
### cmp
|
2016-09-22 12:43:57 +00:00
|
|
|
|
|
|
|
<%= partial "/shared/matcher_cmp" %>
|
|
|
|
|
2016-09-27 19:03:23 +00:00
|
|
|
### eq
|
2016-09-22 12:43:57 +00:00
|
|
|
|
|
|
|
<%= partial "/shared/matcher_eq" %>
|
|
|
|
|
2016-09-27 19:03:23 +00:00
|
|
|
### hostname
|
2016-09-22 12:43:57 +00:00
|
|
|
|
|
|
|
The `hostname` matcher tests the host for which standard output is returned:
|
|
|
|
|
|
|
|
its('hostname') { should eq 'value' }
|
|
|
|
|
2016-09-27 19:03:23 +00:00
|
|
|
### include
|
2016-09-22 12:43:57 +00:00
|
|
|
|
|
|
|
<%= partial "/shared/matcher_include" %>
|
|
|
|
|
2016-09-27 19:03:23 +00:00
|
|
|
### match
|
2016-09-22 12:43:57 +00:00
|
|
|
|
|
|
|
<%= partial "/shared/matcher_match" %>
|
|
|
|
|
2016-09-27 19:03:23 +00:00
|
|
|
## Examples
|
2016-09-22 12:43:57 +00:00
|
|
|
|
|
|
|
The following examples show how to use this InSpec audit resource.
|
|
|
|
|
2016-09-27 19:03:23 +00:00
|
|
|
### Get system information for example.com
|
2016-09-22 12:43:57 +00:00
|
|
|
|
|
|
|
describe sys_info do
|
|
|
|
its('hostname') { should eq 'example.com' }
|
|
|
|
end
|