ansible-fix

Automate ansible-lint fixes in role YAML files using regex-based Python transformations.

Updated Nov 12, 2025
One-click install
npx skills add https://github.com/jphetphoumy/skillstack --skill ansible-fix
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ansible-fix
Source: https://github.com/jphetphoumy/skillstack/tree/main/skills/ansible-fix
Command: npx skills add https://github.com/jphetphoumy/skillstack --skill ansible-fix

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill automatically fixes common, easily automated Ansible-lint issues to help keep roles clean and compliant.

Core Features & Use Cases

  • yaml[comments]: Add space after # in comments.
  • schema[meta]: Quote numeric version strings.
  • meta-incorrect: Replace placeholder metadata with sensible defaults.
  • name[play]: Add names to unnamed plays.
  • role-name[path]: Fix role import paths.

Quick Start

After creating a new role with ansible-galaxy init, the fixer runs automatically to clean up lint issues. Review changes and run ansible-lint to verify.

Frequently Asked Questions about ansible-fix

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I automatically fix ansible-lint violations in my Ansible roles?

Ansible-lint violations can be automatically fixed using a Python-based fixer that handles common issues like missing comment spacing, unquoted numeric versions, unnamed plays, and incorrect role import paths. The fixer runs automatically after ansible-galaxy init or on explicit request, updating YAML files in place while remaining idempotent.

What ansible-lint issues can be automatically corrected?

The fixer handles five common ansible-lint violations: yaml[comments] (add space after #), schema[meta] (quote numeric versions), meta-incorrect (replace placeholder metadata), name[play] (add names to unnamed plays), and role-name[path] (fix role import paths). Each violation type is resolved through regex-based transforms on role YAML files.

Can I use this fixer on existing Ansible roles or only new ones?

The fixer applies to both new roles created with ansible-galaxy init and existing roles on explicit request. You can run it anytime to clean up lint violations in your role YAML files, and the transformations remain idempotent across multiple runs.

How does the Ansible role fixer handle comments and metadata in YAML files?

The fixer uses regex-based transforms to rewrite comment spacing (enforcing space after #), quote numeric version strings in metadata, replace placeholder metadata with sensible defaults, and update file content in place. Changes are applied across all role YAML files consistently.

Do I need to verify fixes after the fixer runs on my Ansible roles?

Yes. After the fixer runs, review the changes and run ansible-lint to verify that violations are resolved. The fixer is designed to be idempotent, so subsequent runs will not introduce additional changes if the lint violations are already fixed.