I love using Sublime Text 3 for Ansible work, especially after some minor tweaks. The packages I have installed are: Ansible syntax highlighting, ApplySyntax, Jinja2 syntax support, SublimeLinter, and SublimeLinter-pyyaml.
For ApplySyntax you want to change the user settings to contain something like the following below. It's based on the best practices for Ansible directory layout, but with one change, I prefer to have playbooks in their own subdirectory.
{
"syntaxes": [
{
"syntax": "Ansible/Ansible",
"rules": [
{ "file_path": ".*/defaults/.*.ya?ml$" },
{ "file_path": ".*/handlers/.*.ya?ml$" },
{ "file_path": ".*/meta/.*.ya?ml$" },
{ "file_path": ".*/tasks/.*.ya?ml$" },
{ "file_path": ".*/vars/.*.ya?ml$" },
{ "file_path": ".*/inventory/group_vars/.*" },
{ "file_path": ".*/inventory/host_vars/.*" },
{ "file_path": ".*/inventory/.*" },
{ "file_path": ".*/playbooks/.*.ya?ml$" }
]
},
{
"syntax": "Jinja2/Syntaxes/Jinja Templates",
"rules": [
{ "file_path": ".*/templates/.*.j2$" }
]
}
]
}
The above will ensure that the Ansible syntax highlighting gets used for the regular expressions defined in the file_path matches.
Then in the SublimeLinter user settings make sure that syntax_map contains an entry "ansible": "yaml". This will ensure that all views marked with the Ansible file type will now automatically use the SublimeLinter-pyyaml linter.