Problem when deploying with Ansible


As of recently, I cannot deploy a project that used to be deployed without a problem. Now, all of a sudden, I’m receiving this error message:

TASK: [deploy | Update git remote URL] ****************************************
fatal: [xx.xx.xx.xx] => error while evaluating conditional: git_project.stat.exists and remote_origin_url.stdout != project_git_repo

Would you be able to at least point me to where I should start looking for a solution? Has anyone experienced this?

I will only add that commenting out the conditional in the above-mentioned task sorts the problem out. But what might be the cause in the first place?


I haven’t seen this personally. Did the URL to your Git repo change or something?

I’ve found the reason for the problem. It seems to be a rather tricky edge-case.

Before starting experiencing the problem, I added --check flag to the ansible command executed with deploy.yml. --check would make the tasks run in a “dry-run” - nothing will be altered on the server, only potential changes displayed, changes that would be applied if the command was run without --check.

The error appeared only with --check. Once the flag was removed, everthing went as expected.