Where should I locate files that Ansible template steps need? My developers want to locate the files next to their Java code. I want the template files located in the Ansible source repository under the roles/name/templates directories. If we optimize for developers, then when I deploy, I’ll need to checkout both the Ansible code and any git repositories containing templates, which seems brittle. Say I have a tomcat application and I want to deliver property files and config files for my application. The developers want these files to live next to their java code, not next to the Ansible code.
A - Templates next to the code:
app1 (developers for app1 just work here)
±-- templates somewhere in the tree next to the java code
app2 (developers for app2 just work here)
±-- templates somewhere in the tree next to the java code
Ansible
roles
some-role-that-uses-templates
references app1 files via path
some-other-role-that-uses-templates
references app2 files via path
RESULT:
- Developers like where templates are
- Deployment process does not like where templates are. All 3 repositories have to be checked out to deploy.
B - Templates next to Ansible code:
app1
app2
Ansible
roles
some-role-that-uses-templates
templates for app1 here
some-other-role-that-uses-templates
templates for app2 here
RESULT:
- Developers not happy because they have to edit two locations (app# + Ansible), and create two commits to modify code/deployment
- Deployment process is simplified, only checkout Ansible repository.
Or is there some third better way of doing this that I’m not aware of?
Brian