#pyinfra - Du #Python au lieu du #YAML d' #Ansible pour gérer vos #serveurs

Jusqu'à 10x plus rapide qu' #Ansible sur déploiements massifs

https://korben.info/pyinfra-automatisation-infrastructure-python.html

pyinfra - Du Python au lieu du YAML pour gérer vos serveurs - Korben

Ansible, c'est bien. Mais du YAML à perte de vue pour configurer trois serveurs c'est pas non plus l'idéal. Hé bien ça tombe bien car y'a maintenant ...

Le site de Korben
#pyinfra - Du #Python au lieu du #YAML d' #Ansible pour gérer vos #serveurs Jusqu'à 10x plus rapide qu' #Ansible sur déploiements massifs korben.info/pyinfra-auto...

pyinfra - Du Python au lieu du...
pyinfra - Du Python au lieu du YAML pour gérer vos serveurs - Korben

Ansible, c'est bien. Mais du YAML à perte de vue pour configurer trois serveurs c'est pas non plus l'idéal. Hé bien ça tombe bien car y'a maintenant ...

Le site de Korben

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

*solid* chance upcoming work project will use #PyInfra over #Ansible. IF I can satisfactorily add code docs, testing, and decouple myself from ADHD `new shiny!`

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 :)

@joeldn

We have been writing Ansible tasks wrong

Look at the following Ansible task: - name: Prometheus Exporters - name: Extend caps for ping - File template: src: "roles/server/files{{ item }}" dest: "{{ item }}" owner:

.:: Marcos Dione/StyXman's glob ::.

@isotopp #PyInfra ist doch nur neuer Syntax für die Behandlung der gleichen Symptome, ohne die grundlegenden Probleme zu lösen, oder habe ich was verpasst?

Und wer damit automatisiert interagieren will braucht dann nicht nur einen YAML Parser (schlimm genug!) sondern einen Python LSP?

Well done. Not.

@pfhllnts next year a new track at #cfgmgmtcamp? 🙂
#pyinfra

Loïc Tosser is bringing wonderful energy to their PyInfra talk at FOSDEM (live now):

"Because Your Infrastructure Deserves Real Code in Python, Not YAML Soup", Python track.

#FOSDEM #Ansible #PyInfra #YAML