Task Git Clone Returns Fail when repository cloned

I use an Ansible provisioning and deployment framework called Trellis to deploy Wordpress-based applications.

I’m cloning the master from a private Bitbucket repository using the following tasks:

`

  • name: Clone project files
    git:
    repo: “{{ project_git_repo }}”
    dest: “{{ project_source_path }}”
    version: “{{ project_version }}”
    accept_hostkey: “{{ project.repo_accept_hostkey | default(repo_accept_hostkey | default(true)) }}”
    ignore_errors: true
    no_log: true
    register: git_clone

  • name: Failed connection to remote repo
    fail:
    msg: |
    Error message here (removed for brevity)
    when: git_clone | failed
    `

The task fails, delivering the error message, but it does clone the repository. I had added some debugging code, confirming that I was in fact accessing the correct repository successfully (before noticing that the codebase was being cloned.)

I’m not sure why the task is (or thinks it is) failing or where to look for answers.

Loving Python and Ansible.

Hoping someone can help.

Forgot to mention: ansible 2.4.3.0

`
[defaults]
callback_plugins = ~/.ansible/plugins/callback_plugins/:/usr/share/ansible_plugins/callback_plugins:lib/trellis/plugins/callback
stdout_callback = output
filter_plugins = ~/.ansible/plugins/filter_plugins/:/usr/share/ansible_plugins/filter_plugins:lib/trellis/plugins/filter
force_color = True
force_handlers = True
inventory = hosts
nocows = 1
roles_path = vendor/roles
vars_plugins = ~/.ansible/plugins/vars_plugins/:/usr/share/ansible_plugins/vars_plugins:lib/trellis/plugins/vars
vault_password_file = .vault_pass

[ssh_connection]
ssh_args = -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s
pipelining = True
retries = 1
`

The issue in this case was caused by a git submodule to which I hadn’t committed and push my latest code changes. I committed and pushed to the submodule repo and the problem went away. I discovered this by logging into the server and running git status within the repository codebase.