Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> Programming in Python is order of magnitude "harder" and error prone than writing a simple YAML file.

For a simple config, sure.

But as soon as you have something more complicated, you end up with:

- a frankenstein monster DSL, with pseudo flow control + funcs backed in through a patched up templating system

- weird error messages, no stack trace, and type errors that accumulates

- no DRY

- no tooling: type checks, linting, de bugger, logger. Forget about it.

Case in point: ansible playbooks.

So unless your config is going to stay under 20 lines, just use a real programming language. If you don't want to use Python, fine. Use dhall, nix, jsonet or something else.



Slightly relevant: I made a hack to write Ansible playbooks in Python [1]. It doesn't fix everything, for example runtime control flow still has to be described as attributes of tasks, but it does help with parametrising. It's a question whether it's worth it to add such a hack or if I should just make do with YAML.

[0]: https://gitlab.com/-/snippets/2112382


It's a great hack actually.


You have linting and logger in Ansible. Type checks, kind of depend.

Debugging is definitely something I also would like to see something better coming out of Ansible than what is currently available.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: