How to use Steampunk Spotter CLI to audit your playbook

29. september 2022 - Avtor The Spotter team

29. september 2022
Avtor The Spotter team

This post was originally published on the XLAB Steampunk blog.

Steampunk Spotter helps you to simplify and accelerate your automation with improved playbooks that guarantee reliable execution. In this blog post, we’ll show you how to start scanning your playbooks for free with our CLI.

If you have no idea what Steampunk Spotter is, you can find out more about the tool in Dealing with Ansible upgrades in an intelligent way and Say hello to Steampunk Spotter!

Read on to learn how to get started with Steampunk Spotter CLI.

Step 1: Install Steampunk Spotter

To use Steampunk Spotter CLI, you first need to register here. You’ll be asked for your username and password the first time you run the scan command.

Afterward, simply install the Steampunk Spotter CLI tool (this will require you to have Python 3 installed) and then run the following command:

$ spotter scan /path/to/your/playbooks

Step 2: Authentication

Before running your first scan, you’ll need a Steampunk Spotter user account. With registration, we avoid unauthenticated requests and reduce malicious load on the API, while still making it as accessible as possible.

To log in, provide your username and password:

  • via --username/-u and --password/-p global optional arguments;
  • by setting SPOTTER_USERNAME and SPOTTER_PASSWORD environment variables.

After that, you can start scanning!

If you don’t have a username or password, create your account here.

After the CLI is installed, you can explore its commands and options by running spotter --help.

Step 3: Playbook scanning

The CLI Spotter scan command is used to scan Ansible content (task files, playbooks, roles and collections) and return the scan results.

The scan command will automatically detect the type of Ansible content and scan it.

Playbook scanning example

Playbook scanning example

To explore all Spotter’s commands and options, run spotter --help or take a look at the README.md.

Step 4: Automatically update your playbook

Spotter not only analyzes your playbooks and provides recommendations, it also allows you to automatically apply proposed fixes, saving you both time and hassle.

To quickly apply fixes to your playbooks, run the optional --rewrite/-r argument. This gives you the ability to automatically rewrite your Ansible content with suggested changes after scanning.

Example: Let’s scan a playbook together

In this example, we’re going to check if our existing playbooks are compatible with the latest Ansible version. We’ll also get recommendations on what can be improved to result in a reliable playbook.

Upgrade your playbook scanning experience with our Spotter App

CLI isn’t the only option for scanning your playbooks! By creating a Steampunk Spotter account, you’ll be able to scan playbooks within the GitHub CI/CD workflows or use our visual Spotter App. Try it out today - register here.


Družbena omrežja

Ostanite v stiku z nami.