Comments (11)
I have a problem which I think might be related, if not I'll open another issue:
This is for a yaml file in ansible/playbooks/sso/tasks/openldap/
.
I have the same problem with vars of all types (group_vars, host_vars, vars, defaults):
Basically, anything under playbooks/* is interpreted as a playbook, no matter the parent directory.
On that note, it might be cool if things under files and templates were left alone since they are not actually ansible files.
from vscode-ansible.
It looks like
vars_prompt
also affected:
witha most basic example:
from https://docs.ansible.com/ansible/latest/user_guide/playbooks_prompts.html--- - hosts: all vars_prompt: - name: username prompt: What is your username? private: no - name: password prompt: What is your password? tasks: - name: Print a message ansible.builtin.debug: msg: 'Logging in as {{ username }}'
I'm getting this error:
$ apt-cache policy code code: Installed: 1.55.2-1618307277
redhat.vscode-yaml Preview v0.18.0
zbr.vscode-ansible Preview 0.3.2Please let me know if it's not related and needs a separated issue.
The bug is valid and the correct place to raise it is at https://github.com/ansible-community/schemas -- as this is missing from the schema. It should not be hard to add it.
Update: I already made a PR to add it ansible/schemas#32 -- look at it and you will know how to add the next bit we find missing.
from vscode-ansible.
I have no idea why it gets confused as based on https://github.com/ansible-community/vscode-ansible/blob/master/package.json#L104-L115 it should pick the first pattern that matches, which is groups_vars. Do you happen to have these under a path that looks like playbooks/group_vars/all.yml
? -- is if you do, it would still have to work.
from vscode-ansible.
The group_vars
folder actually is at the root of the project.
from vscode-ansible.
I can confirm the bug, in fact it seems that whatever I do vars files seems to endup using the playbook schema. Looking at the config, I see no reason for this to happen.
The bug seems related to a recent merge made to redhat-developer/yaml-language-server#417 and I wonder if next release of YAML extension will adress it,... or make things even worse.
Test cases:
playbooks/all.yml
- should use ansible-playbook schemagroup_vars/all.yml
- should use ansible-vars schemaplaybooks/group_vars/all.yml
- should use ansible-vars schema, even if both patterns are matching. I do think there is a real chance this may go wrong as I do remember that vscode original globbing was not very smart and a single*
could expand to anything. I am also not sure if the order of the patterns is respected either. We do list playbooks at the end for good reasons: to avoid folders like vars/tasks/handlers nested inside playbooks/ to endup being recognized as playbooks.
I hope that @JPinkney or @joshuawilson may give us some insights here. Maybe the can help us by adding some extra tests that assure we can write patterns to distinguish between those cases.
from vscode-ansible.
I can probably take a look as to what's causing on the yaml side later today
from vscode-ansible.
I tested with vscode-ansible@master and I can confirm that now case 1 and 2 are now working (clear improvement), but 3 is not. playbooks/group_vars/all.yml
is still identified as a playbook instead of a vars file and I do not know how to define patterns that avoid overlapping.
If you look at https://github.com/ansible-community/vscode-ansible/blob/master/package.json#L117 you will see that vars pattern is listed before the playbook one, so it should be picked first, right?
from vscode-ansible.
If you look at https://github.com/ansible-community/vscode-ansible/blob/master/package.json#L117 you will see that vars pattern is listed before the playbook one, so it should be picked first, right?
It evaluates everything equally, there is no way to prioritise one or the other. Let me try it with redhat-developer/yaml-language-server#417 and i'll see if that fixes it
from vscode-ansible.
I played around with playbooks/group_vars/all.yml
and it looks like both schemas (vars and playbook) are currently being set. You can see this if you do:
allUsers
aa
you'll see an error with:
Ansible Vars Schema
Incorrect type. Expected "ansible-vars.json".yaml-schema: Ansible Vars Schema
Incorrect type. Expected "array".yaml-schema: Ansible Playbook Schema
from vscode-ansible.
It looks like vars_prompt
also affected:
with a most basic example:
from https://docs.ansible.com/ansible/latest/user_guide/playbooks_prompts.html
---
- hosts: all
vars_prompt:
- name: username
prompt: What is your username?
private: no
- name: password
prompt: What is your password?
tasks:
- name: Print a message
ansible.builtin.debug:
msg: 'Logging in as {{ username }}'
I'm getting this error:
$ apt-cache policy code
code:
Installed: 1.55.2-1618307277
redhat.vscode-yaml Preview v0.18.0
zbr.vscode-ansible Preview 0.3.2
Please let me know if it's not related and needs a separated issue.
from vscode-ansible.
We are unable to reproduce this with current version of the extension, please upgrade and report if you can see the error.
from vscode-ansible.
Related Issues (20)
- Add document formatting feature OR set YAML extension's formatter on ansible playbooks. HOT 2
- Adopt ansible-language-server into vscode-ansible repository HOT 2
- Suggestions show all installed collections as part of 'ansible.builtin' HOT 2
- Improve Ansible LSP Docs for Vim and Neovim
- RFE: Allow for right-click on a molecule scenario to run it
- chore: upgrade chai v5
- Scaffolding collection fails when the web view in used for subsequent usage
- aaa HOT 1
- ansible variable resolution with live preview HOT 1
- Code quality checklist
- easily follow imports
- Modules from collections are not recognized when COLLECTIONS_PATH is set via env var HOT 1
- Standardise the functionalities provided by ansible-creator in the extension
- Ansible-language-server npm package 1.2.2 is missing core files HOT 1
- RFE: Ability to add devcontainer/devfile files to a workspace w/o ansible-creator HOT 1
- Update development documentation for the new project structure
- "Open collection" should open in new window, with a new virtual environment
- Disable create buttons in the collection and project creation web-views during the scaffolding process
- Hung up remote session keeps running at 100% CPU HOT 3
- [error] Error: ENOENT: no such file or directory, stat - with temp pyc files
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vscode-ansible.