Ansible vs. custom made solution
The first disadvantage, Ansible being a push based system, can be mitigated by using ansible-pull. ansible-pull
pulls playbooks from a VCS repo and executes them for the local host
ansible-pull
could be triggered by cron or a startup script.
The second disadvantage of long running playbooks is sort of true. Ansible is not the fastest configuration management system on the market. However Ansible execution time can be reduced using mitogen and it is relatively easy to implement conditionals to skip parts of a playbook in order to speed up the play like this:
- name: Register a variable
ansible.builtin.shell: cat /etc/motd
register: motd_contents
- name: Use the variable in conditional statement to run long running play
include: otherplays.yaml
when: motd_contents.stdout.find('hi') != -1
If you write playbooks with execution time in mind it can be as fast as plain bash.
In general Ansible provides a lot of helpful tools to configure systems. There is probably nothing in Ansible which couldn't be implemented using something like Make
and Bash
. The advantage of Ansible over Bash is that a lot of people find it easier to work with and the code more readable.