I am using a different config management tool up to now (not ansible).
I think about switching to ansible.
But I don’t like YAML.
I like Python.
Is it doable to use Python syntax instead of YAML?
Is it feasible to do this?
I am using a different config management tool up to now (not ansible).
I think about switching to ansible.
But I don’t like YAML.
I like Python.
Is it doable to use Python syntax instead of YAML?
Is it feasible to do this?
Ansible embraces YAML. Technically, yes. But you’ll hardly reap the benefits of Ansible without YAML.
I know how to create dicts, lists, strings, multiline-strings with python. The syntax is easy and simple.
I am lazy. I just don’t know why I should learn a new language.
if you know that then its pretty easy to leanr YML. Specially when the ansible documents have a lot of examples.
YAML is great; I was confused at first because I thought it was a “markup language” like HTML, but it’s just a way to represent data structures.
It’s not a programming language, though. If you want to write your system configuration in a programming language (Python, in this case :^), you might want to check out OpsMop (https://opsmop.io/), the latest thing by the guy who originally wrote Ansible. My impression is that it’s still pretty bleeding-edge, but looks like it has promise.
I would take a look at Troposphere. It is a Python project that creates JSON / YAML for Cloudformation scripts. Very similar to what you want to do. I have not heard of the same project for Ansible
Thank you for this hint. This sounds interesting: https://medium.com/@michaeldehaan/16-ways-opsmop-improves-on-ansible-number-17-is-an-off-by-one-error-bf989420edca
Seems specific to AWS Cloudformation. But good news, I am not the only one who prefers python over yaml.
It's not a language, it's a serialisation format like JSON, it's a
superset of JSON in fact. Ansible uses its syntax to define a language
on top.
They could have equally used XML or JSON to do this. They chose YAML.
It didn't last long, it's already discontinued ref. https://github.com/opsmop/opsmop