vscode-ansible: Extension is running ansible-lint on all yaml files, causing high CPU usage

This extension is spawning tons of Python processes by running ansible-lint on all yaml files in all projects, including kubernetes manifests, etc. Results in huge CPU usage and high load. Found by running pgrep -fl Python after opening some k8s project.

Fixed for now by "ansible.validate.enable": false in settings.json.

Could it be configured to run lint only on ‘ansible’ files and not on all yaml?

I’ve noticed that extension is not “defining” ‘ansbile’ language in package.json, as in now deprecated vscoss.vscode-ansible extension but rather extending ‘YAML’ language, might that be root of this issue? Or it’s just some misconfiguration on my system?

I’m happy to provide any additional info if needed.

VSCode: 1.55.0 zbr.vscode-ansible: v0.3.0 OS: MacOS 11.2.3

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 20 (10 by maintainers)

Most upvoted comments

I plan to add some features that would reduce the load on re-linting actions, like a configurable delay. That combined with upcoming improvements on performance, will make it suitable for RPI too.

“I am not sure if using a RPI was ever considered as suitable for ansible-lint” I thought so too, and that is why I’ve specified what I was using.

If somebody else is having the same issue though, my solution above might prove useful as a workaround (until they/we upgrade to something more suitable).

Thanks for suggestion on bisect, very useful! (for reference, had to disable ansible/yaml extensions before starting bisect and then enable in order to exclude them from bisect)

And extension that caused parallel runs of ansible-lint is threadheap.serverless-ide-vscode

I don’t use it mach now if at all so I’ve simply uninstalled it. Any advise on troubleshooting steps, just in case?

Guess this issue can be closed now, although I’m not quite sure if running ansible-lint on any opened yaml file and not only ansible ones is a desired behavior or a bug? Should I perhaps create another issue for that?

You are likely facing a problem from another JSON schema being used. As you correctly observed we only hint YAML extension about which YAML files are ansible related, but the legwork is done bit YAML language-server.

This means that the files causing heavy load may be files unrelated to ansible. This happened to me in the past and I sorted it by adding "yaml.schemaStore.enable": false, to settings.json file. As you can see, this will disable looking for other schemas not explicitly configured by user or declared by extensions like ours.