DEV Community

Cover image for Steampunk Spotter: Analyze Ansible Playbooks and Enhance Automation
XLAB Steampunk
XLAB Steampunk

Posted on • Updated on • Originally published at steampunk.si

Steampunk Spotter: Analyze Ansible Playbooks and Enhance Automation

Don’t you wish you had a little helper by your side to spot elusive errors when writing Ansible Playbooks? Or anticipate potential problems playbooks might cause when you run them? Well, now you do!

Steampunk Spotter is an assisted automation writing tool that analyzes and enhances your Ansible Playbooks to help you simplify and speed up your automation with improved playbooks that guarantee reliable execution.

Spotter analyzes your playbooks and provides recommendations to avoid undesirable results. It helps you understand what happens when you run the playbooks to identify potential issues before they are executed. All of this helps you create high-quality playbooks that ensure reliable automation execution, reduce development and testing time, and minimize security risks, downtime, and costs.

Image description

Features: What does Spotter check?

Spotter helps you check:

Best practices: Structure your playbooks for readability, collaboration and ease of use, and avoid common playbook anti-patterns.

Errors: Rely on the assistant that will guide you through hidden obstacles causing hard-to-catch and time-consuming errors.

Modules: Identify name changes and redirects, check for fully qualified names, and ensure you are using certified and approved modules.

Parameters: Make sure you are using correct parameters, considering their relationships, and quickly identify invalid configurations.

Use case: Easily upgrade to the latest Ansible version

The tool is particularly useful for simplifying the Ansible upgrade process. It’s important to keep your Ansible environment up to date, especially since Ansible updates in many cases include several security fixes that make your deployment more secure and reliable. But it can be quite a lot to keep up with the new features and perform the upgrade process.

With Spotter, you can check if your playbooks are compatible with the latest Ansible version, see the problems they might cause, and get advice on what to do to avoid downtime and ease your migrations between versions.

Who is Steampunk Spotter for?

Development, Quality Assurance and Operations teams will find Steampunk Spotter as an invaluable tool for assisted playbook writing, simplified Ansible upgrades, and achieving reliable, secure, and trustworthy automation.

Playbook Developers can use it to verify playbook templates or examples, check Ansible core and Collection versions compatibility, and understand the implications of Ansible upgrades.

Quality Assurance Managers can use it to understand what will happen when you run the playbook, run QA automations without errors, understand best practices and what-if scenarios for your tests.

Operations Managers can use it to identify potential vulnerabilities, receive quality reports and recommendations for improvements, and achieve reliable execution of automation.

How can you use Spotter?

With Spotter, you can currently scan your Ansible content via the Spotter CLI tool, via the Spotter app, or in GitHub, but we’re already working on supporting additional integrations to further simplify your work. So, for now, you can choose between these three scanning options:

  • you can scan local playbooks using the CLI tool,
  • you can scan public Git repositories with the Spotter app,
  • you scan playbooks directly in the CI/CD pipeline with GitHub and GitLab integrations or in the VS Code.

CLI

If you’re a tech-savvy playbook writer and develop your playbooks in the terminal, you most likely want to check their quality right on the spot, which you can do with the Spotter CLI tool. See how in this blog post.

The CLI tool also offers a welcome rewrite feature that allows you to apply suggested corrections automatically, saving you extra time and effort. To quickly apply fixes to your playbooks, run the optional - -rewrite/-r argument, which allows you to automatically rewrite your Ansible content with the suggested changes after scanning, if you choose to do so.

And the Spotter CLI tool also includes another great feature. You know when something goes wrong with your playbooks and you have to spend hours looking for the module documentation? Or you even have to open the module source code and read through the documentation? Well, if you use Spotter, you don’t have to do that anymore! The Spotter CLI tool provides a quick reference for the entire Ansible Galaxy. Whenever Spotter CLI spots something in your playbooks, it points you to the module documentation for the correct collection. This way, you can use the information from the documentation to solve the issues in Ansible modules much faster.

APP

If you want to check the quality of public Git repositories, you can do so with the Spotter app. We’ll talk about the benefits of using Spotter app below.

Integrations

Or you can use Spotter with your favorite CI/CD systems. And if you’re used to using GitLab or GitHub, you’ll be happy to hear that you can use Spotter CLI tool directly in your favorite CI/CD systems.

Spotter GitHub Action allows you to scan your Ansible content within GitHub’s CI/CD workflows. With GitLab integration, the Spotter CLI tool will output scan results compatible with GitLab’s unit test report. This means that GitLab CI/CD will display check results as green check marks for successful checks and red crosses for unsuccessful checks.

VS Code integration allows you to edit and run Ansible Playbooks directly from this highly popular code editor.

Spotter currently supports GitHub Actions, GitLab and VS Code integrations, but we’re working on supporting other integrations in the near future.

Learn more about how to scan different content in the quick start guide.

The Spotter app: Track progress & collaborate with your team

Whether you scan your content via CLI, the app, or in GitHub, you can track the results of all your scans in the Spotter app. The app provides an intuitive dashboard where you can keep up with your scan history, the frequency of failed playbook executions, and your progress over time.

The Spotter app also allows you to collaborate with your team by inviting users to become part of your organization, creating a shared workspace so you can all track progress on shared projects and work together across projects. And vice versa, others can invite you to become part of their organization, so you can be part of as many organizations as your heart desires. Don’t worry, we also offer the ability to decline invitations if things get out of hand 😉

Start Spotting!

Are you asking yourself, “Ok, but can this tool really help me write better playbooks?”. We know it sounds too good to be true, but yes, Spotter really does help improve the quality of your playbooks. You’ll find that you spend less time digging through documentation and guessing how to solve your specific problems, and you’ll notice that you need to run Ansible much less often, minimizing the number of failed attempts.

Still not convinced? Go ahead, try it out!

Image description

Top comments (0)