vscode-ansible
vscode-ansible copied to clipboard
als: must pass ANSIBLE_ASK_VAULT_PASS=False to avoid interactive prompt blockages
Summary
The extension linter doesn't work in the main playbook file, but it works in all roles. Maybe I'm doing something wrong, but I could not find similar problems in the community. The same problem with other projects on ansible. I'm not sure, but maybe it's always been like this and i'm just doing something wrong. upd Now I tried to create another file in the playbooks dir - linter doesn't work there either.
Extension version
2.0.58
VS Code version
1.78.1
Ansible Version
ansible [core 2.12.4]
config file = /home/mystic/projects/env.Maker/ansible.cfg
configured module search path = ['/home/mystic/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3/dist-packages/ansible
ansible collection location = /home/mystic/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/bin/ansible
python version = 3.10.7 (main, Mar 10 2023, 10:47:39) [GCC 12.2.0]
jinja version = 3.0.3
libyaml = True
OS / Environment
Windows 11, WSL (Ubuntu 22.10), ansible-lint 6.3.0 using ansible 2.12.4
Relevant log output
Path for lint: /usr/bin/ansible-lint
Validating using ansible-lint
Path for lint: /usr/bin/ansible-lint
Validating using ansible-lint
Path for lint: /usr/bin/ansible-lint
Validating using ansible-lint
Path for lint: /usr/bin/ansible-lint
Validating using ansible-lint
Path for lint: /usr/bin/ansible-lint
Validating using ansible-lint
Path for lint: /usr/bin/ansible-lint
Validating using ansible-lint
Path for lint: /usr/bin/ansible-lint
Validating using ansible-lint
Path for lint: /usr/bin/ansible-lint
Validating using ansible-lint
Path for lint: /usr/bin/ansible-lint
Validating using ansible-lint
Path for lint: /usr/bin/ansible-lint
Validating using ansible-lint
Path for lint: /usr/bin/ansible-lint
Validating using ansible-lint
Path for lint: /usr/bin/ansible-lint
Validating using ansible-lint
[Trace - 6:15:24 PM] Sending notification '$/setTrace'.
[Trace - 6:15:49 PM] Sending notification 'update/ansible-metadata'.
[Trace - 6:15:49 PM] Received notification 'update/ansible-metadata'.
[Trace - 6:15:56 PM] Sending notification 'update/ansible-metadata'.
[Trace - 6:15:56 PM] Received notification 'update/ansible-metadata'.
[Trace - 6:16:15 PM] Sending notification 'textDocument/didClose'.
[Trace - 6:16:19 PM] Sending notification 'textDocument/didOpen'.
[Trace - 6:16:19 PM] Sending notification 'update/ansible-metadata'.
[Trace - 6:16:19 PM] Received request 'workspace/configuration - (19)'.
[Trace - 6:16:19 PM] Sending response 'workspace/configuration - (19)'. Processing request took 2ms
Path for lint: /usr/bin/ansible-lint
Validating using ansible-lint
[Trace - 6:16:19 PM] Received request 'window/workDoneProgress/create - (20)'.
[Trace - 6:16:19 PM] Sending response 'window/workDoneProgress/create - (20)'. Processing request took 0ms
[Trace - 6:16:19 PM] Received notification '$/progress'.
[Trace - 6:16:20 PM] Sending notification 'update/ansible-metadata'.
[Trace - 6:16:20 PM] Received notification 'update/ansible-metadata'.
[Trace - 6:16:20 PM] Received notification 'update/ansible-metadata'.
After an eternity, I found the problem. In ansible.cfg I have ask_vault_pass = True.
So the linter asks for the password in the console, and in vscode it can't do this. Maybe you can add an option to the parameters to ignore this configuration parameter and force False
for it? Indeed, in my case, the file is not encrypted and there is no need to enter the password.
I'm not sure we can work around it but we might be able to detect it and complain a little louder so it's obvious to see what the issue is.
@priyamsahoo @ganeshrn I think that we need to ensure we pass ANSIBLE_ASK_VAULT_PASS=false
to override possible ansible.cfg options that might trigger the interactive prompt.
I will rename the title of the bug to state what we need to do.
In fact I wonder if that should not be fixed directly into the linter. I never supported any interactive prompts in tools that are expected to be called unattended.