3 ms·
Of course, Ansible doesn't really use YAML. It uses a YAML parser, but each individual command goes through quite a bit of parsing inside ansible as well. An
by bryanlarsen 12y ago
Of course, Ansible doesn't really use YAML. It uses a YAML parser, but each individual command goes through quite a bit of parsing inside ansible as well. An ansible command like this:
- command: chdir=/foo echo {{ bar }}
when: bar is defined
Really parses down to something like:
- action:
- module: command
- arguments:
- chdir: /foo
- command: echo {{ bar }}
- when: bar is defined
More parsing is done by ansible than is done by YAML. I'm not necessarily saying it's bad, but it definitely leads to some gotchas and weirdnesses.
How it mixes in Jinja2 is also strange. In the above example, there are two expressions: {{ bar }} and 'bar is defined'. Normally if you paired a templating language with a text format, you would expect the templating language to apply to the whole file. Ansible applies it afterwards, and selectively. That's the right thing to do, but it does make it confusing.
Many people choose ansible because they don't want to learn Ruby as well as a CM tool; ansible isn't much simpler. I'm not a huge fan of ansible, it's just better than everything else I've encountered so far.