All Spotter Commands
Using Spotter is simple. You just need to know a few simple commands to make your Ansible Playbooks spotless. And don’t worry, you can look them up anytime by running s --help in Spotter CLI. Dive in!
To scan
$ spotter scan playbook.ymlCopied! | Perform a simple default scan. |
$ spotter scan path/to/playbookCopied! | Scan a playbook. |
$ spotter scan path/to/taskfile1.yamlCopied! | Scan a taskfile. |
$ spotter scan path/to/roleCopied! | Scan a role. |
$ spotter scan path/to/collectionCopied! | Scan an Ansible Collection. |
$ spotter scan path/to/folderCopied! | Scan any folder that contains Ansible content. |
$ spotter scan path/to/playbook1.yaml path/to/playbook2.yamlCopied! | Scan two playbooks. |
$ spotter scan path/to/role1 path/to/role2Copied! | Scan two roles. |
$ spotter scan path/to/playbook1.yaml path/to/playbook2.yamlCopied! | Scan multiple playbooks at once. |
$ spotter scan path/to/taskfile.yaml path/to/playbook.yaml path/to/role path/to/collectionCopied! | Scan multiple files at once. |
$ spotter scan path/to/playbook/folder/play_*.yamlCopied! | Scan multiple playbooks using glob. |
spotter scan playbook.yml
Copied!spotter scan path/to/playbook
Copied!spotter scan path/to/taskfile1.yaml st
Copied!spotter scan path/to/role
Copied!spotter scan path/to/collection
Copied!spotter scan path/to/folder
Copied!spotter scan path/to/playbook1.yaml path/to/playbook2.yaml
Copied!spotter scan path/to/role1 path/to/role2
Copied!spotter scan path/to/playbook1.yaml path/to/playbook2.yaml
Copied!spotter scan path/to/taskfile.yaml path/to/playbook.yaml path/to/role path/to/collection
Copied!spotter scan path/to/playbook/folder/play_*.yaml
Copied!To set scanning profile
$ spotter scan --profile full playbook.ymlCopied! | Set scanning profile to Full to get the full range of check results Spotter offers. |
$ spotter scan --profile security playbook.ymlCopied! | Set scanning profile to Security to execute only security checks. |
spotter scan --profile full playbook.yml
Copied!spotter scan --profile security playbook.yml
Copied!To set target project
$ spotter scan --project-id <project-id>Copied! | Set project you wish to see your scan results in. |
spotter scan --project-id <project-id>
Copied!To skip or enforce checks
$ spotter config set org-config.jsonCopied! | Set basic rules and apply checks across the whole organization by uploading config file including which checks to always enforce and which to skip. |
$ spotter config clearCopied! | Clear current configuration at organization level. |
$ spotter config getCopied! | See the current configuration settings for a specific organization. |
$ spotter scan --skip-checks E1300,E1301,H1302 playbook.ymlCopied! | Skip specific checks at scan level. |
$ spotter scan --enforce-checks W1100,E1101 playbook.ymlCopied! | Enforce specific checks at scan level. |
$ spotter scan --skip-checks H1900[fqcn=sensu.sensu_go.user],W003 playbook.ymlCopied! | Skip or enforce checks for specific Fully Qualified Class Names (FQCNs) or individual check subcodes. |
spotter config set org-config.json
Copied!spotter config clear
Copied!spotter config get
Copied!spotter scan --skip-checks E1300,E1301,H1302 playbook.yml
Copied!spotter scan --enforce-checks W1100,E1101 playbook.yml
Copied!spotter scan --skip-checks H1900[fqcn=sensu.sensu_go.user],W003 playbook.yml
Copied!To automatically fix issues
$ spotter scan --rewrite playbook.ymlCopied! | Automatically fix the issues that Spotter has found. |
spotter scan --rewrite playbook.yml
Copied!To include custom policies
$ spotter policies set policy.regoCopied! | Include a single custom policy (check). |
$ spotter policies set PoliciesCopied! | Include a directory of custom policies (checks). |
$ spotter policies set --project-id <project-id> policy.regoCopied! | Set policy for the whole organization. |
$ spotter policies clearCopied! | Clear policies. |
spotter policies set policy.rego
Copied!spotter policies set Policies
Copied!spotter policies set --project-id policy.rego
Copied!spotter policies clear
Copied!To upgrade playbooks
$ spotter scan --profile full --ansible-version 2.15 playbook.ymlCopied! | Check if your playbook is compatible with a specific Ansible version. |
spotter scan --profile full --ansible-version 2.15 playbook.yml
Copied!To customize scanning
$ spotter scan --display-level error playbook.ymlCopied! | Show only ERRORS without hints and warnings in your scan result. |
$ spotter scan --display-level hint playbook.ymlCopied! | Show only HINTS in your scan result. |
$ spotter scan --display-level warning playbook.ymlCopied! | Show only WARRNINGS in your scan result. |
$ spotter scan --format json playbook.yamlCopied! | Change the format of scan results. |
$ spotter scan --no-docs-url playbook.ymlCopied! | Omit links to documentation in scan results. |
$ spotter --no-color scan playbook.ymlCopied! | Disable colorized output. |
$ spotter --storage-path /my/project/.storage scan playbook.ymlCopied! | Set storage folder. |
$ spotter --endpoint “<spotter-api-url>” scan playbook.ymlCopied! | Specify the API endpoint. |
$ spotter scan --sarif report.sarif playbook.yml Copied! | This command facilitates integration with platforms supporting the SARIF format. |
spotter scan --display-level error playbook.yml
Copied!spotter scan --display-level hint playbook.yml
Copied!spotter scan --display-level warning playbook.yml
Copied!spotter scan --format json playbook.yaml
Copied!spotter scan --no-docs-url playbook.yml
Copied!spotter --no-color scan playbook.yml
Copied!spotter --storage-path /my/project/.storage scan playbook.yml
Copied!spotter --endpoint "<spotter-api-url>" scan playbook.yml
Copied!To control data being shared
$ spotter scan --exclude-values playbook.ymlCopied! | Exclude values (task names, parameter values, and filenames) from your scan. |
$ spotter scan --exclude-metadata playbook.ymlCopied! | Exclude metadata (file names, line numbers, and column numbers) from your scan. |
$ spotter scan --export-payload payload.json playbook.ymlCopied! | See which data is collected from your Ansible content without actually running a scan. |
$ spotter scan --import-payload payload.jsonCopied! | Import the list of data being shared with Spotter. |
spotter scan --exclude-values playbook.yml
Copied!spotter scan --exclude-metadata playbook.yml
Copied!spotter scan --export-payload payload.json playbook.yml
Copied!spotter scan --import-payload payload.json
Copied!