I have split my custom ansible roles and the ones downloaded from ansible-galaxy into seperate directories (./roles and ~/.ansible/roles).
In .ansible.cfg I have added the following configuration:
[...]
roles_path = ~/.ansible/roles:./roles
[...]
Ansible-lint reads my ansible.cfg and scans both directories as expected.
Since I just want to lint my own ansible roles, I have added the following line to my .ansible-lint configuration:
[...]
exclude_paths:
- ~/.ansible/roles
[...]
This unfortunately does not work, ansible-lint still scans both directories.
If I expand the username explictly (e.g. - /root/.ansible/roles), ansible-lint ignores the directory correctly.
Is it somehow possible to ignore my shared roles directory without using an absolute path (since the user accounts differ between my local machine and the ci server)?
Ansible-lint will respect ANSIBLE_ROLES_PATH if you define it.
Newer versions of the linter will not report problems from files not tracked by the current repository. Almost for sure you can get around without having to add stuff to
exclude_paths.