visit
We automate tasks to simplify our work, but if the instructions for automation aren't well written, we haven't really accomplished much. That's where Steampunk Spotter comes in, an Ansible Playbook scanning tool that lets us effortlessly create, maintain, and update playbooks.
Spotter analyzes playbooks and makes recommendations for improvements that help us reduce risks, save time, and achieve reliable automation. This tool identifies issues, automatically fixes specific ones, makes recommendations for playbook improvements to avoid undesirable results, and helps usto follow automation and security best practices.
Note: I am part of the Steampunk Spotter team, here to share advice on how to make your Ansible Playbooks do what you want them to do.
Install the steampunk-spotter CLI tool as a
pip install steampunk-spotter
spotter --help
API token (you can generate it in Spotter app user settings)
To get your token, use --api-token/-t global or set the SPOTTER_API_TOKEN environment variable.
Username and password
To input your username and password, use the arguments*--username/-u* and --password/-p, or alternatively, set the environment variables SPOTTER_USERNAME and SPOTTER_PASSWORD.
Spotter identifies invalid configurations, module and collection name changes and redirects, missing collection requirements, checks for fully qualified collection names or if certified collections and correct module parameters are used, etc. To initialize the scan with Spotter, type spotter scan path/to/file.
spotter scan playbook.yml
Spotter offers several scanning profiles. Whether you want to upgrade your Ansible environment to a newer version of Ansible or improve the playbooks for a current version, the scan profiles ensure that the scan results meet your requirements.
Spotter currently supports the following profiles:
Default profile: suitable for daily testing and improvement of Ansible Playbooks. It includes best practices, validation, and basic security checks but excludes upgrade and advanced security checks.
Full profile: displays the full range of check results included in the default profile and also includes upgrade and extended security checks.
Security profile: focuses on checking for potential security issues.
To specify a scan profile, use --profile optional argument (- -profile full, --profile security).
So make sure to add suitable arguments to your commands to make your scanning experience optimal. Or, to be safe, use Spotter with all its power, and run:
spotter scan --profile full playbook.yaml
spotter scan --rewrite playbook.yaml
You can add your own checks to Spotter. This tool allows you to define playbooks' standards, permitted modules and collections, naming conventions, and constraints on values for different modules and entities. All you need to do is use the set-policies command and define the folder or file with the policies ().
Spotter checks if playbooks are compatible with a specific Ansible version and pinpoints issues that need to be fixed. To see if your playbook is compatible with a specific Ansible version, use --ansible-version switch and add the version you want Spotter to scan against ().
spotter scan --ansible-version 2.15 playbook.yaml
and add --profile full switch that will make sure Spotter executes upgrades-related checks.