Skip to content

Commit ba74535

Browse files
committed
Revert the ansible collections path to ansible/collections so we don't inadvertently break any existing checkouts.
Direct ansible-lint to use .ansible/collections so downloads are excluded from linting by our .ansible-lint.yml
1 parent 0be53fc commit ba74535

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

.github/workflows/lint.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
---
2-
name: Lint
1+
---
2+
name: Lint
33

44
on: # yamllint disable-line rule:truthy
55
workflow_call:
@@ -30,6 +30,9 @@ jobs:
3030

3131
- name: Run ansible-lint
3232
uses: ansible/[email protected]
33+
if: always()
34+
env:
35+
ANSIBLE_COLLECTIONS_PATH: .ansible/collections
3336

3437
- name: Load super-linter configuration
3538
# Use grep inverse matching to exclude eventual comments in the .env file

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,5 +172,9 @@ docker run --rm \
172172
```
173173

174174
```shell
175-
ansible-lint -c .ansible-lint.yml ansible/
175+
ANSIBLE_COLLECTIONS_PATH=.ansible/collections \
176+
ansible-lint -c .ansible-lint.yml ansible/
176177
```
178+
179+
Specifying `ANSIBLE_COLLECTIONS_PATH` ensures `ansible-lint` downloads collections and roles under the `.ansible` directory, separating them from our own roles under the `ansible` directory.
180+
We exclude these downloaded files from linting by listing `.ansible` under `exclude_paths` in `.ansible-lint.yml`.

ansible.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ gathering = smart
55
forks = 30
66
host_key_checking = False
77
remote_tmp = /tmp
8-
collections_path = .ansible/collections
8+
collections_path = ansible/collections
99
roles_path = ansible/roles
1010
filter_plugins = ansible/filter_plugins
1111
callbacks_enabled = ansible.posix.profile_tasks

0 commit comments

Comments
 (0)