Tried figuring this out on my own, but every time I try to deploy, I am getting this error:
TASK: [deploy | Update git remote URL] ****************************************
skipping: [159.203.207.129]
TASK: [deploy | Clone project files] ******************************************
failed: [159.203.207.129] => {"failed": true}
msg: Failed to checkout staging
PLAY RECAP ********************************************************************
to retry, use: --limit @/Users/japhy/deploy.retry
159.203.207.129 : ok=4 changed=0 unreachable=0 failed=1
localhost : ok=0 changed=0 unreachable=0 failed=0
Can anyone point me in the direction of the problem? Thanks!
Golden rule to debugging anything with Ansible:
- Run the command in
verbose
mode: ansible-playbook deploy.yml -vvvv -e "site=<domain> env=<environment>
- If necessary, SSH into your server and run the command that Ansible did above but manually (in the same directory).
1 Like
Nice rule, but I don’t know it helped me. Here’s the output:
TASK: [deploy | Clone project files] ******************************************
<159.203.207.129> ESTABLISH CONNECTION FOR USER: web
<159.203.207.129> REMOTE_MODULE git version=staging dest=/srv/www/storytelier.com/shared/source repo=
<159.203.207.129> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/japhy/.ansible/cp/ansible-ssh-%h-%p-%r" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=web -o ConnectTimeout=10 159.203.207.129 /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1457411946.34-39309121820945 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1457411946.34-39309121820945 && echo $HOME/.ansible/tmp/ansible-tmp-1457411946.34-39309121820945'
<159.203.207.129> PUT /var/folders/mq/vmzqbfjx7fs1zthbm83qd7bc0000gn/T/tmpsgMzvK TO /home/web/.ansible/tmp/ansible-tmp-1457411946.34-39309121820945/git
<159.203.207.129> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/japhy/.ansible/cp/ansible-ssh-%h-%p-%r" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=web -o ConnectTimeout=10 159.203.207.129 /bin/sh -c 'LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /home/web/.ansible/tmp/ansible-tmp-1457411946.34-39309121820945/git; rm -rf /home/web/.ansible/tmp/ansible-tmp-1457411946.34-39309121820945/ >/dev/null 2>&1'
failed: [159.203.207.129] => {"failed": true}
msg: Failed to checkout staging
repo
is blank. Did you remove that before pasting in here or was it really blank? If so, that’s the problem.
Thanks again for your help. I didn’t remove it, but in my wordpress_sites.yml file for staging (and production) I have this:
repo: git@bitbucket.org:storytelier/storystack.git
Am I missing something/ formatting it wrong?
Nope, looks fine to me. Strange it wasn’t in the output.
Regardless, back to step 2:
- SSH into your server as
web
user
cd /srv/www/storytelier.com/shared/source
-
git checkout staging
or maybe git checkout origin/staging
Hopefully that gives you a clue as to what’s going on.
Another option is to modify this task: https://github.com/roots/trellis/blob/49816805f6980282b9b89db484e9c8d7255f0811/roles/deploy/tasks/update.yml#L24-L32
Put this:
- name: Clone project files
git:
repo: "{{ project_git_repo }}"
dest: "{{ project_source_path }}"
version: "{{ project_version }}"
accept_hostkey: yes
register: git_clone
debug:
var: git_clone.stdout_lines