Skip to content

chore(ci): refresh lint workflow + add .ansible-lint config#33

Open
0cwa wants to merge 2 commits into
bonfirelink:masterfrom
0cwa:chore/ci-lint
Open

chore(ci): refresh lint workflow + add .ansible-lint config#33
0cwa wants to merge 2 commits into
bonfirelink:masterfrom
0cwa:chore/ci-lint

Conversation

@0cwa

@0cwa 0cwa commented Apr 29, 2026

Copy link
Copy Markdown

Refreshes linting CI and adds an explicit .ansible-lint config pinned at the safety profile.

What changed

  1. .ansible-lint (new) — pins profile: safety so contributors and CI agree on which rules are gates. Excludes the legacy roles (common, fail2ban, nginx, certbot, matrix) so their pre-existing debt isn't a blocker for new work.
  2. .github/workflows/linting.yml — modernised:
    • actions/checkout@v4, actions/setup-python@v5 (the previous workflow pinned ubuntu-18.04 + Python 3.7 + actions@v1, all retired)
    • direct pip install of ansible-core, ansible-lint, yamllint (the 2020-era pipenv + Pipfile.lock setup is left in place for legacy make lint callers but no longer drives CI)
    • three independent gates surfaced as separate steps:
      1. yamllint on the whole tree
      2. ansible-lint on roles we actively maintain (roles/docker, roles/funkwhale); declared via an ACTIVE_ROLES list that gracefully skips paths not yet present
      3. ansible-playbook --syntax-check on every playbook, using a dummy non-empty .vault_pass.txt so parse doesn't hit the vault password file not found error (CI never decrypts; syntax-check only parses YAML)

Why role-by-role, not playbook-by-playbook?

A known ansible-lint limitation (#2687, #3489) means exclude_paths doesn't block transitive role discovery. Linting playbooks/funkwhale.yml would surface ~100 pre-existing failures in legacy roles. Linting roles standalone keeps the gate actionable for new code.

Verified with

Simulated CI locally for every branch in this batch — all post-merge into master pass yamllint + ansible-lint + syntax-check.

Stacking

Branched from fix/matrix-playbook-syntax so the new syntax-check step doesn't go red on day one (matrix.yml has the pre-existing vars list-of-dicts bug that PR fix/matrix-playbook-syntax fixes).

Recommended merge order: fix/matrix-playbook-syntaxthis PRfeat/docker-rolefeat/funkwhale-corefeat/funkwhale-anubis + feat/funkwhale-backup.

Out of scope

  • Pipfile / Pipfile.lock / Makefile still use the 2020-era pipenv flow. The new CI bypasses them, but make lint / make setup are likely already broken due to bitrot. Tracked separately.

0cwa added 2 commits April 29, 2026 22:42
Ansible 2.10+ rejects 'vars: [- key: value, ...]' under a play with:
  ERROR: Vars in a Play must be specified as a dictionary.

The dashes were a copy/paste hangover from the 'roles:' list above.
Re-indent the body so each var is a top-level key in the dict.

No semantic change. Verified with:
  yamllint -c .yamllint.yaml playbooks/matrix.yml
  ansible-playbook --syntax-check -i hosts/prod playbooks/matrix.yml
Adds an explicit .ansible-lint pinned at the 'safety' profile, and
modernises the GitHub Actions workflow that gates linting:

  * actions/checkout@v4 + actions/setup-python@v5 (the old workflow
    pinned ubuntu-18.04 + python 3.7 + actions@v1, all now retired)
  * direct pip install of ansible-core + ansible-lint + yamllint;
    the pipenv + Pipfile.lock setup from 2020 is left in place for
    legacy 'make lint' callers but no longer drives CI
  * three independent gates surfaced as separate steps:
      1. yamllint on the whole tree
      2. ansible-lint on roles we actively maintain
         (roles/docker + roles/funkwhale; declared via an
         ACTIVE_ROLES list that gracefully skips paths not yet
         present in the current checkout, so this PR is safe to
         land before feat/docker-role and feat/funkwhale-core)
      3. ansible-playbook --syntax-check on every playbook,
         using a dummy non-empty .vault_pass.txt so parsing
         doesn't hit the 'vault password file not found' error

Linting playbooks directly (rather than the roles they pull in) is
intentional: a known ansible-lint limitation
(ansible/ansible-lint#2687, ansible/ansible-lint#3489) means
exclude_paths does not block transitive role discovery, so playbook
linting would surface ~100 pre-existing failures in legacy roles
(common, fail2ban, nginx, certbot, matrix). That debt is tracked
separately. New roles must pass safety from day one and are added
to ACTIVE_ROLES when they land.

Branched from fix/matrix-playbook-syntax so the new syntax-check
step does not go red on day one (matrix.yml has a pre-existing vars
list-of-dicts bug that PR-0 fixes).

Verified locally with the actual repo ansible.cfg (vault file
absent) on:
  - chore/ci-lint            (no new roles → ansible-lint skipped,
                              syntax-check passes on matrix.yml +
                              web.yml)
  - feat/funkwhale-backup    (both new roles linted clean,
                              matrix.yml correctly FAILS until
                              rebased onto master after PR-0 lands —
                              the dependency is surfaced)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant