How to set Pycharm with Ansible plugin to do code completion for variables?

I hope you solved your problem already, but for the reference, as I had the same problem and Google led me to this question, here is how I solved it:

PyCharm comes with another YAML Plugin which will take all your Ansible YAML files under its control. Have a look if the favicon of your your files in the filesystem browser and the editor tabs have the Ansible logo.

Those editor tabs, associated with the Ansible/YAML plugin, are able to trigger code completion for variables. Those without the logo, do not.

For me the solution was to disable the other YAML Plugin.


Disclaimer: I'm the author of this plugin.

The recently released Ansible plugin helps you write and work with ansible files. it's totally compatible with built-in YAML plugin. Although it has many good features but it still can't suggest variable names but i'm actively developing it and it will do that soon.


YAML/Ansible plugin registers its own file type YAML/Ansible in IntelliJ IDEA based IDEs (PhpStorm, WebStorm, PyCharm, CLion, RubyMine, Rider, GoLand, DataGrip, etc).

As an alternative to disabling original YAML plugin, use can reassign file types.

Go to File => Settings, then Editor => File Types. Click in the YAML type and remove *.yaml and *.yml patterns. Then click on the YAML/Ansible file type and add those patterns there.