News for hackers. Stuff that matters.
Re:Show HN: Aviary.sh – A tiny Bash alternative to Ansible by tony on Thursday June 25, 2020 @02:39PM (#23643991)
If you like this - Fabric is awesome.

https://www.fabfile.org/

Use python over SSH. Super fast to begin, if you can ssh into the server, you can run the equivalent of shell commands (subprocess calls in python) remotely. With python, you can abstract and reuse, with the scriptability of bash, but higher level niceties of the language, libraries and toolchain (linting, formatting, autocompletion, imports).

Can it pull the latest version of your app, build it on your server? Yep. Restart daemons? Update libraries (npm, python, etc)? Update system packages? All work fine.

Can it configure a vanilla server from scratch? Yes, it's helpful to bring in a higher level reusable library like https://github.com/fabtools/fabtools helps with that.

When does it hit limitations? More complex orchestration where you have multiple servers (and variations of them) with configuration to talk to each other over networks. Eventually you get to the kind of setup where having a tool like Ansible / Salt / Puppet / etc. makes sense.

For a basic PHP/python/ruby/node site that's just running on a single cloud server? A declarative config manager would be overkill for me.

Re:Show HN: Aviary.sh – A tiny Bash alternative to Ansible by linuxftw on Thursday June 25, 2020 @03:13PM (#23644340)
> Use python over SSH. Super fast to begin, if you can ssh into the server, you can run the equivalent of shell commands (subprocess calls in python) remotely.

This literally describes ansible. In fact, ansible one-ups this because you can specify raw commands if python is not installed remotely [1].

Ansible provides lots of modules, you don't have to use any of them. I have plenty of 1-off ansible playbooks that I don't care about idempotency that are just a bunch of 'cmd' statements. It's a very flexible tool.

1: https://docs.ansible.com/ansible/latest/modules/raw_module.h...

Re:Show HN: Aviary.sh – A tiny Bash alternative to Ansible by maxmalysh on Thursday June 25, 2020 @04:43PM (#23645473)
Not really. Ansible is a complex DSL based on YAML. Fabric is really simple and uses real Python.
Re:Show HN: Aviary.sh – A tiny Bash alternative to Ansible by llama052 on Thursday June 25, 2020 @07:11PM (#23646836)
Can't say I've ever really thought of YAML as complex. Especially when the Ansible modules are translating things so you can just define the action you want to take, and each module is very well documented.
Re:Show HN: Aviary.sh – A tiny Bash alternative to Ansible by dnautics on Thursday June 25, 2020 @10:37PM (#23648143)
Embedding python in yaml has a ton of gotchas for cases where string processing doesn't quite line up with the way yaml wants things. Variable interpolation is also a real mess.
Re:Show HN: Aviary.sh – A tiny Bash alternative to Ansible by geerlingguy on Thursday June 25, 2020 @10:56PM (#23648233)
Typically the recommendation is to write your own python plugin/filter/test if you find yourself writing a lot of python in yaml, that way the yaml stays sane and readable, and just has some light Jinja.
Re:Show HN: Aviary.sh – A tiny Bash alternative to Ansible by muhmud on Friday June 26, 2020 @10:08PM (#23658954)
This is my main issue with Ansible: as soon as you run a single raw shell command, haven't the main benefits of Ansible just disappeared? And wouldn't it be likely that you'll probably need to do this pretty regularly?

Some of the modules seem pretty pointless as well, like the synchronize files one; why not just use rsync directly? And while you're at it, just SSH to servers from shell! Sure, you would need something similar to the inventory, but that wouldn't be too difficult to come up with...

I think investing time in building a library of idempotent shell scripts instead is the way to go personally.

Re:Show HN: Aviary.sh – A tiny Bash alternative to Ansible by curryst on Saturday June 27, 2020 @10:14AM (#23661954)
You can have your shell commands be idempotent. For instance, I have a number of places where I trigger a shell command only if an Ansible managed file changes.

It's only non-idempotent if the shell command runs every time, and the shell command itself isn't idempotent.

The reason for some of the "pointless" modules is that they integrate into Ansible better. I.e. for synchronize, you can run Ansible with the "--check" option, which won't change anything, but will report back what would be changed if you actually executed it. Running rsync in a shell command doesn't have that option because Ansible has no idea what that command does.

My bigger issue with Ansible is that the YAML is annoying. The looping behavior is frustrating, variable precedence is weird, IDE autocompletion is generally lacking. I wish they had designed a sane way to just write Python code.

Re:Show HN: Aviary.sh – A tiny Bash alternative to Ansible by Izkata on Friday June 26, 2020 @10:08AM (#23652119)
> In fact, ansible one-ups this because you can specify raw commands if python is not installed remotely

GP's description of fabric is slightly wrong - it's not python over ssh, it's ssh in python. You only need python locally, fabric runs shell commands remotely.

Re:Show HN: Aviary.sh – A tiny Bash alternative to Ansible by darkteflon on Thursday June 25, 2020 @05:17PM (#23645807)
What’s the status of the fabtools project? It supports up to Ubuntu 14.04 (as in, 2014) and has very little commit activity. Without fabtools, fabric operates at a much lower level of abstraction than Ansible.
Re:Show HN: Aviary.sh – A tiny Bash alternative to Ansible by strig on Thursday June 25, 2020 @05:01PM (#23645663)
I really hate that fabric got rid of roles in the new version. I want to be able to still do "fab task -R prod".
Re:Show HN: Aviary.sh – A tiny Bash alternative to Ansible by maxmalysh on Thursday June 25, 2020 @05:36PM (#23646019)
Try fab-classic:

https://github.com/ploxiln/fab-classic

We decided that migrating to Fabric 2.0 doesn't worth it.