2015-12-14 13:23:41 +00:00
|
|
|
# Example InSpec Profile
|
|
|
|
|
2016-10-20 16:42:15 +00:00
|
|
|
This example shows the implementation of an InSpec [profile](../../docs/profiles.md).
|
2015-12-14 13:23:41 +00:00
|
|
|
|
|
|
|
## Verify a profile
|
|
|
|
|
|
|
|
InSpec ships with built-in features to verify a profile structure.
|
|
|
|
|
|
|
|
```bash
|
|
|
|
$ inspec check examples/profile
|
2016-03-24 19:19:14 +00:00
|
|
|
Summary
|
|
|
|
-------
|
|
|
|
Location: examples/profile
|
|
|
|
Profile: profile
|
2016-04-04 12:48:42 +00:00
|
|
|
Controls: 4
|
2016-03-24 19:19:14 +00:00
|
|
|
Timestamp: 2016-03-24T16:20:21+00:00
|
|
|
|
Valid: true
|
|
|
|
|
|
|
|
Errors
|
|
|
|
------
|
|
|
|
|
|
|
|
Warnings
|
|
|
|
--------
|
2015-12-14 13:23:41 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
## Execute a profile
|
|
|
|
|
2016-03-24 19:19:14 +00:00
|
|
|
To run all **supported** controls on a local machine use `inspec exec /path/to/profile`.
|
2015-12-14 13:23:41 +00:00
|
|
|
|
|
|
|
```bash
|
|
|
|
$ inspec exec examples/profile
|
|
|
|
..
|
|
|
|
|
|
|
|
Finished in 0.0025 seconds (files took 0.12449 seconds to load)
|
2016-04-04 12:48:42 +00:00
|
|
|
8 examples, 0 failures
|
2016-03-24 19:19:14 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
## Execute a specific control from a profile
|
|
|
|
|
|
|
|
To run one control from the profile use `inspec exec /path/to/profile --controls name`.
|
2015-12-14 13:23:41 +00:00
|
|
|
|
2016-03-24 19:19:14 +00:00
|
|
|
```bash
|
|
|
|
$ inspec exec examples/profile --controls tmp-1.0
|
|
|
|
.
|
|
|
|
|
|
|
|
Finished in 0.0025 seconds (files took 0.12449 seconds to load)
|
|
|
|
1 examples, 0 failures
|
2015-12-14 13:23:41 +00:00
|
|
|
```
|