Add settings to configure `ansible-playbook --syntax-check`
See original GitHub issueProblem
I have the following setup:
ansible
roles
dev
roles
dev.yml
ansible.cfg
Whenever I execute the dev/dev.yml
playbook, I’m always located inside the ansible
folder.
Inside my ansible.cfg
, I have extended the roles_path
to tell ansible to look for roles inside the ./roles
as well as the ./dev/roles
.
My dev/dev.yml
playbook uses roles from both folders and it works perfectly fine.
However, when I try to edit the dev/dev.yml
file in VSCode, I get an error stating that the roles cannot be found:
Command failed: ansible-playbook /myrepo/ansible/dev/dev.yml --syntax-check
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that
the implicit localhost does not match 'all'
ERROR! the role 'myrole' was not found in <default paths>
Solution
From what I found by searching this repository, the README and the settings of the extension, there is no way to configure the behavior of syntax checking when it’s done using ansible-playbook
.
I would like to either disable the checking entirely or be able to change the configuration to tell it to take my ansible.cfg
into account. Or simply extend the role_paths
directly even if it’s not DRY.
Alternatives
Disabling the Ansible extension entirely.
Attempted to switch to ansible-lint
but ticking the checkbox didn’t change anything.
Additional context
No response
Issue Analytics
- State:
- Created a year ago
- Comments:7
Yes, opening the
ansible
folder as the vscode root works properly.@priyamsahoo Sorry to bother you again but could we reopen this issue, please?