*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 :)
@pfhllnts next year a new track at #cfgmgmtcamp? 🙂
#pyinfra
Trying out #PyInfra as an alternative to #Ansible. I hate having to program in #YAML so just doing it in pure #python is nice.
So far so good. I was able to install a package, upload some #systemd units, conditionally do a daemon-reload and enable the units with way less thrashing around than I've had with Ansible.
Ansibleが嫌すぎてPyinfraに乗り換えましたが、FOSDEM 2026でPyinfraの面白そうな話があるみたい。
> 警告:この講演を聴くと、AnsibleのPlay bookを全てリファクタリングしたいという抑えきれない衝動に駆られるかもしれません。副作用として、生産性の向上、睡眠の質の向上、そして同僚がインフラコードを実際に理解してくれるようになることなどが挙げられます。
挑発的だなー。いいぞ、もっとやれ #pyinfra #fosdem #fosdem2026 #python #ansible
FOSDEM 2026 - PyInfra: Because Your Infrastructure Deserves Real Code in Python, Not YAML Soup: https://fosdem.org/2026/schedule/event/VEQTLH-infrastructure-as-python/
un outil #DevOps de gestion d'#infrastructure numérique en #Python pour faire de l'#infraAsCode : https://pyinfra.com/
À la différence d'#Ansible qui est également codé en Python, #PyInfra ne s'appuie pas sur un DSL yaml, mais convertit les commandes Python en commandes shell sur le terminal de la machine hôte.
🔥 Wow, #pyinfra does what every #sysadmin dreams of: turning #Python into shell commands. Because who doesn't love more layers of abstraction and complexity? 😅 Now you can automate the chaos of managing your servers with a tool that is definitely not over-complicating things! 🚀
https://github.com/pyinfra-dev/pyinfra #automation #shellcommands #servermanagement #complexity #HackerNews #ngated
Pyinfra: Turns Python code into shell commands and runs them on your servers
https://github.com/pyinfra-dev/pyinfra
#HackerNews #Pyinfra #Python #ShellCommands #DevOps #Automation
@rye maybe #pyinfra https://pyinfra.com
ok so I'm debugging pyinfra and it seems it mishandles sudo -i; however despite reading the sudo manpage I'm also incapable of understanding how sudo -i *precisely* works when it comes to escaping (see second toot)
So here's the question: how do I make this command output 1? with -i; I do want a login shell.
sudo -i sh -c 'x=1; echo $x'
It's time to scratch that itch again.
I've got a bit bored of my #debian + #ansible setup. On the older servers it's a little slow and prone to breakage. Playbooks can easily break due to small changes. So it feels like I'm always fiddling to keep them working.
I'm curious what #nixOS is like. The "write your config once, keeps working" seems very tempting.
On the other hand, switching to #pyinfra and/or #alpine may also scratch that itch.
But first, upgrade to #debian #trixie (well #armbian)
@ludicity @daedalus https://pyinfra.com/ is soooo much nicer than ansible and a little nicer than python/bash heh #pyinfra
@delta got me onto it (it's used to make setting up chatmail relays easy) #deltachat #chatmail
Maybe #NixOS is something for me, after all, but for "wrong" reasons. I really don't care about reproducibility, learning what Flakes are, or ephemeral shells. All I want is one file that governs my whole system, with sane defaults for many services that I'd want to self-host, all without relying on Docker!
I've tried my luck with #Ansible and #pyinfra, but I've failed. I'm starting to see them as "Tailwind for Ops": You have to learn a non-standard language only to do stuff you could already do with a (de-facto) standard language (shell scripts). But, writing shell scripts is a hassle, too, just like applying changes on the server. And I will definitely forget where I've put what, or what technology governs which services.
The worst is probably user management. Creating system users, some of which should get subuids, other of which will run systemd units, chmod, sudo... I'm just tired of typing the same commands over and over. Adding a line to configuration.nix that will do the magic for me seems inviting.
Starting to learn how to use #testcontainers with #python for #pyinfra. It's an itch I had.
Been meaning to build up everything with pyinfra. But I need tests. In #ansible world, I had tests for everything using Molecule. It worked well enough, but was quite complex.
However, with pyinfra, the tests can be isolated integration test containers! 😎
Now I can go crazy with the amount of tests for every operation done. 😆
A small group of us are working on community level hosting of 'self-hosted' FOSS tools (think #NextCloud and more) setup as a local service offering for local grassroots organisations. We're seeking advice/tips/guidance.
We're keen to do some orchastration but want to avoid the complexity of say Kubernetes.
As a start we were looking at Ansible with Docker Swarm but we're now exploring other alternatives.
Anyone have experience at this sort of hobbist just a bit bigger than #HomeLab Ops scale?
#Pyinfra is being considered as an Ansible, in the projects words "Think ansible but Python instead of YAML, and a lot faster." (https://pyinfra.com)
Anyone have experience at this homelab/small hosting level? Would love any tips/suggestions for tools/approaches.
One source of inspiration is the 12Factor app methodology: https://12factor.net
Personally, as a rubyist I'm always keen to know what the ruby community is doing in this space also.
Haven't seen many others doing work at this scale, lets use the tag #CommunityHosting to keep connected :)
cc: @jadehopepunk @ryan @gilbert @bounding_star @steph @moxvallix @organvoid @teq
#CommunityHosting #Python #DevOps #ruby #RubyOnRails #SelfHosting #Orchastration #FOSS #OpenTofu #SelfHosting #SelfHosted