Skip to content

Commit 9bcf6d8

Browse files
committed
pre-commit: add ansible-lint support
This adds initial support for ansible-lint in pre-commit and GitHub workflows. Add simple wrapper script around ansible-lint. Otherwise the pattern in pre-commit does not work. Test with: pre-commit run ansible-lint --all-files Setup from: https://ansible.readthedocs.io/projects/lint/ configuring/#pre-commit-setup Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
1 parent 6668fed commit 9bcf6d8

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

.github/workflows/fstests.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ jobs:
3939
pre-commit run codespell --files docs/*
4040
continue-on-error: true
4141

42+
- name: pre-commit ansible-lint playbooks
43+
run: |
44+
pre-commit run ansible-lint --all-files
45+
continue-on-error: true
46+
4247
- name: Run kdevops make defconfig-repo
4348
run: |
4449
KDEVOPS_TREE_REF="${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}"

.pre-commit-config.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,8 @@ repos:
55
- id: codespell
66
additional_dependencies:
77
- tomli
8+
- repo: https://github.com/ansible/ansible-lint
9+
rev: v25.4.0
10+
hooks:
11+
- id: ansible-lint
12+
entry: bash scripts/ansible-lint.sh

scripts/ansible-lint.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env bash
2+
# SPDX-License-Identifier: copyleft-next-0.3.1
3+
set -euxo pipefail
4+
5+
ansible-lint playbooks/*.yml --exclude playbooks/roles/

0 commit comments

Comments
 (0)