Closed Alecton4 closed 1 year ago
I tested with your repository and the file is correctly identified as an inventory file if you do not alter the file associations.
@priyamsahoo WDYT? I do know why this happens as this forces use of ALS for an inventory file. When not assigned it will use YAML LS with inventory schema, which is just fine. Somehow I have the impression that many users could end-up doing a similar kind of configuration mistake.
That path is wrong because it will force use of ALS even on templates/
and files/
within ansible/
folder but that bit with inventory seems something that we could be able to recognize.
@Alecton4 For the moment remove your custom association pattern or change it to avoid including files that are not playbooks
or tasks
files as "ansible" language server knows only about these. The other file-types related to Ansible are taken care of YAML extension by default.
We are looking for a way to improve this, but it will take time as it is a real technical challange.
remove your custom association pattern or change it to avoid including files that are not
playbooks
ortasks
files
@ssbarnea Thanks for your reply. I changed my file association as below and it works.
"files.associations": {
"**/*ansible*/inventory.yml": "yaml",
"**/*ansible*/**/*.yml": "ansible",
// "**/playbooks/**/*.yml": "ansible",
// "**/roles/**/*.yml": "ansible"
},
BTW, I saw this commit made ansible-lint able to recognize inventory files. Thus I configured all the yml
files in the project folder to be ansible
type, expecting ansible-lint would be able to identify the inventory file.
After the recently updated version of the extension, which has the capability for detecting non-playbook files and doing linting, I believe this issue is resolved. Kindly check and feel free to open it up if not sorted.
Sanity check
redhat.ansible
extension is in use and the language of the document in this bug report shows up asAnsible
Summary
I encountered almost the same issue as this one. The project can be found here. The Ansible project directory is
DetectionLab/ESXi/ansible
.I am not sure why this
inventory.yml
file is not recognized as an inventory file. Is it because I add the entireDetectionLab
folder to a multi-root workspace in VSCode? My workspace is as follows. The yellow ones are the root folders in this multi-root workspace.Also, I have the following settings in the workspace scope.
Extension version
0.10.0
VS Code version
1.69.0
Ansible Version
OS / Environment
local host: Windows 10 using remote SSH. remote host: Ubuntu 20.04 (in VMware Workstation 16 installed on local host).
ansible-lint 6.3.0
.Relevant log output