Hello folks,
I set up my deployment flow in such a way that Ansible clones a git repo locally (generally named “myrepo-deploy” and never modified by hand), cleans and syncs it as master, builds the contents and deploys them to either dev, production or pre-production depending on which hosts file I choose for ansible-playbook.
The challenge is that sometimes I need to deploy from a modified copy of the above repo where development work is happening. e.g. instead of using clean myrepo-deploy against preproduction, I’d like to use myrepo (with some uncommitted modifications in it) against preproduction just for testing purposes.
So I’d love to be able to be able to pass a switch to ansible-playbooks and say “use the development version of the repo just this one time”.
- I know there’s an option with when: and using environment variables
- I know I could also create a separate hosts file that’s something like “preprod-dev”, but now I have to make one of these for each of my host files and it adds an extra burden of variable maintenance in 2x files.
Is there perhaps a better practice that you could recommend for this kind of situation?
Thank you in advance!