Reputation: 1637
I have an empty and bare repository which I'm trying to clone with Ansible, but the git module is trying to checkout master
and thus fails, since there is no such refspec in an empty repo.
My only way to get this working has been a shell command to just clone the repo.
Upvotes: 5
Views: 1275
Reputation: 175
I tried in every way and the only way that worked was to add ignore_errors: true
and than check what made the Ansible module to fail.
I know it is not optimal but it works and we are not letting all the errors to pass thru:
- git: repo=<YOUR REPO> dest=<DEST>
ignore_errors: true
register: output
- name: check the error that failed the git module
fail: msg="{{ output.msg }}"
when: "'Failed to checkout branch master' not in output.msg"
BTW I filter the output.msg
and not the output.stderr
because for some reason on that specific error it goes out to the .msg
but not to the .stderr
.
Upvotes: 4