I recently had a conversation with some developers about the possibility of taking our existing ansible repo and breaking it up across many different repos. I am not sure if this is possible, so I decided to pose it to this group.
We have all of our playbooks to build our environment and deploy our applications in one central repository. This has been working well for us, but if a developer needs a change they are typically modifying the code in their repo and some variables or code in the ansible repo. Then we need to coordinate the release of ansible changes with their code through the environments. They have asked if we could place the ansible playbook required to build and deploy each application in their code repo. This way, we could maintain everything in one repo and version code and deployment changes to go out together.
I’m still trying to work through how this could work to build the complete environment that would span several repos. We also use Tower and I’m unsure if that would cause any issues. Is anyone trying to or successfully done this? Is it even possible? Thanks.
It is not hard, it is easier if you have a convention on the playbook
names (build.yml, deploy.yml), then you just need a list of the apps
and their repo locations:
apps:
- app1: git://internal/repo/app1.git
and a playbook that goes over this list, checks out all the apps and
then runs build.yml and deploy.yml for each.
If you don't standardize the names, add them to the vars file above:
I’m looking into a similar set up however, what we’d like to do is have a repo per Ansible Role (eg apache, php, tomcat, java) so we can be working on different roles at the same time without git conflicts being thrown at us. Right now what we have is one repo with all of our roles in one repo and multiple people working on different roles. We would also like to be able to tag each role with different versions of the role. The problem right now is that if we want to assemble an Ansible package with a combination of these roles and their version numbers, we are unable to do that. We are not using Ansible Tower. Any suggestions?