Live data from Hacker News

PyInfra 3.8.0

github.com

31–40 of 110 posts

Re: PyInfra 3.8.0

#31
This looks great! pyinfra will integrate better with my other code, and installing it with uv fits my workflow better. Thanks for the post. I'll give it a try. I think some of my Caprover initialization tasks could also be handled by pyinfra.

Re: PyInfra 3.8.0

#32
post #29

This reminds me of Nortel Command Console back in 2000-2005! I worked for a telco company that had a lot of Nortel Passport devices (does anyone know what Frame Relay is?). We started changing the network from Nortel to Cisco. Cisco used telnet (later SSH), but Nortel people were extremelly reluctant to switch. Turns out the Nortel network managment system (nortel nms) had a very interesting feature: you could open t…

We had lectures on Frame Relay and stuff like that in uni, but I’ve never ever touched that stuff (:

Re: PyInfra 3.8.0

#33
post #5

Has anyone used this and ansible and is able to give a short comparison with likes and dislikes?

I switched from Ansible to Pyinfra for my homelab, and continue to use Ansible at work. The biggest difference is that Pyinfra is simply Python code. It's incredibly easy to control the system in whatever manner you need to. You can probably do the same thing in Ansible, but it's never quite as obvious how to do it. This also means it's much more clear where and why things work the way they do in Pyinfra, where in An…

The worst part of Ansible is data manipulation, what would be an easy dictionary operation in Python is a huge mix of lookups in Ansible.

Incredibly frustrating that the data you want is right there but you can't easily grab it.

Re: PyInfra 3.8.0

#34
post #5

Has anyone used this and ansible and is able to give a short comparison with likes and dislikes?

I used ansible for building simple logging appliance (something like Elasticsearch + Dashboards + other tooling) and I found it very difficult to reason with specifically python code snippets within YAML.

Switched to Pyinfra and the difference is day and night. You write python code you can organise your stuff into functions, classes and whatever you like and then instantiate them as you like. Highly reusable configuration.

You have full pwoer such as you can call boto to fetch the list of servers to target, filter base on tags and what not. Only sky is the limit because it is NOT a DSL (or YAML) rather full blow real python.

Re: PyInfra 3.8.0

#35

Earlier quoted context omitted.

I switched from Ansible to Pyinfra for my homelab, and continue to use Ansible at work. The biggest difference is that Pyinfra is simply Python code. It's incredibly easy to control the system in whatever manner you need to. You can probably do the same thing in Ansible, but it's never quite as obvious how to do it. This also means it's much more clear where and why things work the way they do in Pyinfra, where in An…

The worst part of Ansible is data manipulation, what would be an easy dictionary operation in Python is a huge mix of lookups in Ansible. Incredibly frustrating that the data you want is right there but you can't easily grab it.

If Jinja templating for data manipulation gets too complex or inconvenient, you can create your own module in ansible and use python code for data manipulation. But at this point you are better served with plain python which I think is where pyinfra should shine. I want to take a look though at how hard it is to implement your own module for it.

Re: PyInfra 3.8.0

#36
Never heard of this before. In looking through docs, honestly it looks like Ansible, but for people who don’t know Ansible, and with way more footguns. The fact that you can import any existing Python library means you’re now relying on those libraries to not introduce bugs, or throw an exception in the middle of an operation, etc.

I despise YAML, but I can appreciate that it makes it harder to introduce imperative logic, and it forces you to stay on the paved path - which is very well-tested.

Re: PyInfra 3.8.0

#37
See lots of comparisons to Ansible but Chef/puppet (both of which have agent-less modes) in Python instead of Ruby is what immediately came to mind. I guess Salt as well technically.

Re: PyInfra 3.8.0

#38

Earlier quoted context omitted.

The worst part of Ansible is data manipulation, what would be an easy dictionary operation in Python is a huge mix of lookups in Ansible. Incredibly frustrating that the data you want is right there but you can't easily grab it.

If Jinja templating for data manipulation gets too complex or inconvenient, you can create your own module in ansible and use python code for data manipulation. But at this point you are better served with plain python which I think is where pyinfra should shine. I want to take a look though at how hard it is to implement your own module for it.

If you're doing data manipulation with server state, you would probably want to create a Fact[0]. This is a straightforward Python class.

If you're doing data manipulation locally you would simply write Python code.

Operations[1] are Python functions which execute (yield) commands which will be run on hosts.

That's the gist of what it takes to write custom modules for Pyinfra.

[0] https://docs.pyinfra.com/en/3.x/api/facts.html [1] https://docs.pyinfra.com/en/3.x/api/operations.html

Re: PyInfra 3.8.0

#39

Earlier quoted context omitted.

This is spam - btw this is the first spam I have ever come across on hacker news

FWIW, if you turn on "showdead", there is a ton of spam on HN. The mods are just really good.

Showdead is quite a disheartening experience - there’s just so much LLM generated crap. The dead internet theory doesn’t feel as fringe as it once did.

Re: PyInfra 3.8.0

#40
How does this compare to Salt Stack?

“Built on Python, Salt is an event-driven automation tool and framework to deploy, configure, and manage complex IT systems. Use Salt to automate common infrastructure administration tasks and ensure that all the components of your infrastructure are operating in a consistent desired state.”

https://docs.saltproject.io/en/latest/topics/about_salt_proj...

Post reply on HN