DEV Community

Cover image for How Deutsche Telekom MMS optimizes Ansible Playbooks with Steampunk Spotter
XLAB Steampunk
XLAB Steampunk

Posted on • Originally published at steampunk.si

How Deutsche Telekom MMS optimizes Ansible Playbooks with Steampunk Spotter

Managing Ansible code quality across multiple teams and projects can be challenging. We talked to Andreas Hering, System Engineer at Deutsche Telekom MMS that shared how he and his team handle the complexities of managing diverse Ansible environments with the help of Steampunk Spotter. They not only achieved significant time saving with the Spotter’s rewrite feature, but also experienced 2-4x speedup in Ansible Playbooks improvement, upgrades and maintenance compared to manual methods.

In this blog post, we’ll delve deeper into Deutsche Telekom MMS’s goals, implementation process, results achieved so far, and valuable lessons learned along the way.

Challenges of managing multiple Ansible versions

At Deutsche Telekom MMS, many teams used Ansible to automate customers’ flows, which means that different teams used various different versions of Ansible. Even though they had tools like Ansible Lint and Renovate to check their code and update Ansible, it became hard to keep their code clean and avoid duplication of roles and collections.

Where they wanted to go

“Ideally we wanted to update and upgrade all our Ansible code across all projects to the latest version,” explains Andreas.

However, with multiple customers and repositories managed by different team members, updating the code became a significant challenge.

Their goals were multi-fold:

  • enhance code quality so it is easily understandable by all colleagues in the team,
  • improve security by discouraging specific modules,
  • align with industry best practices,
  • enhance the quality of their open-source projects.

Setting up Steampunk Spotter

At Deutsche Telekom, they successfully integrated Steampunk Spotter just over 4 months ago. “When we first tested Spotter out on our code, we realized we had quite a bit of work ahead of us. For example, in one project, the average number of errors per scan and the total number of **detected errors were very high, even though we already had some mechanisms like linting in place,” says Andreas.

Image description

Initially, they needed to set up an efficient workflow. Since the team primarily uses VS Code, they decided to create a workflow using the Spotter extension for VS Code. Given their multiple customers, they wanted to distinguish the errors and track the progress of each codebase. To achieve this, they created multiple projects in Spotter. “We created a configuration file with a project ID for each customer’s project. This setup worked excellently with Spotter, as it automatically searches for the config file and uses the project ID to perform scans.”

However, they also needed a solution for a command-line interface (CLI). They developed a script that facilitates scanning from the CLI by simply typing spots followed by the path to scan, along with any additional parameters normally used with Spotter. The script requires the Spotter token and endpoint, which are exported as usual. The team set an alias for spots and defined variables to extract the project ID from the VS Code config file in the repository. If no project ID is found, an error is thrown; otherwise, a Spotter scan is performed with the specified parameters.

This script is designed to be used in a bash environment, such as Linux or Windows Subsystem for Linux (WSL). “We didn’t create a version for PowerShell or Windows command line, but users are welcome to adapt it.” In Linux, you can add it to your .bashrc file to source it at login, allowing you to use the function automatically.

Image description

Optimizing code with Spotter’s powerful features

With the help of Spotter, the Deutsche Telekom MMS team achieved significant progress in a short period. They elevated their playbooks to modern standards, fine-tuned sections of the code that were previously neglected due to the lack of time and incorporated multiple best practices across more than 10 projects.

Andreas and the team tackled common errors, such as missing fully qualified names (FQCNs) and requirement files. Spotter also identified deprecated code usage and suggested areas where implementing loops could enhance efficiency. Additionally, they optimized the use of Ansible’s copy and template modules by explicitly setting modes, a frequently encountered issue. Their efforts extended beyond internal projects – they made substantial contributions to the open-source Nomad console with a large merge request facilitated by Spotter. They also used Spotter to improve their internal open-source projects.

The Deutsche Telekom MMS team was especially satisfied with the Spotter’s rewriting feature, which they used extensively, especially in the beginning. This feature helped them easily increase code quality, significantly reducing the workload and saving a lot of time. “The total number of rewrites at the beginning was quite high, but I think this is a good sign because it is automatically done by Spotter. We managed to lower the total number of detected errors in the end. This is a valuable feature for us, and it saved us a lot of time,” explains Andreas.

Image description

Furthermore, Spotter fosters continuous code improvement. By scanning new code, it aligns it with the latest best practices, ensuring your codebase constantly evolves.

Throughout their journey, our team provided ongoing support and made every effort to ensure a seamless and enjoyable user experience. “Working with you guys was good. We requested one or two features and created bug reports, which you fixed quite fast. You were always open to help,” explains Andreas.

Spotter: Enhancing code quality and reducing stress for developers

Andreas highlighted that Spotter significantly enhances the quality of Ansible Playbooks, even when existing mechanisms are in place. Its rewriting feature saves a considerable amount of time, being 2-4 times faster than manual efforts. Spotter simplifies upgrades by checking for deprecations and offering guidance on necessary changes. It helps developers write state-of-the-art code, and although the ROI is not directly trackable, it has notably reduced stress for engineers and allowed them to focus on more enjoyable tasks 😉

“Spotter shines when it comes to writing new playbooks, following best practices and fixing errors in existing playbooks automatically. That’s a great feature and I would definitely recommend Spotter!” concludes Andreas.

Take your Ansible automation to the next level

If you want to get more details and information about Deutsche Telekom MMS’s experience, you can check out our free on-demand webinar: Optimizing Ansible Playbooks with Steampunk Spotter: Deutsche Telekom MMS’s Blueprint for Effective Automation.

And if you want to see how Spotter can optimize YOUR automation workflows, we’d be more than happy to schedule a personalized demo tailored to your specific needs. Book a demo.

You can also try Spotter in your own infrastructure, without risk. Book your test now and experience premium features, dedicated support, and comprehensive report, highlighting time and cost savings for your enterprise – all for free.

Top comments (0)