Hot take: Infrastructure as Code should mean actual _code_, not YAML.
Don't get me wrong: I'm one of the few people who actually like YAML. But trying to express actual _logic_ in YAML, like conditions, or value lookups, or loops, gets really messy really fast.
Just let me write my infrastructure in actual Python (or whatever). It can still be declarative, with all the state comparison and dependency resolving going on in the background.
But YAML is not the way.
Wait, neither #pyinfra nor #BundleWrap run actual Python code on the remote hosts, right? They're apparently both basically just fancy wrappers for running shell commands, mainly via SSH.
In contrast, #Ansible _does_ run Python on the remote side. Which means that Python is required to be installed, but also means that you can do more sophisticated stuff than parsing CLI tool output. π€
@kunsi Have you also tried pyinfra? It seems to be more popular than BundleWrap.
If you have some experience with both, I'd be very interested in your opinion on the pros and cons of both.
(Feel free to switch to German if you like.)
@scy No, never heard of pyinfra before. Since i'm a maintainer for bundlewrap, chances are low i'd switch over.
(Also, we use bundlewrap at work, so having common knowledge and being able to copy bundles over is nice)
@kunsi Oh, I didn't know you're a maintainer!
Well, I'm currently comparing the two and I'm still undecided.
The way it seems to me, compared to pyinfra, BundleWrap
β’ only works via SSH (pyinfra has "connectors" for Docker, chroot, local, etc.)
β’ requires passwordless sudo
β’ relies more on plain dicts instead of classes
β’ allows more explicit dependencies between actions
β’ does less magic
β’ appears to be even more bare-bones
β’ comes with helpers to compare desired and actual state
@kunsi Not gonna lie, I'm kinda turned off by pyinfra using an example like `"rm -f {0}".format(name)` without quoting anything.
https://docs.pyinfra.com/en/3.x/api/operations.html#example-managing-files
(At least they're quoting it in the actual project source code.)
Also, using one operation's output in another operation is implemented in kind of a strange way:
https://docs.pyinfra.com/en/3.x/api/operations.html#example-managing-files
But, how would I pass information from one item to another at runtime in BundleWrap at all? Is that supported? Would it even make sense?
@scy agreed. I belong with the yaml hating kind though π
My impression has been that IaC not being code seems to lead to a lot of issues from missing out on tests and type checking.
It seems rare enough that checks against a schema and linting happen. In my mind this easily results in putting more importance on correct indentation than on working deployments.
Especially with json being valid yaml I don't get why not more of it is done by executing scripts instead of running helm and the like.