ugh, debugging ansible plays got me really wishing I was able to use #pyinfra on this project.
also, guess i'm taking the day off if colleagues want to be rude to me while helping them debug other issues
So far I'm really liking #PyInfra Inventory and Group Data management. For inventory; with 16 lines of non-boilerplate code
* Get VMs that have cluster nodes assigned from #NetBox
* Built pyinfra host list from those devices
* Add VM to corresponding hosts data
The operation would iterate `host.data['vms']` to perform actions.
And for Group Data, this brings me joy, nay, relieves a certain existential dread.
well pretty cool. I spent some time last night digging into #PyInfra and so far I'm pretty into it. I spent maybe ~5 hours and built
* a basic inventory pull from NetBox VMs
* OpenWRT uci facts and operations (very basic)
* An operation to find all my VMs with IP addresses define and put static leases on my router.
Total <100 lines of code.
Much of the time was spend reading docs and source to understand internals.
@wowi42 you mention that the code is not always understandable. Part of the reason is how most Ansible is written. I wrote about that a few months ago:
https://www.grulic.org.ar/~mdione/glob/posts/we-have-been-writing-ansible-tasks-wrong/
I like the idea that it's all Python, but at the same time Ansible is really consistent: all tasks are similar. Yes, it is more verbose, and it is YAML, but boring has its advantages.
One thing: you are using the old loop syntax, but yeah, the new one is just slightly better.
I should try #pyinfra one day :)