r/linuxadmin • • Aug 21 '26

Ansible can be a very elaborate way of avoiding SSH

I like Ansible. It’s useful.

But I’ve definitely seen small environments where the playbooks became more complicated than the thing they were originally automating. At some point you’re maintaining roles, variables, inventories and handlers just to make a change that would have taken two commands.

Automation is great when it removes work. It’s less great when you create a new system that needs maintaining instead.

0 Upvotes

28 comments sorted by

37

u/automounter Aug 21 '26

Sounds like you don't ansible enough.

15

u/Vuiz Aug 21 '26

At some point you’re maintaining roles, variables, inventories and handlers just to make a change that would have taken two commands.

Speed is a by-product of consistency, not necessarily the goal.

5

u/much_longer_username Aug 21 '26

If it happens to be fast, that's awesome, because I don't like waiting - but I'm not particularly concerned about it. Getting it right the first time, the second time, and every time after that, that I care about.

20

u/Skuelysten Aug 21 '26

Sounds like you are doing something wrong

3

u/za72 Aug 21 '26

that's how most new solutions are invented...

14

u/chock-a-block Aug 21 '26 edited Aug 29 '26

Distinct oil rustic coherent acorn thought water wakeful yarn

This post was anonymized with Redact

-1

u/BarracudaDefiant4702 Aug 21 '26 edited Aug 21 '26

I have a ssh wrapper for that. I actually find it easier then ansible to change 100 or 1000 machines. Ansible is relatively slow to push out to 100 machines. It has some good points, but it is over rated. It's a useful tool, but I agree with the OP that it's not always the best tool (sometimes it is).

1

u/kai_ekael Aug 25 '26

Okay, now test your wrapper on one machine, then change the target list and repeat the exact same on 99 other machines.

Right.

1

u/BarracudaDefiant4702 Aug 25 '26 edited Aug 25 '26

Right, super easy work flow. My wrapper accepts groups from a dynamic inventory database so I can specify a group (with a + sign after group name) for those 100 machines instead, or you can always list them out. Much faster and easier then ansible for one-offs. It also has a tmux option that will run the commands in parallel in their own tmux window so you can have a tile of 10x10 sessions if you want.

5

u/jdptechnc Aug 21 '26

Ansible is not a script.

3

u/Dingdongmycatisgone Aug 21 '26

Yes, sometimes manually is better if it's on a very small amount of systems. I manage over 200. I love Ansible lol.

I love the roles, playbooks, nested playbooks, and the integrations. If it's hard for you to manage by itself, try integrating it with other things like GitHub to manage changes, AAP for easier playbook and inventory management, and vscode for easier editing and searching through Ansible files.

If you don't see the value in the automation then maybe you don't manage enough servers for it to be valuable for you.

2

u/stprnn Aug 21 '26

I had the same feeling when I had to use it but I'm also not an admin anymore so...

2

u/EverythingsBroken82 Aug 21 '26

i wish there would be a way to hook ansible calls and outputs totally into a remote log environment. like when i have a certain ansible parameter or conf file, that every output goes immediately to another server. that would be so useful, but you have to build something for this which is brittle and not good maintainable.

2

u/Angelsomething Aug 21 '26

I don’t understand why you’re saying you would have to maintain roles (plural) and inventories if you environment is fairly stable. Fair point on the variables maintenance, but that’s the only thing you’re editing depending on what it that you’re changing.

Two commands on one host should not require the use of ansible, but the same two commands on 20? absolutely.

I don’t know how you’d do infrastructure as code without ansible to be honest.

2

u/Envelope_Torture Aug 21 '26

Of course the playbooks are more complicated. This is like complaining that the factory that pumps out cars is too complicated, and retooling it takes too long when you can just "drill two new holes" in every car that comes off the line.

1

u/Scill77 Aug 22 '26

Sound like you need puppet.

1

u/SeaworthinessHour233 Aug 22 '26

I guess your Ansible code base needs refactoring

1

u/thoriumbr Aug 21 '26

Ansible is not made for automation, that's the side effect. It's for consistency.

When you have a large park of servers, you don't want to have to think on every single configuration change where the backups will be, what will be changed, what are the tests and everything else. You want to run one process and the process gives you all you need.

If you just SSH into the server, it will be less work now, but 6 months down the line you don't know with all certainty what was done, so if you are to execute the same change, you may do different things.

With Ansible you write a playbook, run it, and it will always do the same thing. You will have to keep the servers in a consistent state, use image templates, and don't do things by hand anymore, and that increases the consistency of the entire infrastructure.

1

u/Hotshot55 Aug 21 '26

Ansible is not made for automation, that's the side effect.

That's a wild statement there.

2

u/much_longer_username Aug 21 '26

The phrasing is awkward, but I think their intended meaning is clear enough - automation is the mechanism by which Ansible accomplishes its goals, not the goal in and of itself.

1

u/Hotshot55 Aug 21 '26

What exactly do you think the goal of Ansible is if it's not automation?

Even Michael DeHann, the guy who created Ansible, calls it automation software.

2

u/much_longer_username Aug 21 '26

The goal is consistency and reproducibility, which is accomplished via automation. There's a nuance to the distinction that makes arguing it feel kind of pedantic, and I do agree with you that it is in fact automation software, but I also get what people mean when they make the distinction. If all you wanted was a series of automated actions, 'ssh and run this bash script' had that covered decades ago. Ansible is much more than that.

1

u/waptaff Aug 21 '26

It's a means to achieve consistent, coherent and documented server setups. It is useful even for a single server.

1

u/Hotshot55 Aug 21 '26

Does it really avoid ssh when it is using ssh by default?

12

u/_N0K0 Aug 21 '26

You are completely ignoring that by running two commands you have no change log or understanding of what the intended state might be. What if those two commands in turn conflict with a playbook somewhere else? Kill your pets and assume ssh access leads to undue drift