4 ms·
I would encourage you to start by learning Ansible's yaml syntax, which really goes a long way and which represents a lot of best practices in the devops world,
by loevborg 11y ago
I would encourage you to start by learning Ansible's yaml syntax, which really goes a long way and which represents a lot of best practices in the devops world, such as immutability, configurability and config file templating. I have yet to run into a situation where I had to reach for python, calling the API directly or even extending ansible itself.
However, sometimes you may want to mix local actions (say, spin up ec2 instances) and remote actions (provision said ec2 instances). In these cases, a simple wrapper bash or python script to combine these has proven helpful.
- fideloper 11y agoThis has been my use case. We spin up a lot of trial servers on aws for customers, each with some unique data. I've written Python to call Ansible (1.9) programmatically, which was a fun challenge, even if possibly more work than was needed: https://serversforhackers.com/running-ansible-programmatically https://serversforhackers.com/running-ansible-programmatical... Ansible 2 changes a lot of that, so a followup for how-to in Ansible 2 is in order eventually.
- href 11y agoWe wrote our own Api wrapper to run Ansible commands on our infrastructure. It aims to encapsulate all the complicated bits. Maybe this is of interest to you: https://github.com/seantis/suitable https://github.com/seantis/suitable We use Puppet mainly, but depend on Ansible for updates, migrations and other things where we want to control the transition, not just the end state.
- senorsmile 11y agoThis is actually pretty neat. Thanks for posting.
- fideloper 11y agoThanks, I'll definitely give that a look!