0

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

My consideration

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.

My question

Why is Ansible-Galaxy role by our beloved Geerling (and some other similar roles) all include in GitHub the directories defaults/, meta/ and templates and the .travis.yml file? in other words, Why a single playbook such as the one I wrote isn't enough?

closed as unclear what you're asking by Rui F Ribeiro, Mr Shunz, schily, Thomas, Scott Dec 19 '18 at 4:55

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

2

meta contains meta-data used for the Galaxy registry. .travis.yml contains configuration for Travis CI, which ensures that the project is continuously integrated. The other directories embody the typical structure of an Ansible role: defaults contains the default settings, tasks contains the playbooks, and templates contains the templates for generated files.

ansible-galaxy init

will create the default structure for you; see the documentation for details. Currently, this is

README.md
.travis.yml
defaults/
    main.yml
files/
handlers/
    main.yml
meta/
    main.yml
templates/
tests/
    inventory
    test.yml
vars/
    main.yml

but you won’t see all this in all roles since few roles require every file and directory listed here.

If you look at the files in tasks, you’ll see that this particular role handles many more cases than your own playbook. That doesn’t mean that your own playbook isn’t “enough”; it explains why a structured approach is useful.

Not the answer you're looking for? Browse other questions tagged or ask your own question.