Search code examples
ansibleansible-role

Managing a large amount of Ansible roles


We are working on converting our project to Ansible. Due to the scale of the project, we will need a large amount of roles (30+). Where we're running into problems is how to store and manage these roles. Things we have considered:

1) Github repo per role -> This is unrealistic. We don't want to manage 30+ git repositories simply for the purpose of maintaining our roles 2) Ansible Galaxy -> This would be valuable if we could have a local instance of Ansible Galaxy, but the central instance won't work 3) We can simply store the roles in a flat directory, however we lose the benefit of being able to version them in this case. There is also the matter of how to automatically push our ansible roles directories to the ansible controller host into the correct directory

Is there a solution I'm missing?


Solution

  • I would suggest keeping the roles in a single git repo.

    For the automatic push to the ansible controller, you could either create a standalone playbook that uses the git module to retrieve the appropriate version of the roles. This could then be run on a regular basis (or scheduled via cron).

    Alternatively, you could add the git retrieval to your existing playbooks, and then it would check/update the roles prior to executing them.