I have an Ansible playbook for establishing LAMP environments on remote machines.
Part of this playbook deals with installing Composer:
- name: Install Composer get_url: url: https://getcomposer.org/installer dest: /tmp/composer-setup.php command: php /tmp/composer-setup.php --install-dir=/usr/local/bin --filename=composer
Instead these 5-lines structure I was thinking of using this
ansible-galaxy command inside the playbook:
ansible-galaxy install geerlingguy.composer
geerlingguy.composer is the most communally supported AG role with more than million users (so I assume that if there is a problem and Jeff isn't around at the moment - say, took vacation in Hawaii or something, there will be many community members to fix the problem and ensure stability.
Using this will also shorten my already quite-long playbook.
In general, is it a best practice to use Ansible-Galaxy roles with tasks and tests in an Ansible playbook instead a set of ansible-modules in playbooks that should apparently achieve the same goal (maybe some redundant extras that might not matter and wouldn't interrupt being there as part of the AG role)? I would assume that yes, because it's more communal and stabler.