-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot find ansible.cfg when using multi-root workspaces #12
Comments
In my understanding ansible reads the config file in following order, from ansible doc:
And right now the extension should check the |
Yes, you are right, it should only read from those 3 locations. A proper fix is to remove the usage of vscode.workspace.rootPath (already deprecated) and migrate to multi-root workspace API. For now i am using a workaround of editing my workspace file and putting the project that i am currently working on as the first entry. Note: Vaulty can find the correct ansible.cfg, but i stick to your extension since Vaulty doens't encrypt back and shows a read-only yml. |
I also encountered this. I personally would love to have Vaulty's approach of finding the working directory by checking all parent paths. https://github.com/codeflows/vaulty/blob/master/src/vault.ts#L8 I leave it up to you if you can integrate this with the default ansible configuration order. |
Thanks for comment @codestation @Dutchy- , just realized this feature and would be nice to be included in the extension :) I will try to understand a bit and make it happen 👍 |
@codestation @Dutchy- Although I have added the support of multi-root workspace, is there any use cases of reading Because of opening the workspace in sub-directory of Ansible playbooks or any? TBH I am no longer using ansible-vault in my working place, your comments would be valuable :) |
My preferred setup is $workspace/ansibleprojects/project1/ansible.cfg, so one extra level. |
The plugin always tries to use the first folder declared in the workspace list, so if the vault file isn't in the first folder then the plugin will not find the ansible.cfg file or worse, uses the ansible.cfg of the first workspace folder, that can have an unrelated configuration.
A possible fix is to check the current folder, then the parent ones until it finds the ansible.cfg file (stopping at the root of the current workspace), then checking the user and system locations..
The text was updated successfully, but these errors were encountered: