Live data from Hacker News

Show HN: Welder – set up your Linux server with plain shell scripts

github.com

31–40 of 71 posts

Re: Show HN: Welder – set up your Linux server with plain shell scripts

#31
post #22

Author claims all 90% of the time all they need is a single shell script. Then shows an example directory structure that mostly reminds me of Ansible. How is Welder different from Ansible, except bash vs python?

My experience with Ansible is that I have to write a dozen lines of yaml just to ensure permissions on a bunch of files. (But Puppet and Chef scare me even more.) The tools in this space feel like very thick abstractions on top of commands and configs you have to understand any way, to get the results you want. The console output Ansible produces is also truly horrible. Instead, I now maintain a single shell script f…

> The tools in this space feel like very thick abstractions on top of commands and configs you have to understand any way, to get the results you want.

It does, thats kind of the point in my mind. All I have to learn is the reasonably thin configuration management on top of normal stuff.

Re: Show HN: Welder – set up your Linux server with plain shell scripts

#34
I used to bootstrap a lot of VMs in development using shell scripts [1]. At a certain point Bash scripts become unmanageable. Ansible, Chef, Puppet have stricter syntax, battle-tested modules, large communities, proper multi-OS support, etc. Investing time to learn any of those tools certainly pays off in the long run.

Bash is great for a quick setup or a one-off instance. However it requires discipline for anything more. You are also dealing with the underlying OS yourself (e.g., Nginx is packaged and configured differently in Ubuntu, Debian, Cent OS & Arch; networking is configured differently in Ubuntu depending on whether systemd is installed, etc.).

[1] https://github.com/StanAngeloff/vagrant-shell-scripts

Re: Show HN: Welder – set up your Linux server with plain shell scripts

#35
post #32

Honestly, I find ansible quite simple and straight forward. You don't have to use third party playbooks and using 'autoenv' I achieved a very straight forward, simple, dynamic setup.

Agree - not sure what the advantage is. I understand bootstrapping can be a minor irritation (and I dont have a great way to do it 100% auto)

Dynamic inventory scripts + ansible-playbook -k -u root ....

can do the same thing for bootstrapping.

How is this an advantage over that?

Re: Show HN: Welder – set up your Linux server with plain shell scripts

#36

I came from setup shell scripts (especially running in the postinstall step of debian-installer) to Ansible, and I think the big win with Ansible is at least the ideal of idempotency. That's a lot harder to achieve with plain shell scripts, unless you're pretty disciplined about only performing mutations to your system that are themselves idempotent (like a package install).

I wrote a small book on the shell, and I have no idea why anyone would prefer Bash as a scripting language. Or as a shell interpreter, for that matter. Sometimes one lacks alternatives, and sometimes the Bash version of some task is too simple not to use.

I feel like there's a cadre of developers who used Bash, Perl, and Unix in the mid-90s - early naughties, to excellent effect, but have resisted learning anything else since, in the mistaken belief that these tools were appropriate solutions to all classes of problem.

And not to say that shell scripts are bad, just that the range of tasks for which they are best suited is far more restrictive then people seem to think. A friend surprised me by saying that Bash was an essential part of his genetics research, and after being initially shocked, the idea made rather a lot of sense: genetic data is semi-structured text, and much of his work involved transforming the output of one program to the input of another. Outside of such applications, I view the use of Bash as non-optimal at best.

Re: Show HN: Welder – set up your Linux server with plain shell scripts

#38
post #3

Earlier quoted context omitted.

Is Ansible really too much though, as the author suggests in README for simple tasks? If all you want is basic "SSH to a server, install some packages" type behavior, I'd still make the argument Ansible is simpler than this. Ansible isn't like Chef/other competitors where you have to bootstrap or install a client on the target machine. IIRC it only really needs SSH access and a Python installation present on the targ…

There's also a learning curve case to be made against Ansible: if you've spent years polishing your Bash and coreutils one liners, you start over at zero when switching to Ansible. Ansible is also declarative (in principle) while shell scripts are imperative, which is a bit of mind bender. Then, when you debug, you have to understand that Ansible is implemented by imperative code.

The same could be said for some NIH tool.

Bringing people up to speed on in-house tools can be a major hassle. Never mind the fact that popular tools like Ansible are battle-tested and most likely has more documentations and tutorials.

Re: Show HN: Welder – set up your Linux server with plain shell scripts

#39
post #3

I was about to make the point about Ansible but I guess you've already made it in the README.

Is Ansible really too much though, as the author suggests in README for simple tasks? If all you want is basic "SSH to a server, install some packages" type behavior, I'd still make the argument Ansible is simpler than this. Ansible isn't like Chef/other competitors where you have to bootstrap or install a client on the target machine. IIRC it only really needs SSH access and a Python installation present on the targ…

> IIRC it only really needs SSH access and a Python installation present on the target machine

Which for my FreeBSD machines I have to run some bootstrap code that installs Python on it before I can run ansible against it.

Would be nice if salt-ssh or ansible allowed me to have some bootstrap code that ran if Python didn't exist on the target machine.

Re: Show HN: Welder – set up your Linux server with plain shell scripts

#40

Earlier quoted context omitted.

Stupid question, but why are Ansible playbooks supposed to be "more idempotent" than plain shell scripts? Due to taking over a project I had to deep dive into it pretty quickly and to me it feels like shell in yaml syntax.

As you get into more complicated setups, it certainly requires discipline, eg: https://ryaneschinger.com/blog/ensuring-command-module-task-... But as long as you're careful about coupling operations like lineinfile with checks for the line already being there and so on, you can achieve it (and Ansible certainly makes this much easier than shells scripts do).

Sometimes the way you achieve idempotency feels like hacks, like when you have to ignore errors, always consider a task unchanged, stat files then test if the stat found anything, etc. But in the end I look at what I've accomplished, and if I'd done it in shell scripts most of the code would be boilerplate and it would be unmaintainable. Which makes the times when it's less than good totally worth it.
Post reply on HN