ansible-testing_skill

This skill helps you enforce ansible-lint rules, validate playbooks, and run integration tests to improve Ansible automation quality.
  • Python

13

GitHub Stars

1

Bundled Files

2 months ago

Catalog Refreshed

4 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstrat where the catalogue uses aiagentskills.

npx veilstrat add skill basher83/lunar-claude --skill ansible-testing

  • SKILL.md7.1 KB

Overview

This skill helps run ansible-lint, validate playbook syntax, and design automated tests for Ansible playbooks and roles. It bundles recommended ansible-lint configuration, idempotency checks, pre-flight validation patterns, and CI integration examples. Use it to enforce standards, catch common mistakes, and automate testing in CI pipelines.

How this skill works

It inspects playbooks and roles with ansible-lint using a configurable profile and skip/warn lists to match project conventions. It provides syntax-check and dry-run commands, scripts to verify idempotency by comparing two runs, and test-playbook patterns for integration checks against test hosts. It includes CI examples to run lint and tests automatically on push or pull requests.

When to use it

  • Before merging changes to playbooks or roles to enforce lint rules
  • When adding or changing infrastructure code to validate syntax and idempotency
  • During CI to block regressions with automated lint and test runs
  • Before running against production—use pre-flight validations on target hosts
  • When configuring team-wide ansible-lint policies and skip/warn lists

Best practices

  • Use a shared ansible-lint config (profile, exclude_paths, skip_list, warn_list) to standardize rules
  • Run syntax-check and --check/--diff before applying changes to hosts
  • Automate idempotency checks by running playbooks twice and failing if second run shows changes
  • Add pre_tasks for environment validation (OS version, connectivity, disk space) to fail fast
  • Limit integration tests to dedicated test hosts and include assert checks for service state and files

Example use cases

  • Run ansible-lint in CI: install deps, sync with uv, and run lint on the ansible/ directory
  • Validate a new role by executing a test playbook against test_hosts and verify service, config, and listening ports
  • Verify idempotency with a script: run playbook twice and fail if changed!=0 on second run
  • Add pre-flight assert tasks to deployment playbooks to ensure target OS and resources meet requirements
  • Debug playbooks locally using increasing verbosity (-v to -vvvv) and step mode to pause after each task

FAQ

The profile selects a rule set (min, basic, moderate, safety, production). Choose moderate for general infra, safety or production for stricter security and production checks.

How do I check idempotency automatically in CI?

Run the playbook twice in the job: the first run applies changes, the second should report changed=0. Fail the job if the second run reports changes or failures.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational
ansible-testing skill by basher83/lunar-claude | VeilStrat