News for hackers. Stuff that matters.
Re:Every Sufficiently Advanced Configuration Language Is Wrong by tryptophan on Friday June 24, 2022 @10:12PM (#31871811)
I wish Ansible was just a python API. Past a certain point it would be much simpler.

"Its supposed to be state and not a procedure" is BS in my experience. When you need to do IFs, load vars, do things in order anyways...it stops being a state declaration.

Re:Every Sufficiently Advanced Configuration Language Is Wrong by zach_garwood on Saturday June 25, 2022 @12:20AM (#31872587)
Check out pyinfra: https://pyinfra.com/

I've been been using it for a couple personal projects, and I really like it.

Re:Every Sufficiently Advanced Configuration Language Is Wrong by bvrmn on Saturday June 25, 2022 @02:31AM (#31873060)
I've tried to move large ansible playbooks to pyinfra and there is no any benefit in the end. pyinfra is also "state"-oriented and for complex cases with logic you have to perform some acrobatics. IMHO switch resulted in the same mess as ansible playbooks.

Note: I am python-fanatic with 15y experience.

Re:Every Sufficiently Advanced Configuration Language Is Wrong by ameixaseca on Saturday June 25, 2022 @02:28PM (#31877542)
What do you mean by "state-oriented"?

Also: complex cases will likely result in complex code. Do you have a viable alternative for this?

Re:Every Sufficiently Advanced Configuration Language Is Wrong by bvrmn on Sunday June 26, 2022 @03:05AM (#31881797)
https://docs.pyinfra.com/en/2.x/getting-started.html#state-d...

> Do you have a viable alternative for this?

My imperative Fabric 1k line deploy scripts in the past allowed to encapsulate complexity because I had remote state on hands.

Re:Every Sufficiently Advanced Configuration Language Is Wrong by athorax on Friday June 24, 2022 @11:47PM (#31872402)
That is exactly what it is though. The Ansible CLI is just a client of that API. You can easily interface with the library itself in python
Re:Every Sufficiently Advanced Configuration Language Is Wrong by bvrmn on Saturday June 25, 2022 @02:37AM (#31873086)
AFAIK Ansible core operates in terms of tasks and plays. The only API it provides is how to construct a list of tasks and how to execute it. One has no remote state/vars at the construction time and has to use "when" or shell logic at execution time as in YAML.
Re:Every Sufficiently Advanced Configuration Language Is Wrong by kevincox on Saturday June 25, 2022 @06:50AM (#31874190)
I feel the same way. I feel that I am basically writing shell scripts, but in YAML (and a nice library of idempotent functions). I think Python or she'll would be superior. And if your tool is inferior to shell scripts you are really doing something wrong.
Re:Every Sufficiently Advanced Configuration Language Is Wrong by 7sigma on Saturday June 25, 2022 @03:23PM (#31877961)