Hacker Newsnew | past | comments | ask | show | jobs | submit | more BiteCode_dev's commentslogin

idempotence


Wisdom for ansible would be to ditch the dsl and expose a pure python declarative api, with imperative escape hatches and a set of best practices + conventions encouraged by templates anf linters.

Instead, we get a terrible dsl baked in a bad markup language that is hard to write, painful to debug and impossible to maintain.

That you have to come up with concepts like an inventory, fact and magic variables should have been your first clue that they were reinventing badly what any language ecosystems provides for free.

And the worst is, ansible is probably one if the best deployment systems at our disposal.


That's a hot take. In my experience Ansible is trivial to maintain and, due to the lack of better templating like Salt, ensures most playbooks look relatively similar as it's meant to be a simple, straight forward task runner. Onboarding folks into Ansible is a breeze as everything matches the standard (roles, tasks, group_vars, etc). It's dumb, reliable, and does exactly what it says on the tin.

My biggest complaint with Ansible is the execution aspect. The fact that mitogen hasn't become the standard strategy plugin and instead Ansible still opens an SSH connection per task is nuts.


My experience is that Ansible becomes exponentially more difficult with the difficulty of your workflows, where programmatic tends to be logarithmic. For low complexity tasks, Ansible is simpler and for high complexity tasks it gets more complicated.

Just as a random example, for complex group structures you have to know/remember that although Ansible allows nesting groups, groups are actually a flat structure. If you have prod.webservers and uat.webservers, the 'webservers' group will include members of both.

That's not hard to work around, but it can easily lead to situations where you end up deploying to prod even though you only intended to deploy to UAT.

Variables are kind of a mess too. Assuming the docs are authoritative, there are 22 different places that variables can come from and which one is used will depend on the precedence. At some point, a 'switch' or series of 'if-elif' statements start to sound much simpler.


RE: variables, I'm a heathen and set `hash_behaviour = merge`. This forces nested dict values to be merged instead of overwritten (lists cannot be merged, unlike Salt...). For whatever reason Ansible encourages users to not use this [1], which makes variable usage far more difficult than it should be IMO and leads to situations like you describe where folks have various top level variables for overrides (ssh:, ssh_local:, ssh_global:, etc to combine values).

[1] https://docs.ansible.com/ansible/latest/reference_appendices...


Oh wow, I've been working with ansible for a few years now, how have I not seen this before? I've even searched for it, but I didn't know what it was called, so...

Do you know if this behavior can be enabled per-role, or even better, per-task?


For context, I’ve written probably a million lines of Ansible and even maintain my own fork to add features like loopable blocks. I love it enough to curse its name.

Large Ansible code bases are painful to maintain. Roles don’t encapsulate well enough and the setting that makes their variables private is unusable if you need to “exports”/“outputs” and I guarantee you do, flow control isn’t powerful enough and you either supplement by dropping down to script/shell or by wring whole programs in Jinja, variables are so spooky action at a distance that you need an external tool to graph where they come from, vault variables aren’t greppable so good luck there, you can’t write a type checker because it’s all strings and any large codebase will dynamically generate variable names due to lack of expressiveness, you will desperately want a way to tell Ansible to eagerly evaluate some variables instead of keeping them as strings and find out how ugly the workaround is without your own patches, you eventually desperately wish you had the ability to evaluate filters and lookups on the target and might eventually, like me, write a plug-in for that. Your options for complex data transformations is writing 50 line filter pipelines with item.0 item.1 or dropping to python and just writing your own filter, you will also eventually desperately wish you could define new modules via “subroutines” by chaining a few trivial module invocations together and then find out that you must drop to an action plugins which expose all the underbelly of Ansible. You will pull your hair out getting Jinja to strip the whitespace from strings to get Ansible to recognize the results as an array since it’s all strings, you will find out that Ansible has its own string type that doesn’t play nice with str and that is somehow exposed to you in bog standard Ansible.

If Ansible was a Python library I would scream for joy at how much unnecessary complexity and necessary bullshit trivia I could drop from my brain.

> and instead Ansible still opens an SSH connection per task is nuts

Mitogen is not worth the bugs compared to using SSH ControlPersist.


Control persist still creates multiple SSH sessions though?

I have a SSH hook that sends a chat message whenever someone SSHs into a server, and Ansible without mitogen floods these, even with ControlPersist.

If you have it working, can you share your ansible.cfg?


Well yeah, because ControlPersist is just “make session creation fast” by multiplexing them over a single SSH tunnel. So you still have “ssh internal session creation” overhead but the tcp and ssh handshake is the slow part. The speed gap between pipelining with ControlPersist and Mitogen is small enough that it’s, to me, not worth the bugs and limitations of Mitogen.

I do get the annoyance of your script though.


Yeah after using CloudFormation, Terraform, Pulumi, AWS CDK and k8s + YAML, I'm convinced using a real programing language idiomatically is the correct way of doing IaC.

Many languages totally support declarative idioms out of the box (like you mention), there's no need to reinvent anything here.

In particular I'm a big fan of AWS CDK, although it only works for AWS. (Yes, I know about CDKTF, but it's buggy alpha software).


> ditch the dsl and expose a pure python declarative api, with imperative escape hatches and a set of best practices + conventions encouraged by templates anf linters.

Fully wholeheartedly agree but, as I stated in previous ocasions in this site, after the nightmares I've seen people, in many different places, doing with a high level tool like Ansible (and also Terraform), I apply heuristics about the probable outcome of every DevOps using a proper Turing-complete language as a general trend and I just want to leave CS and buy a hut in the middle of nowhere. Perhaps something like that must come after a shift in the mentality of the whole business where people in CS in general, assumes one needs to be a good coder, no matter if you do DevOps of software and therefore, learn about software design patterns, reusability and best coding practices.


The issue is that Ansible right now today is just Python but if you tied chopsticks to your fingers when typing. It’s not declarative, it’s sequentially evaluated with all the flow control and concurrency bugs to go with it.

You have to already be a good coder to write Ansible but you have all your limbs tied behind your back because you get none of the features of Python to help you reign in complexity and validate correctness.


The killer feature of Ansible vs. Python code is, noting I have a ton of both here for infrastructure related tasks (as well as shell, why not), when you have it running for three years on some box somewhere and something breaks, you go look at it for the first time in three years and it makes sense. My Python infrastructure tools OTOH, while they are great, if something goes wrong with them I have to spend half a day reading the sourcecode and remembering what their particular architcture / conventions are.

it's like the dumbness of Ansible is really the main feature it has.


I agree with you but I think that dumb + size => complicated which is where I live. When you have a playbook that is thousands of tasks long the dumbness leads to exactly the problem you have with Python.


I agree with that! my ansibles are for really straight stuff deployed to a few boxes. Where I work, oddly enough at Red Hat :), the very large playbooks are definitely difficult to work with. It's hard to say though if a custom Python app of similar size is really any better though, unless your developers are Michelangelo.


I've been very slowly rebuilding all our Ansible roles in PyInfra for that exact reason.


Also been going down this path. pyinfra is overlooked I think.

It's not perfect, I still feel like I'm dropping down to just hitting `server.shell` a bunch , but at least as a programmer first, it feels more comfortable vs the mountains of yaml (and doc searching) for Ansible.

On the whole it's a less frustrating experience. I still have a vague feeling that in my case - where each server(s) is generally customised per client and I've never felt comfortable just pointing ansible (or pyinfra) and a configured server and re-running it - that perhaps I would really just be better off with a bunch of shell scripts. I don't generally tear-down and throw-up multiple servers a day, week or even month.

rrconf sort of fills this but works off a bit more infrastructure than I want to manage with its different git repos per action.

[1] https://github.com/rrconf/rrconf


I understand where you are coming from. It's interesting to see the Puppet/Chef-debate played out over and over again.

You generally want an overarching single source of truth for IT systems. One that defined which parts a system contains and how it is set up. This starts to get important when you want maintainable testing environments, and more so as the number of system integration points grow, but it generally makes tracking changes and having a controlled deployment process so much easier.

So it is natural to start with a declaration of how small pieces fit together. This is Puppet/Ansible where the language is just a list of objects, where each object is implemented in "real" programming language. But the list soon needs logic, if not for other reasons than because testing environments have subtly different requirements, and the list grows into a semi-language.

That's not enough and people new to the system soon feels constrained, why not ditch that domain specific thing and implement the whole thing in the "real" language? This is Chef/Salt. But now all you have is another object, which needs an overarching list of objects, and soon we have another simple description for that.

And then we repeat this all over again.

(There are specific issues for some parts of this, which is not part of the above story. Ansible didn't have to choose yaml for their domain specific language, they should have seen that coming. But that's not for this story. We instead get to see this repeated again in the container space with templates and Helm charts. Also Jenkins pipelines which slowly mutates to Groovy and back.)


Pulumi could have filled this nicely but only supports a few cloud providers.



Wisdom for ansible would be to ditch ansible and any similar tool.


Funny how during the cold war everyone was criticical of russia for spying on all citizens. This was a symbol of how little freedom they had, that it was a proof that communism was leading to terrible dictatorships.

But our politicians seem to think that if we do it, it's to help people.

Unlike the ussr politicians of course, because they were evil.


Not to mention verifying evidence is very hard, manufacturing evidence can be cheap, and instutitions have a bad track record about evidences.

After 20 years of internet saving the lies of people forever, showing thousands of submarine articles, photoshopped pics and now deep faked materials, can we blame people?


Yes, imo - because they don't just mistrust - they randomly trust alternatives.

Mistrust is warranted, definitely. Trusting random sources that fit their heavy bias is something we should all be hyper aware of and fight. Yet we don't.


> Yes, imo - because they don't just mistrust - they randomly trust alternatives.

> Mistrust is warranted, definitely. Trusting random sources that fit their heavy bias is something we should all be hyper aware of and fight. Yet we don't.

Not exactly, IMHO mistrust is a two step process: 1. mistrust and 2. find alternatives to trust instead, in that order. I think 1 always starts first, through 2 can accelerate/reinforce it.

Mistrust puts one in an awkward, unsupported position in a world where things are way to complicated for one person to process, and it should be expected that it will take a long time for an individual to find an adequate replacement for institutions that have lost their trust (probably through trial-trusting other institutions then mistrusting them, too).


The view that we don't fight confirmation bias very much comports with my priors.


But that just fuels the fire.

See, when a person already has evidence that 'other' opinions cannot be trusted, due to the many things being talked about in this thread by GP; It gives credibility to the alternatives because they at least make sense to those people's confirmation bias.

Meanwhile, your own confirmation bias is being given credibility due to the things you believe to be true.

This is the truth of all information until proven as objective fact. Until proven as objective fact, anyone can claim your 'truth' is just subjective; and thus potentially and highly likely wrong.

And so it fuels the fire.

The only solution (AFAIK) to this is that everyone leave each other alone for a while and let them figure these things out for themselves by letting good ol father time teach us what is right and wrong. Time. It's one thing in the universe that might not be lying to us, at least all the time; unlike humans who can't stop lying in attempts to ego stroke over being right.


> The only solution to this is that everyone leave each other alone for a while and let them figure these things out for themselves by letting good ol father time teach us what is right and wrong. Time. It's one thing in the universe that might not be lying to us, at least all the time; unlike humans who can't stop lying in attempts to ego stroke over being right.

Man, i couldn't disagree more - about this actually working, that is. This seems to assume that with time we will progress. I have seen the opposite enough to believe that we can, but also can just as likely regress.

There are many out there that want to go back to removing rights from people based on skin tone, orientation, religion, gender, etc. Too frequently we reach a regression milestone that originally was projected to be the end of the regression, only to have us ramp up for the next regression milestone and fight over whether the next milestone is the end.

I have zero faith in humans ability to cope here. I'm not sure on the solution, but to me it feels like we have a series of radio broadcasts which purposefully brainwash us and our only inclination is to turn the volume up, and make sure the neighbor can hear it through our windows.

I am very, very pessimistic on our ability to dig out of this when we still willfully dug ourselves in to begin with.


father time? time by itself does not explain anything... is the new evidence that happens over time the one that teaches us. We are just doomed to a mostly monotonic growing time function. So we need action not that invitation to sit down and wait for the next time chunk to hit.


Well,

1. I never said it would happen quickly. Thing is, humans are rather impatient generally speaking. Especially when they think they are correct about something and must spread the enlightenment of their ego unto others.

Time, doesn't wait on us. We wait on it.

Here's an example: I play some MMO's now and then, and with the kind where people are fighting over territory in the game, all sorts of real world type politics ensue. Sure, it's just a game, but those are real people playing, meaning real brains doing things that they do; even in the real world. People who are actually morally upstanding act one way, and people who are actually terrible under their societal masks are... well... the other.

Sometimes you get to deal with drama that is absolute bullshit, where the people who are less than morally upstanding cast out a bunch of lies, mistruths, and royal stinkers.

What's the best way to deal with this? You just keep on doing what you do, provided it's not actually wrong, and leave them alone. What happens?

Well, in my experience, the rest of the actually morally decent and upstanding people take notice of this, and then go on to cast out the liar.

Now, you may want to say "But that's just a video game" or "That's just the internet".

But I disagree entirely to the ends of the earth. Humans are humans, no matter how or where they communicate. The only difference is that some have less inhibitions to do certain things, much like how alcohol affects them.

So the end result for me in these kinds of situations both IRL and online, is eventually people wise up. They eventually figure out that Manu40 isn't really the problem, and the real problem is the other asshole. (I say it that way, because I absolutely can be an asshole if I want to be.)

I've seen this sort of things play out with myself, and others, so many times; that I cannot agree with you. I can see where you come from though. Which brings me to #2.

2. Generally speaking, most of those problems you speak about in regards to rights, religion, race, gender, sex, orientations, etc, etc... most of these problems stem from people not leaving each other the F alone. These all stem from people being overly concerned, or angered by, or jealous of, or etc other feelings about other people.

I.E. If they just left each other alone, most things would be fine.

But humans don't like doing that, because again; ego. (And possibly a tinge of societal narcissism.)

You have zero faith in humans ability to cope; but might I ask you without seeming to be attacking you, if perhaps that might be part of the problem here.

You are not alone in your feelings, and so others act in a way to try to rectify each other in the guise of their opinions being holier than thou.

Do you see now why I say Time and leaving each other alone would help solve this problem?

I'm not saying it is going to resolve itself immediately or overnight in any way. It could take a long, long time. Weeks, months, even possibly years.

What I AM saying, is that so long as people are constantly getting up in each others face and shoving their opinions down each others ears and throats; none of this will get any better, until it gets bloody. And then, it could still be argued that it never got better; it's just the killers are all that's left over.

Not victors, killers. Because there is no victory in killing each other over opinions, and that's what this will turn into if people don't get over themselves, and leave each other the F alone.

I mean shit, I'm guilty of it right now too by even replying to you to potentially help have you see things from my point of view; and so are you in reverse.

Ideally, we'd all just stop typing and talking, and just mind our own damn business.

But that's hard, because like it or not; some of us are actually right, and yes you and I could be wrong right now. The solution could be something that neither of us have even thought of yet.

But that's still going to take TIME.


Which MMO? Sounds like Eve.


lol, I don't blame you for guessing that one, but no. I did have an account once upon a time ago, but I never went very far with it.

I speak of other games like New World and good ol ARK. I guess one might not consider these to be an MMO, but I do, since there are many players on many servers; though the numbers may vary.


Of course not, plus the last two decades included two bullshit wars (straight lies), an economic collapse where institutions lied, and hysteria over the severity of Covid on key demographics (masks, politicization, and lockdowns on non-critical demographics, e.g non-seniors).

And that’s just America (or the West). How anyone trusts foreign governments of the totalitarian type is something else entirely.


This is what drives me absolutely nuts whenever I read about current events. Pfizer had to pay the largest fine in US history for a fraud case, yet questioning their data (which we weren't allowed to see until they were sued) is forbidden. We spent decades destroying the middle east with the justification being based on lies, yet to question the motives of the US in the current war is to be a traitor. Fauci was the one in charge of the response to AIDS, which everyone seems to agree was horrendous, yet he's now a national hero.

I really struggle to understand how everyone can just go along with it all and forget about everything when the next thing starts.


> Fauci was the one in charge of the response to AIDS, which everyone seems to agree was horrendous, yet he's now a national hero.

That's a very self-serving argument cherry picking from history.

Fauci was initially hated by the AIDS activists in the 80s but worked to gain their trust. You also don't factor in the societal hate americans had towards the gay population preventing research towards a cure.

Here's an article that gives a detailed account of what it was like back in the 80's.

https://www.theatlantic.com/politics/archive/2011/06/the-her...


> Pfizer had to pay the largest fine in US history for a fraud case, yet questioning their data (which we weren't allowed to see until they were sued) is forbidden.

Questioning it is fine, and the data should be public.

But also note that Pfizer also has credibility because they have made a decently high ratio of non fraudulent claims since they have a history of making and selling medicines that work.


>"I really struggle to understand how everyone can just go along with it all and forget about everything when the next thing starts."

My worldview is that all of us are far more "in-the-present" than we realize. I sense most people want to help, want to conform with what is seen as serving the greater good, and are willing to follow the lead of what the group seems to be doing. Not only are we overloaded with information, if we aren't being reminded of what "the good guys" did in the past that was either wrong or hypocritical, we won't know to make a fuss of it. Same story with "the bad guys" having done good things in the past.

The most eye opening thing for me was seeing the American political left embrace Liz Cheney while the American political right disavowed her. That flip was unexpected, but it makes perfect sense when it comes to what is immediately expedient.


The architecte and the carpenter can be the same person on a small house, but I don't think it should on a big office building.


There is a lot of spam you don't see that affects you: bot rings that push topics in trending and lastest tweets that end up in your time line for example. Or voting bots that reinforce the outrage culture. Scam bots that prey on weak users in popular accounts (read any elo musk tweet responses for a sample). And bot oushing empty publication to hashtags that makes parsing it with a python script terrible.

Just because you don't see it doesn't mean it doesn't make the experience worst.


> bot rings that push topics in trending

I have a browser extension that hides trending topics, so I don't see that at all.

> tweets that end up in your time line for example

I just said that I use the reverse chronological timeline that only shows tweets from my follows.

> Or voting bots that reinforce the outrage culture.

"I'm vastly more annoyed by real humans who reply to me with insults."

> read any elo musk tweet responses for a sample

I've blocked that account.

> And bot oushing empty publication to hashtags

Why would you even read hashtags?

> Just because you don't see it doesn't mean it doesn't make the experience worst.

What I see on Twitter is my experience. It's largely your own choice what you see on Twitter.


So what your saying is that if you use twitter in a certain way, bots won't affect you much.

I agree, and I do the same as you.

But driving in a certain way to avoid pot holes should not be a good reason to avoid fixing the road.


> So what your saying is that if you use twitter in a certain way, bots won't affect you luch.

No, I'm saying that I doubt spam has much of an effect on the experience of most Twitter users. Email spam is probably much worse for most people.

[EDIT:]

1. I never mentioned ad blocking, so I'm not sure why 2 replies mentioned it. I mentioned blocking trends.

2. Even if you have trends, even if you have the algorithmic timeline, I think the replies greatly overestimate the effect of bots and spam on those. You don't see bot spam in the algorithmic timeline either. I also think "outrage culture" is mostly human culture, and we have plenty of genuine outrage even without any bots.

3. Even if you think (which I don't) that bots greatly affect the timeline and the trends, deemphasizing bot-like accounts in the timeline and trends is an alternative to suspending accounts. There's much less harm in algorithm adjustment than there is an account suspension, because false positive suspensions are very harmful to the account holder.


>most Twitter users

One level up you just described things you do (adblock, non-default settings, etc.). You're here chit-chatting on one of the more technical forums out there. I don't think you can, with a straight face, say that your experience is representative of most users.


Ok, that's the HN bubble right there. Trending tweets are seen by millions of users. Lastest timeline is not the default. Ad blockers are used by a minority of people.


As much as I want to agree with you, the default Twitter experience pushes so much pointless spam onto the user that I've given up using it multiple times. I've heard a lot of people cite their own 'systems' which I'm glad to hear work - but by default, Twitter's browsing experience is basically just Facebook with shorter messages.


Believing this is a normal/typical way of using twitter is one of the most neurotic things I’ve read on this forum


If you want to do that with firefox, use ublock origin, go in parameters, and activate the "easylist cookie".


I didn't consent, I use the DNT header. They ignore it. I ignore their banner and ude my right to reject tracking.


Firefox containers are amazing for this.


It solves one thing: it shows you who tracks you and what it tracks.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: