News for hackers. Stuff that matters.
Re:Pyinfra: Automate Infrastructure Using Python by negus on Tuesday April 30, 2024 @12:40PM (#40213018)
As you can see here, the main question is what are the advantages over Ansible, a mature and the most popular agentless configuration management tool written in Python. So I propose putting this answer right to the landing page
Re:Pyinfra: Automate Infrastructure Using Python by Fizzadar on Tuesday April 30, 2024 @12:44PM (#40213058)
I think I tried to shy away from specifically being "Ansible does this bad so pyinfra does this" and instead focus on the features that differentiate like "Instant debugging with realtime stdin/stdout/stderr output (-vvv).". But it seems like that isn't enough and the landing page needs to be more explicit in comparison. Ty for the feedback!
Re:Pyinfra: Automate Infrastructure Using Python by gh02t on Tuesday April 30, 2024 @03:15PM (#40215030)
I applaud trying to be positive and focus on "this is what we do well," but yeah at least some explicit comparison would help. The copy right now is kind of assuming the reader already knows Ansible to compare against as a baseline. Which is probably fair for most people who find your project, but people who find your project are also probably not happy with Ansible and want to know if this addresses their pain points immediately.

Is very interesting though, I think I'm gonna try it myself.

Re:Pyinfra: Automate Infrastructure Using Python by Anarch157a on Tuesday April 30, 2024 @03:32PM (#40215252)
I like Ansible, but that doesn't mean thera are no pain points.

One of them is handling "if-this-then-that-else-that". Being purely declarative, Ansible is horrible at that.

Pyinfra can be used in imperative mode, am I right? This would make the use of if-else a breeze, which would be a really good reason for me to to switch.

Re:Pyinfra: Automate Infrastructure Using Python by tryauuum on Tuesday April 30, 2024 @04:56PM (#40216242)
Ansible is declarative?

In puppet and saltstack you can declare that a folder is empty and declare a specific file in this folder. The system's smart enough to delete all the files except the one.

To achieve such feat in ansible is hard. Easiest way is to have two tasks, one deletes everything and second recreates your file. Doesn't feel very declarative

Unrelated thing, they don't even try to be declarative in ansible E.g you can have a file with state "touch". It not a state if it updates each playbook run!

Re:Pyinfra: Automate Infrastructure Using Python by Anarch157a on Tuesday April 30, 2024 @08:32PM (#40218175)
You're confusing declarative with idempotent. Ansible is both, it won't change anything if the state is already what you declared. The nitpicked case you chose, you want the file to have the latest timestamp, this is a valid state to declare.
Re:Pyinfra: Automate Infrastructure Using Python by verdverm on Tuesday April 30, 2024 @10:36PM (#40218929)
The shell task breaks the declarative nature a bit, along with registering task results and then writing conditional whens based on them. Interpolating values based on the registered results does too imho
Re:Pyinfra: Automate Infrastructure Using Python by aflukasz on Wednesday May 01, 2024 @02:02AM (#40220031)
Plus, what your are declaring is often times not the state you desire but... action you want to take. Say you use `apt.name: [pkg1, pkg2]`, run it, then remove `pkg2` from the list. Running this again won't remove `pkg2` from your system. So it's declarative, but not necessarily on the optimal level all the times.
Re:Pyinfra: Automate Infrastructure Using Python by goodpoint on Wednesday May 01, 2024 @04:05AM (#40220720)
Ansible is neither.
Re:Pyinfra: Automate Infrastructure Using Python by otabdeveloper4 on Wednesday May 01, 2024 @05:24AM (#40221118)
Ansible tries to be declarative and idempotent, but fails at being both.
Re:Pyinfra: Automate Infrastructure Using Python by gtirloni on Wednesday May 01, 2024 @11:24AM (#40224596)
ansible-core succeeds pretty well in being both.

ansible modules (built-in and community) are a different matter. generally, quality will vary.

Re:Pyinfra: Automate Infrastructure Using Python by soraminazuki on Wednesday May 01, 2024 @10:50PM (#40232248)
Ansible is neither and it shows. For example, deleting a configuration in Ansible doesn't revert the system back to its original state. That's the definition of statefulness.
Re:Pyinfra: Automate Infrastructure Using Python by zaphirplane on Wednesday May 01, 2024 @06:42AM (#40221580)
You can use Rsync to to a puppet created folder You’d need to have a source folder with the file which is fine
Re:Pyinfra: Automate Infrastructure Using Python by mrweasel on Wednesday May 01, 2024 @02:09PM (#40226964)
There's a lot of cases where Puppet fails on something similar. Packages is probably the easiest example. Puppet won't remove all package not explicitly declared, nor will it remove files it created, if you remove the Puppet code for managing that file.

I'm fairly sure that the way to make Puppet do what you suggest is the same in Puppet and Ansible. The difference is that Puppet is smart enough to not actually remove you file during every run (I think). On the other hand, Ansible will normally not be configured to run every 30 minutes like Puppet, so it's much less of an issue.

Both tools are great but they work some what differently. How you think about using them is much the same though, you need to tell the computer what to do. In Puppet this is often talked about is if you describe the state, I suppose that's partly true, but in the end you have a series of actions the computer will need to take to achieve this state.

Re:Pyinfra: Automate Infrastructure Using Python by emmelaich on Thursday May 02, 2024 @03:59AM (#40233788)
rsync covers this and should ne used instead of a lot of Ansible tasks
Re:Pyinfra: Automate Infrastructure Using Python by verdverm on Tuesday April 30, 2024 @10:33PM (#40218920)
There's definitely a trend in this direction.

Pulumi for Terraform and Dagger for Docker are two examples I use

I like CUE as a language to replace my Yaml that has some of the typical language constructs but maintains the declarative approach

Re:Pyinfra: Automate Infrastructure Using Python by erikbye on Tuesday April 30, 2024 @02:27PM (#40214413)
Is performance better than Ansible? I have used Ansible extensively and find it excruciatingly slow.
Re:Pyinfra: Automate Infrastructure Using Python by helsinki on Tuesday April 30, 2024 @02:29PM (#40214431)
Excruciatingly slow is an understatement :)
Re:Pyinfra: Automate Infrastructure Using Python by surfingdino on Tuesday April 30, 2024 @03:10PM (#40214967)
Why being slow is a bad thing? Ansible gives me a legitimate excuse to have proper lunch. ;-)
Re:Pyinfra: Automate Infrastructure Using Python by verdverm on Tuesday April 30, 2024 @10:38PM (#40218940)
You're supposed to be writing compilers during that time
Re:Pyinfra: Automate Infrastructure Using Python by Fizzadar on Tuesday April 30, 2024 @02:48PM (#40214691)
Re:Pyinfra: Automate Infrastructure Using Python by mxuribe on Tuesday April 30, 2024 @03:52PM (#40215508)
Hi @Fizzadar and congrats on making this and getting it out the door; kudos!

As you craft your "Why this and not Ansible" content, you might actually state clearly what you already noted on the Performance page, namely: "One of the reasons pyinfra was started was performance of agent-less tools at the time." If I read that, it'd instantly make me want to stick around and read some more, play with pyinfra, etc. BTW, i will be playing with it anyway, but just wanted to point out that you likely won;t need to start from scratch for copy (on a comparison or answering "Why this and not Ansible" content). Cheers!

Re:Pyinfra: Automate Infrastructure Using Python by ShakataGaNai on Wednesday May 01, 2024 @12:00AM (#40219376)
That would be appreciated. I saw the homepage and my first thought was "Ansible is python. How are these things different?" Obviously pure python vs yaml is one thing. But beyond that it's not clear. Perhaps are specific use cases in your mind where one or the other is a better fit, and that would be helpful as well.
Re:Pyinfra: Automate Infrastructure Using Python by ransom1538 on Wednesday May 01, 2024 @09:39PM (#40231854)
Stupid question. Ansible is mentioned TWO times in HN hiring thread, it will soon be zero. Isn't this dated tech? Ansible is good at patching servers (have cute names, make sure they are patched). Patching??? But, why not use containers? Aren't we moving away from Ansible/Puppet? I would much rather have AWS/CDK or pythoninfra like this if I was into pet machines.
Re:Pyinfra: Automate Infrastructure Using Python by jethro_tell on Thursday May 02, 2024 @04:01AM (#40233799)
Someone somewhere has to set up machines so you can do containers. Doesn't name an they are pets.
Re:Pyinfra: Automate Infrastructure Using Python by ransom1538 on Friday May 03, 2024 @07:59AM (#40246675)
You mean terraform?
Re:Pyinfra: Automate Infrastructure Using Python by jethro_tell on Saturday May 04, 2024 @10:40PM (#40261887)
No, before terraform, someone has to boot a machine and slap an image on it or do an OS install, Register the host in some way and have it checking for the terraform.

I use ansible for creating machine images or initial provisioning. (I don't run the ansible, someone racks the host, sets it's build state to install, and boots the host and it joins the appropriate cluster and people do container things. I don't necessarily know when my ansible runs against a host.

I also have a pretty good stack of ansible playbooks that I use manually day to day for hardware validation for new server models and one off type stuff. But again, I never really know what I'm running against or have pet servers.

A good chunk of hardware validation runs automatically if the boot target is set to hw-validate, but the whole point is that you are gonna find stuff that doesn't work with your standard process and either pass on it or adjust.

I do run tf to provision cloud infra so its transparent to the devs, and, honestly, not sure how ansible is dated and tf is not, they are pretty much the same thing in a different coat.

And honestly, generating thousands of lines of conflicting generic yaml isn't really much of an improvement over writing it once and running it automatically on 1000s of boxes.