3 ms·
Ansible, for me, is the better bash. Anytime I would typically be reaching for a shell script of medium to long length, it's typically easier to maintain in An
by spicyusername 4y ago
Ansible, for me, is the better bash.
Anytime I would typically be reaching for a shell script of medium to long length, it's typically easier to maintain in Ansible.
But, if I find my Ansible is getting rather long, I need to do things more complicated than simple loops, or there isn't an Ansible primitive to interact with the system I'm working with... time to start reaching for an actual programming language like Python or Go.
- kbrannigan 4y agoHave you figured out how to use ansible with virtualenv and Django? - create virtual env - activate and install pip packages - run command using that environment
- GorsyGentle 4y agoYes, this is 100% possible with the core ansible toolkit. I don't have a copy of any of our playbooks on this as I'm at home and it's late. But it's basically just a couple of tasks. Check out `ansible.builtin.pip` to setup and install the virtualenv and then just call `ansible.builtin.command` to run it explicitly. Implicit use of the venv can be accomplished via common task argument `env` which also lets one fiddle with PATH.
- mongol 4y agoI don't like it much at all. I see the value of idempotency and so on, but it is a terrible "language" shoehorned into yaml. I am now migrating my home Ansible scripts to Nix and I won't look back.
- brightball 4y agoThis has been my experience as well. I gravitated to Ansible because it was language independent, simple to translate line-by-line scripts and didn't require an on server agent to work. Knowing that I could invest into Ansible and take it with me anywhere that I had SSH access was very motivating. It's not perfect, but it's so much better than my previous experiences that I won't complain about the pain points too loudly.