Hacker News new | ask | show | jobs
by proxysna 398 days ago
ansible my_servers -m shell -a 'fortune && reboot' -b

I know it is easy to be a hater, but sincerely do not see a reason to use something like that over Ansible or just pure sh, ssh and scp. All you have to do is to set up keys and the inventory. Takes 10 minutes, even if you are doing it for the first time. And you can expand it if you need it.

5 comments

I use pssh often (not this tool, but as I understand is similar).

The reasons I find it over Ansible are:

- takes the same syntax and options as plain SSH, just run over multiple hosts. So if you already know SSH, you know how to use pssh that is an extension of the command. Ansible requires to study it. The configuration format is trivial, just a file that contains on each line one host, no need to study complex formats like Ansible

- doesn't require dependencies on the target machine. Ansible, as far as I know, requires a python3 installation on the target machine. Something that, for example, is not granted in all settings (e.g. embedded devices, that are not strictly GNU/Linux machines, for example consider a lot of network devices that espose an SSH server, like Microtik devices, with PSSH is possible to configure them in batch), or in some settings you maybe need to work on legacy machines that have an outdated python version.

- sometimes simpler tool that just do one thing are just better. Especially for tools like pssh that are to me like a swiss army knife, the kind of tool that you use obviously when you are bodging something up to make something work because you are in an hurry and saves your day

Of course if you already use Ansible to manage your infrastructure you may as well use it to run a simple command. But if you have to run a command on some devices, that were not previously setup for Ansible, and devices trough which you may not have a lot of control (e.g. a bunch of embedded devices of some sort), pssh is a tool that can come handy.

For clarity Ansible does allow to run commands on a target host without Python installed using the raw module

I do agree with your point, sometimes it's just easier to use native tools or simple wrappers around native tools. Use whatever makes your job easier

Ansible is one of the best examples of needless complexity I’ve ever interacted with.
Ansible is the easiest tool for configuration management to onboard and start using. Great documentation, large community. It is as complex as you want it to be and it's complexity scales with your infra. ofc YMMV.
I disagree. It requires to know Python, YAML, Jinja2, own set of commands. It requires careful developing of playbooks. It is slow. It is complicated for non-standard cases where you don't have ready for using modules.

Is there a better approach? I think yes. This is Pyinfra - just pure Python, no additional DSLs. Also for configuration there is Terraform (but there are also some limitations).

I know ansible or even custom shell scripts are way better and optimized for such use cases. However, I just wanted to show something I built that might be useful to someone.
My comparison is most likely unfair because i am looking at it through a distorted lens of running all sorts of configuration management in production or at home for years. So i might be the wrong person to make judgement on it and just being a hater for no good reason.
Ansible requires python to be installed on all of the target computers.
That's not necessarily true. There is the raw module that executes a bare command. https://docs.ansible.com/ansible/latest/collections/ansible/...
Yeah, but at that point you've lost a lot of the benefits to using ansible.
Ansible uses this module to configure devices where it is impossible to install python, like network devices, which is one of ansible's big strengths.
are there any linux distributions which don't require python installed, other than embedded?
OpenSUSE, Fedora/RHEL, Gentoo, and probably Debian (and derivatives of all of the above) have it by default, but Alpine and Arch don't appear to.
Yes.
Ansible doesn't work on windows.

Stop assuming your method works across the universe of edge cases.

Ansible server does not work on windows, yes, but you can configure windows hosts with Ansible out of the box.
I mean, Ansible isn't the best choice for Windows configuration, I would agree, but you're not strictly correct: https://docs.ansible.com/ansible/latest/os_guide/windows_usa...