#Ansible's decision to use Jinja in values only, and not render the YAML itself through Jinja (like Salt does) might make some things a bit more clean, but it also makes a _lot_ of things significantly more difficult. 😩

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.

@scy that's why I like https://pyinfra.com/, at least for some (small) things.
pyinfra - Fast Python Infrastructure Automation Tool

Fast, Python-based infrastructure automation. Deploy to SSH servers, Docker, and local machines. 10x faster than Ansible.

pyinfra

@jer I will stop what I'm trying to build with Ansible right now and evaluate pyinfra.

Thanks for the suggestion!

@scy note that I've been running 2.x, which had its own oddities due to how it analyzes the Python code.
3.x changed some of that, so double-check the docs!