Install Spotter CLI

With the almighty Spotter CLI tool, you’ll be able to shape up your Ansible Playbooks in no time. See DEMO or read blog to learn more about all the things you can do with CLI and discover its full potential.

  > spotter scan --profile full playbook.yml  
    playbook.yml:6:7: ERROR: [E903] Use a fully-qualified name, such as ansible.builtin.command instead of command.   
    playbook.yml:6:7: WARNING: [W1800] Default value for warn parameter changed between module  
    versions 2.10.17 and 2.11.0 from true to false. Consider setting value of the parameter  
    explicitly.   
    playbook.yml:10:7: HINT: [H1900] Required collection a10.acos_axapi is missing from   
    requirements.yml or requirements.yml is missing.   
    playbook.yml:10:7: HINT: [H200] Module a10.acos_axapi.a10_aam_aaa_policy is not certified. View   
    docs at   
    https://docs.steampunk.si/plugins/a10/acos_axapi/6.0.1.post71123/module/a10_aam_aaa_policy.  
    html.   
    playbook.yml:18:7: ERROR: [E2700] Argument "==" should not be used in tests. It appears in the   
    following location: ansible.builtin.iptables.jump.   
    playbook.yml:23:7: ERROR: [E006] Required parameter instance.host was not set in module   
    servicenow.itsm.change_request. Environment fallback was unsuccessful as variable SN_HOST is   
    not set. If you decide to set the environment variable remember to do it on other configuration  
    systems too. Another way is to set the parameter in task directly. View docs at   
    https://docs.steampunk.si/plugins/servicenow/itsm/2.2.0/module/change_request.html.   
    playbook.yml:23:7: HINT: [H1900] Required collection servicenow.itsm is missing from   
    requirements.yml or requirements.yml is missing.   
    ------------------------------------------------------------------------   
    Spotter took 0.597 s to scan your input.   
    It resulted in 3 error(s), 1 warning(s) and 3 hint(s).   
    Overall status: ERROR   
    >


Spotter CLI is easy to use and install. It’s available as a steampunk-spotter Python package, but you will need at least Python 3 to install it.

$ pip install steampunk-spotter Copied!

Once you’ve got the CLI up and running, you can easily check out its commands and optional arguments. Just type in spotter –help to see all the info you need. And remember, you can use --help or –h with any command too. Just type in spotter –help/-h < your command>.



Authenticate

When you use CLI, you’ll need to provide your Steampunk Spotter credentials in one of two ways:

1. Your username and password:

$ spotter --username <username> --password <password> scan playbook.yml Copied!

2. API token:

To create and manage tokens, visit the Steampunk Spotter app , open the top-right account menu, click My Settings and switch to the API tokens tab. See how .

$ spotter --token <api-token> scan playbook.yml Copied!

Hint

To avoid inserting your credentials every time you use Spotter CLI, use spotter login command and your credentials will be saved in your profile until you log out.

$ spotter --token <api-token> login Copied!

If you want to log out of your Spotter user account right from the CLI, you can simply use the spotter logout command. This will handle getting rid of the authentication tokens for the Spotter API that you’re currently using. These tokens are usually stored in a folder called ~/.config/steampunk-spotter.

And that’s it, you’re good to start scanning!