Closed langston-barrett closed 6 years ago
I took a stab at it some time ago but it's quite difficult to distinguish Ansible YAML files from ordinary YAML files with a good accuracy. This is mostly because Ansible uses the exact same file extension as ordinary YAML files :/
Even if detection is not great, just having "Ansible" as a defined "language" would allow for setting it as a manual override...
That may be true, but when you consider how many YAML files there are already on GitHub, and how many of them might risk misclassification as Ansible YAML, it doesn't become worth the risk. Particularly since the vast majority of users are unaware overrides even exist.
Hmm, that is a fair point. Time to log an issue to Ansible to start making playbooks and roles distinguishable somehow :)
How does Ansible YAML differ from normal YAML?
I'm entirely unfamiliar with the former; I keep hearing the name dropped, but have never really understood what it is...
Not sure if it's related or relevant to this discussion, but our ansible projects seem to be getting identified as Erlang all of a sudden. I think they were seen as bash/shell projects before. Very strange.
@Alhadis Ansible is YAML where string values go through Jinja2 template engine. I would describe it as a Turing-complete YAML-based procedural scripting language.
It would be nice to have this implemented.
According to the Ansible documentation "Ansible YAML" is standard YAML...
From http://docs.ansible.com/ansible/latest/playbooks_intro.html#playbook-language-example:
Playbooks are expressed in YAML format (see YAML Syntax) and have a minimum of syntax, which intentionally tries to not be a programming language or script, but rather a model of a configuration or a process.
From http://docs.ansible.com/ansible/latest/YAMLSyntax.html:
We use YAML because it is easier for humans to read and write than other common data formats like XML or JSON. Further, there are libraries available in most programming languages for working with YAML.
The only deviation from standard YAML that I can see is optional the use of {{ }}
within values, which won't necessarily happen in all Ansible files, and if you do use it, it still needs to be quoted so is still valid standard YAML.
A combination of the facts that...
.yml
extension (unlike Puppet and Salt),.yml
files, but not normal YAML .yml
files?"), and Ansible's own words:
[...] intentionally tries to not be a programming language or script [...]
... which puts it squarely into the realms of standard YAML as Linguist sees it (hint: it's already viewed as data, not a programming language, so doesn't count towards the stats. Accordingly, the only place you may see a difference is in the syntax highlighting and even then it would only be IFF you used {{ }}
)
... I'm inclined to say we can't implement "Ansible YAML" as its own language.
With all this in mind, I'm going to close this issue. If at some point in the future Ansible's YAML deviates from standard YAML sufficiently to differentiate it from standard YAML, I'm happy to accept a PR that implements unique "Ansible YAML".
Since linguist supports Salt and Puppet YAML flavors, I think Ansible fits right in!