Suppressing YAML warning in vscode when !vault is used in var files?

I’ve been trying to figure out how to get the YAML VSCODE module to stop reporting a problem in my ansible var files, such as this one, where it highlights !vault as an unresolved tag.

ansible_connection: winrm
ansible_winrm_transport: credssp
ansible_winrm_scheme: https
ansible_winrm_server_cert_validation: ignore
ansible_port: 5986
ansible_user: ‘(REDACTED)’
ansible_password: !vault |
$ANSIBLE_VAULT;1.1;(REDACTED)

Thanks!

I don’t use VS Code, but according to the documentation you can define custom tags in the settings of the code editor like so:

"yaml.customTags": [
    "!vault scalar"
]
4 Likes

Thanks, that seems to have gotten rid of the ugly red highlighting.

Hi and welcome to the community forum @gawainsr!

I’m glad the issue is solved. If the reply by @flowerysong helped you solve the issue, please tick the checkbox at the bottom of his comment to mark the topic as solved and their answer as the correct one, this will help other people as well as provide recognition within the forum.

Solutions

If you get to a point where you consider a post by someone helped you to solve the issue, please tick :white_check_mark: the check-box below their message:

image

This will mark the message as the solution and show it in the first post for easy access, as well as recognize the person that helped:

image

Let us know if you have any questions or doubts!