3 ms·
There are places where it makes sense. I don't love Kubernetes' YAML, but it makes sense as a serialization format. I think LISP would be out of place here fi
by curryst 5y ago
There are places where it makes sense. I don't love Kubernetes' YAML, but it makes sense as a serialization format. I think LISP would be out of place here firstly because your serialization format really shouldn't be executable, and secondly because it offers few advantages. You can implement any DSL you want and just have it output YAML.
Ansible really should have ditched the YAML format a long time ago. The YAML is practically designed to be executable; I'm almost surprised that you can't add a shebang line pointing to Ansible at the top of your YAML. I'm actually a little surprised they've never offered an option to write parts of your Ansible setup in Python.
I would love to make some of my roles and my playbook into Python code. I am forever googling the syntax to set up a loop in Ansible YAML, as well as how to make dependencies between roles, which is pretty cleanly solved with Python modules (just import and execute the role at the top of your new role).
- drybjed 5y ago> I'm almost surprised that you can't add a shebang line pointing to Ansible at the top of your YAML. You actually can do that, with something like: #!/usr/bin/env ansible-playbook --- - hosts: localhost tasks: - debug: var=ansible_distribution_release It works pretty nicely, just remember to make your playbook file executable. It's a bit cumbersome though since you cannot use `ansible-playbook` arguments like `--limit`, `--diff`, `--check` and so on to have better control over the playbook execution.