Deployment bitbucket ssh forwarding problem

This is really confounding.

roles/deploy/tasks/update.yml -> clone project files task thinks it’s failing on first run (and subsequent).

However

/srv/www/example.com/shared/source now contains the content of the repository.

So why does Ansible think that the task is failing?

The task and fail response match current Trellis master:

- 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: |
      Git repo {{ project.repo }} cannot be accessed. Please verify the repository exists and you have SSH forwarding set up correctly.
      More info:
      > https://roots.io/trellis/docs/deploys/#ssh-keys
      > https://roots.io/trellis/docs/ssh-keys/#cloning-remote-repo-using-ssh-agent-forwarding
  when: git_clone | failed

Previous troubleshooting:

Successfully run ssh -T git@bitbucket.org as Vagrant user (from guest machine), as myself from local machine and as web from remote server, as long as I have connected with ForwardAgent yes:

# ~/.ssh/config
Host webdems
	Hostname IP_ADDRESS_REMOTE_SERVER 
	User web
        IdentityFile ~/.ssh/id_atlassian 
        ForwardAgent yes

This would be an the response when successful, I believe:

logged in as mikeill.

You can use git or hg to connect to Bitbucket. Shell access is disabled.

Some debugging code for roles/deploy/tasks/update.yml got me this far. Will include it.

- name: See Who I Am
  command: whoami
  register: who_i_am

- debug: msg="{{ who_i_am.stdout }}"

- name: See If I can Connect
  command: ssh -T git@bitbucket.org
  register: git_ssh_test

- debug: msg="{{ git_ssh_test.stdout }}"
- debug: msg="{{ git_ssh_test.stderr }}"

- debug: msg="{{ project_git_repo }}"
- debug: msg="{{ project_version }}"
- debug: msg="{{ project_source_path }}"

- debug: msg="{{ project.repo }}"

Output is:

TASK [deploy : debug] **************************************************************************************************
web
ok: [ip_address_here_dude]

TASK [deploy : See If I can Connect] ***********************************************************************************
changed: [ip_address_here_dude]

TASK [deploy : debug] **************************************************************************************************
logged in as mikeill.

You can use git or hg to connect to Bitbucket. Shell access is disabled.
ok: [ip_address_here_dude]

TASK [deploy : debug] **************************************************************************************************
ok: [ip_address_here_dude]

TASK [deploy : debug] **************************************************************************************************
git@bitbucket.org:myaccount/myrepo.git
ok: [ip_address_here_dude]

TASK [deploy : debug] **************************************************************************************************
master
ok: [ip_address_here_dude]

TASK [deploy : debug] **************************************************************************************************
/srv/www/example.com/shared/source
ok: [ip_address_here_dude]

TASK [deploy : debug] **************************************************************************************************
git@bitbucket.org:myaccount/myrepo.git

Here’s hoping one of you guys is feeling generous with your time…