2

Last night I ran a playbook from a wrong branch that referenced an old inventory file with old IPs for each server, and deployed a dev build to a production machine. What would be a a good practice to avoid such mistake from happening in the future? How can I isolate environments better?

1

The best practice is to separate production and staging(testing) inventory. See Staging vs Production.

This way you pick with -i what you are targeting.

To make it more robust you might want to clone a separate structure for production and restrict access to it. Pull from staging before deploying to production.

In detail, this would mean to 1) put the directories into git, 2) make sure staging is committed, pushed and merged, and 3) then pull to the production and deploy. The workflow is up to you.

2
  • I targeted dev, but some of the machines in dev inventory had prod IPs. I think there was reshuffling by the infra team a while back and the branch i was on used that. I am looking for a fool proof ,solution that will exclude such possibility. – JavaHead May 10 '19 at 12:25
  • Sure, I've updated the answer. Please, update the question (you're able to edit it) and delete the comment to make the thread clear. – Vladimir Botka May 10 '19 at 12:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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