Ansible Lint

Pages 1-2 of the Bitsmasher Lab Operations Manual (62 pages)

Ansible-Linting Infrastructure

All ansible roles in the lab collection should be linted on a regular basis to maintain configuration quality and catch issues early. The lab uses three tools: ansible-lint}, yamllint}, and ansible-test sanity}.

Tools and Configuration

Each linter is configured in the test/} directory:

Coverage Status (44 Roles)

Based on the most recent audit of ansible/collections/ansible\_collections/lab/franklin/roles/ role}:

description}

  • [Complete (30 roles)] apt-mirror, beagleboard, chonk, cluster, common, container-registry, ctfd, desktop, dhcp, dns, docker, documentation, golang, k3s-agent, k3s-server, kerberos, ldap, logging, minecraft, music, nfs, nix, ntp, openbsd, paloalto, prereq, pypi-internal, python, raspberrypi, ssh
  • [Minimal/Functional (9 roles)] media, samba, shell, tls, website, apt-mirror-stub, jetson-nano, k8s (partial), dns-stub
  • [Stubs (4 roles)] edge, extensions, latex, odroid
  • description}

    Roles with the smallest role definitions tend to have the fewest linting issues. The most problematic roles are usually those that include dynamic template generation or custom module invocation.

    Proposed Linting Pipeline

    A new test/lint\_all.sh} script should be created to run all three linters in sequence:

    
    

    # Example lint_all.sh structure:

    #!/bin/bash

    set -euo pipefail

    cd "$(dirname "$0")/.."

    echo "=== ansible-lint ==="

    ansible-lint roles/ 2>&1 || echo "ansible-lint warnings found"

    echo "=== yamllint ==="

    yamllint -c test/.yamllint roles/ 2>&1 || echo "yamllint issues found"

    echo "=== ansible-test sanity ==="

    ansible-test sanity --docker default -v 2>&1 || echo "sanity check failures"

    The linting pipeline should be integrated into:

    Linting Exceptions by Role

    Some roles require special handling during linting: