Roots Discourse

Deploy issue ansible 1.9.4 composer not found

Hello,

Thanks for taking the time to read this. The last bit I get in the deploy I get this in red:

failed: [goltastico.com] => {"cmd": "composer install --no-ansi --no-dev --no-interaction --no-progress --optimize-autoloader --no-scripts", "failed": true, "rc": 2}
msg: [Errno 2] No such file or directory

So I went on to debug and this is as far I got:

Josephs-MacBook-Pro:trellis joseph$ ansible-playbook deploy.yml -e "site=goltastico.com env=production" -vvvv

PLAY [Ensure necessary variables are defined] ********************************* 

TASK: [Ensure environment is defined] ***************************************** 
skipping: [localhost]

PLAY [Deploy WP site] ********************************************************* 

GATHERING FACTS *************************************************************** 
<goltastico.com> ESTABLISH CONNECTION FOR USER: root
<goltastico.com> REMOTE_MODULE setup
<goltastico.com> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/joseph/.ansible/cp/ansible-ssh-%h-%p-%r" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 goltastico.com /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1451435417.32-113636654163918 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1451435417.32-113636654163918 && echo $HOME/.ansible/tmp/ansible-tmp-1451435417.32-113636654163918'
<goltastico.com> PUT /var/folders/qw/s03zm3m10kg7ygwq2gjk2jqc0000gn/T/tmpD6lC45 TO /root/.ansible/tmp/ansible-tmp-1451435417.32-113636654163918/setup
<goltastico.com> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/joseph/.ansible/cp/ansible-ssh-%h-%p-%r" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 goltastico.com /bin/sh -c 'LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1451435417.32-113636654163918/setup; rm -rf /root/.ansible/tmp/ansible-tmp-1451435417.32-113636654163918/ >/dev/null 2>&1'
ok: [goltastico.com]

TASK: [deploy | Initialize] *************************************************** 
<goltastico.com> ESTABLISH CONNECTION FOR USER: root
<goltastico.com> REMOTE_MODULE deploy_helper state=present path=/srv/www/goltastico.com
<goltastico.com> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/joseph/.ansible/cp/ansible-ssh-%h-%p-%r" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 goltastico.com /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1451435419.36-103624443650232 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1451435419.36-103624443650232 && echo $HOME/.ansible/tmp/ansible-tmp-1451435419.36-103624443650232'
<goltastico.com> PUT /var/folders/qw/s03zm3m10kg7ygwq2gjk2jqc0000gn/T/tmpuaCuXG TO /root/.ansible/tmp/ansible-tmp-1451435419.36-103624443650232/deploy_helper
<goltastico.com> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/joseph/.ansible/cp/ansible-ssh-%h-%p-%r" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 goltastico.com /bin/sh -c 'LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1451435419.36-103624443650232/deploy_helper; rm -rf /root/.ansible/tmp/ansible-tmp-1451435419.36-103624443650232/ >/dev/null 2>&1'
ok: [goltastico.com] => {"ansible_facts": {"deploy_helper": {"current_path": "/srv/www/goltastico.com/current", "new_release": "20151229183020", "new_release_path": "/srv/www/goltastico.com/releases/20151229183020", "previous_release": null, "previous_release_path": null, "project_path": "/srv/www/goltastico.com", "releases_path": "/srv/www/goltastico.com/releases", "shared_path": "/srv/www/goltastico.com/shared", "unfinished_filename": "DEPLOY_UNFINISHED"}}, "changed": false, "state": "present"}

TASK: [deploy | Check whether project source path is a git repo] ************** 
<goltastico.com> ESTABLISH CONNECTION FOR USER: root
<goltastico.com> REMOTE_MODULE stat path=/srv/www/goltastico.com/shared/source/.git
<goltastico.com> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/joseph/.ansible/cp/ansible-ssh-%h-%p-%r" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 goltastico.com /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1451435420.41-209016334992350 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1451435420.41-209016334992350 && echo $HOME/.ansible/tmp/ansible-tmp-1451435420.41-209016334992350'
<goltastico.com> PUT /var/folders/qw/s03zm3m10kg7ygwq2gjk2jqc0000gn/T/tmpJ5N_Zl TO /root/.ansible/tmp/ansible-tmp-1451435420.41-209016334992350/stat
<goltastico.com> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/joseph/.ansible/cp/ansible-ssh-%h-%p-%r" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 goltastico.com /bin/sh -c 'LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1451435420.41-209016334992350/stat; rm -rf /root/.ansible/tmp/ansible-tmp-1451435420.41-209016334992350/ >/dev/null 2>&1'
ok: [goltastico.com] => {"changed": false, "stat": {"atime": 1451434275.1768587, "ctime": 1451435386.0479662, "dev": 51713, "exists": true, "gid": 0, "gr_name": "root", "inode": 919031, "isblk": false, "ischr": false, "isdir": true, "isfifo": false, "isgid": false, "islnk": false, "isreg": false, "issock": false, "isuid": false, "mode": "0755", "mtime": 1451435386.0479662, "nlink": 8, "path": "/srv/www/goltastico.com/shared/source/.git", "pw_name": "root", "rgrp": true, "roth": true, "rusr": true, "size": 4096, "uid": 0, "wgrp": false, "woth": false, "wusr": true, "xgrp": true, "xoth": true, "xusr": true}}

TASK: [deploy | Get current git remote URL] *********************************** 
<goltastico.com> ESTABLISH CONNECTION FOR USER: root
<goltastico.com> REMOTE_MODULE command chdir=/srv/www/goltastico.com/shared/source git config --get remote.origin.url
<goltastico.com> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/joseph/.ansible/cp/ansible-ssh-%h-%p-%r" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 goltastico.com /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1451435421.49-23792308152631 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1451435421.49-23792308152631 && echo $HOME/.ansible/tmp/ansible-tmp-1451435421.49-23792308152631'
<goltastico.com> PUT /var/folders/qw/s03zm3m10kg7ygwq2gjk2jqc0000gn/T/tmpcaQ0op TO /root/.ansible/tmp/ansible-tmp-1451435421.49-23792308152631/command
<goltastico.com> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/joseph/.ansible/cp/ansible-ssh-%h-%p-%r" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 goltastico.com /bin/sh -c 'LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1451435421.49-23792308152631/command; rm -rf /root/.ansible/tmp/ansible-tmp-1451435421.49-23792308152631/ >/dev/null 2>&1'
ok: [goltastico.com] => {"changed": false, "cmd": ["git", "config", "--get", "remote.origin.url"], "delta": "0:00:00.002767", "end": "2015-12-29 18:30:22.517727", "rc": 0, "start": "2015-12-29 18:30:22.514960", "stderr": "", "stdout": "git@bitbucket.org:goltastico/goltastico-com.git", "stdout_lines": ["git@bitbucket.org:goltastico/goltastico-com.git"], "warnings": ["Consider using git module rather than running git"]}

TASK: [deploy | Update git remote URL] **************************************** 
skipping: [goltastico.com]

TASK: [deploy | Clone project files] ****************************************** 
<goltastico.com> ESTABLISH CONNECTION FOR USER: root
<goltastico.com> REMOTE_MODULE git version=master dest=/srv/www/goltastico.com/shared/source repo=
<goltastico.com> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/joseph/.ansible/cp/ansible-ssh-%h-%p-%r" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 goltastico.com /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1451435422.62-90283073185521 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1451435422.62-90283073185521 && echo $HOME/.ansible/tmp/ansible-tmp-1451435422.62-90283073185521'
<goltastico.com> PUT /var/folders/qw/s03zm3m10kg7ygwq2gjk2jqc0000gn/T/tmpWqERIp TO /root/.ansible/tmp/ansible-tmp-1451435422.62-90283073185521/git
<goltastico.com> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/joseph/.ansible/cp/ansible-ssh-%h-%p-%r" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 goltastico.com /bin/sh -c 'LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1451435422.62-90283073185521/git; rm -rf /root/.ansible/tmp/ansible-tmp-1451435422.62-90283073185521/ >/dev/null 2>&1'
ok: [goltastico.com] => {"after": "e3dbb215dd5c983f942c9d496777eba00efdd96a", "before": "e3dbb215dd5c983f942c9d496777eba00efdd96a", "changed": false}

TASK: [deploy | write unfinished file] **************************************** 
<goltastico.com> ESTABLISH CONNECTION FOR USER: root
<goltastico.com> REMOTE_MODULE file state=touch path=/srv/www/goltastico.com/shared/source/DEPLOY_UNFINISHED
<goltastico.com> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/joseph/.ansible/cp/ansible-ssh-%h-%p-%r" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 goltastico.com /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1451435435.31-121364691362634 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1451435435.31-121364691362634 && echo $HOME/.ansible/tmp/ansible-tmp-1451435435.31-121364691362634'
<goltastico.com> PUT /var/folders/qw/s03zm3m10kg7ygwq2gjk2jqc0000gn/T/tmpM9dE5Z TO /root/.ansible/tmp/ansible-tmp-1451435435.31-121364691362634/file
<goltastico.com> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/joseph/.ansible/cp/ansible-ssh-%h-%p-%r" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 goltastico.com /bin/sh -c 'LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1451435435.31-121364691362634/file; rm -rf /root/.ansible/tmp/ansible-tmp-1451435435.31-121364691362634/ >/dev/null 2>&1'
changed: [goltastico.com] => {"changed": true, "dest": "/srv/www/goltastico.com/shared/source/DEPLOY_UNFINISHED", "gid": 0, "group": "root", "mode": "0644", "owner": "root", "size": 0, "state": "file", "uid": 0}

TASK: [deploy | Copy files to new build dir] ********************************** 
<goltastico.com> ESTABLISH CONNECTION FOR USER: root
<goltastico.com> REMOTE_MODULE command cp -pr /srv/www/goltastico.com/shared/source /srv/www/goltastico.com/releases/20151229183020
<goltastico.com> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/joseph/.ansible/cp/ansible-ssh-%h-%p-%r" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 goltastico.com /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1451435436.99-267347289044645 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1451435436.99-267347289044645 && echo $HOME/.ansible/tmp/ansible-tmp-1451435436.99-267347289044645'
<goltastico.com> PUT /var/folders/qw/s03zm3m10kg7ygwq2gjk2jqc0000gn/T/tmp1SZQhU TO /root/.ansible/tmp/ansible-tmp-1451435436.99-267347289044645/command
<goltastico.com> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/joseph/.ansible/cp/ansible-ssh-%h-%p-%r" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 goltastico.com /bin/sh -c 'LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1451435436.99-267347289044645/command; rm -rf /root/.ansible/tmp/ansible-tmp-1451435436.99-267347289044645/ >/dev/null 2>&1'
changed: [goltastico.com] => {"changed": true, "cmd": ["cp", "-pr", "/srv/www/goltastico.com/shared/source", "/srv/www/goltastico.com/releases/20151229183020"], "delta": "0:00:00.019607", "end": "2015-12-29 18:30:38.392474", "rc": 0, "start": "2015-12-29 18:30:38.372867", "stderr": "", "stdout": "", "warnings": []}

TASK: [deploy | Check for project subtree] ************************************ 
<goltastico.com> ESTABLISH CONNECTION FOR USER: root
<goltastico.com> REMOTE_MODULE stat path=/srv/www/goltastico.com/releases/20151229183020/site
<goltastico.com> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/joseph/.ansible/cp/ansible-ssh-%h-%p-%r" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 goltastico.com /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1451435438.51-267144348906544 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1451435438.51-267144348906544 && echo $HOME/.ansible/tmp/ansible-tmp-1451435438.51-267144348906544'
<goltastico.com> PUT /var/folders/qw/s03zm3m10kg7ygwq2gjk2jqc0000gn/T/tmp17sO9i TO /root/.ansible/tmp/ansible-tmp-1451435438.51-267144348906544/stat
<goltastico.com> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/joseph/.ansible/cp/ansible-ssh-%h-%p-%r" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 goltastico.com /bin/sh -c 'LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1451435438.51-267144348906544/stat; rm -rf /root/.ansible/tmp/ansible-tmp-1451435438.51-267144348906544/ >/dev/null 2>&1'
ok: [goltastico.com] => {"changed": false, "stat": {"atime": 1451434276.4328847, "ctime": 1451435438.3810544, "dev": 51713, "exists": true, "gid": 0, "gr_name": "root", "inode": 1050852, "isblk": false, "ischr": false, "isdir": true, "isfifo": false, "isgid": false, "islnk": false, "isreg": false, "issock": false, "isuid": false, "mode": "0755", "mtime": 1451434276.448885, "nlink": 4, "path": "/srv/www/goltastico.com/releases/20151229183020/site", "pw_name": "root", "rgrp": true, "roth": true, "rusr": true, "size": 4096, "uid": 0, "wgrp": false, "woth": false, "wusr": true, "xgrp": true, "xoth": true, "xusr": true}}

TASK: [deploy | Fail if project_subtree_path is set incorrectly] ************** 
skipping: [goltastico.com]

TASK: [deploy | Move project subtree into root folder] ************************ 
<goltastico.com> ESTABLISH CONNECTION FOR USER: root
<goltastico.com> REMOTE_MODULE command mv /srv/www/goltastico.com/releases/20151229183020/site/* /srv/www/goltastico.com/releases/20151229183020 #USE_SHELL
<goltastico.com> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/joseph/.ansible/cp/ansible-ssh-%h-%p-%r" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 goltastico.com /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1451435440.49-160832805142900 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1451435440.49-160832805142900 && echo $HOME/.ansible/tmp/ansible-tmp-1451435440.49-160832805142900'
<goltastico.com> PUT /var/folders/qw/s03zm3m10kg7ygwq2gjk2jqc0000gn/T/tmp4XVYji TO /root/.ansible/tmp/ansible-tmp-1451435440.49-160832805142900/command
<goltastico.com> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/joseph/.ansible/cp/ansible-ssh-%h-%p-%r" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 goltastico.com /bin/sh -c 'LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1451435440.49-160832805142900/command; rm -rf /root/.ansible/tmp/ansible-tmp-1451435440.49-160832805142900/ >/dev/null 2>&1'
changed: [goltastico.com] => {"changed": true, "cmd": "mv /srv/www/goltastico.com/releases/20151229183020/site/* /srv/www/goltastico.com/releases/20151229183020", "delta": "0:00:00.003113", "end": "2015-12-29 18:30:41.800874", "rc": 0, "start": "2015-12-29 18:30:41.797761", "stderr": "", "stdout": "", "warnings": []}

TASK: [deploy | Remove unwanted files/folders from new release] *************** 
<goltastico.com> ESTABLISH CONNECTION FOR USER: root
<goltastico.com> REMOTE_MODULE file state=absent path=/srv/www/goltastico.com/releases/20151229183020/.git
<goltastico.com> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/joseph/.ansible/cp/ansible-ssh-%h-%p-%r" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 goltastico.com /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1451435441.88-1824545801469 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1451435441.88-1824545801469 && echo $HOME/.ansible/tmp/ansible-tmp-1451435441.88-1824545801469'
<goltastico.com> PUT /var/folders/qw/s03zm3m10kg7ygwq2gjk2jqc0000gn/T/tmp1vmZdZ TO /root/.ansible/tmp/ansible-tmp-1451435441.88-1824545801469/file
<goltastico.com> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/joseph/.ansible/cp/ansible-ssh-%h-%p-%r" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 goltastico.com /bin/sh -c 'LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1451435441.88-1824545801469/file; rm -rf /root/.ansible/tmp/ansible-tmp-1451435441.88-1824545801469/ >/dev/null 2>&1'
changed: [goltastico.com] => (item=.git) => {"changed": true, "item": ".git", "path": "/srv/www/goltastico.com/releases/20151229183020/.git", "state": "absent"}

TASK: [deploy | Copy project templates] *************************************** 
<goltastico.com> ESTABLISH CONNECTION FOR USER: root
<goltastico.com> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/joseph/.ansible/cp/ansible-ssh-%h-%p-%r" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 goltastico.com /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1451435443.09-207878159519651 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1451435443.09-207878159519651 && echo $HOME/.ansible/tmp/ansible-tmp-1451435443.09-207878159519651'
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    13  100    13    0     0     23      0 --:--:-- --:--:-- --:--:--    23
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    13  100    13    0     0     28      0 --:--:-- --:--:-- --:--:--    28
<goltastico.com> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/joseph/.ansible/cp/ansible-ssh-%h-%p-%r" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 goltastico.com /bin/sh -c 'rc=flag; [ -r /srv/www/goltastico.com/releases/20151229183020/.env ] || rc=2; [ -f /srv/www/goltastico.com/releases/20151229183020/.env ] || rc=1; [ -d /srv/www/goltastico.com/releases/20151229183020/.env ] && rc=3; python -V 2>/dev/null || rc=4; [ x"$rc" != "xflag" ] && echo "${rc} "/srv/www/goltastico.com/releases/20151229183020/.env && exit 0; (python -c '"'"'import hashlib; BLOCKSIZE = 65536; hasher = hashlib.sha1(); afile = open("'"'"'/srv/www/goltastico.com/releases/20151229183020/.env'"'"'", "rb") buf = afile.read(BLOCKSIZE) while len(buf) > 0: hasher.update(buf) buf = afile.read(BLOCKSIZE) afile.close() print(hasher.hexdigest())'"'"' 2>/dev/null) || (python -c '"'"'import sha; BLOCKSIZE = 65536; hasher = sha.sha(); afile = open("'"'"'/srv/www/goltastico.com/releases/20151229183020/.env'"'"'", "rb") buf = afile.read(BLOCKSIZE) while len(buf) > 0: hasher.update(buf) buf = afile.read(BLOCKSIZE) afile.close() print(hasher.hexdigest())'"'"' 2>/dev/null) || (echo '"'"'0 '"'"'/srv/www/goltastico.com/releases/20151229183020/.env)'
<goltastico.com> PUT /var/folders/qw/s03zm3m10kg7ygwq2gjk2jqc0000gn/T/tmpOvT6BN TO /root/.ansible/tmp/ansible-tmp-1451435443.09-207878159519651/source
<goltastico.com> PUT /var/folders/qw/s03zm3m10kg7ygwq2gjk2jqc0000gn/T/tmpq6LOmv TO /root/.ansible/tmp/ansible-tmp-1451435443.09-207878159519651/copy
<goltastico.com> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/joseph/.ansible/cp/ansible-ssh-%h-%p-%r" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 goltastico.com /bin/sh -c 'LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1451435443.09-207878159519651/copy; rm -rf /root/.ansible/tmp/ansible-tmp-1451435443.09-207878159519651/ >/dev/null 2>&1'
changed: [goltastico.com] => (item={'dest': '.env', 'src': 'roles/deploy/templates/env.j2', 'name': '.env config'}) => {"changed": true, "checksum": "49424c92737071e6eae9f7f468166c35166b9949", "dest": "/srv/www/goltastico.com/releases/20151229183020/.env", "gid": 0, "group": "root", "item": {"dest": ".env", "name": ".env config", "src": "roles/deploy/templates/env.j2"}, "md5sum": "e06bf299bf5460bf6bf10f67d43d2624", "mode": "0644", "owner": "root", "size": 853, "src": "/root/.ansible/tmp/ansible-tmp-1451435443.09-207878159519651/source", "state": "file", "uid": 0}

TASK: [deploy | Check if project folders exist] ******************************* 
<goltastico.com> ESTABLISH CONNECTION FOR USER: root
<goltastico.com> REMOTE_MODULE stat path=/srv/www/goltastico.com/current/vendor
<goltastico.com> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/joseph/.ansible/cp/ansible-ssh-%h-%p-%r" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 goltastico.com /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1451435445.95-241163363182251 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1451435445.95-241163363182251 && echo $HOME/.ansible/tmp/ansible-tmp-1451435445.95-241163363182251'
<goltastico.com> PUT /var/folders/qw/s03zm3m10kg7ygwq2gjk2jqc0000gn/T/tmp1e6In1 TO /root/.ansible/tmp/ansible-tmp-1451435445.95-241163363182251/stat
<goltastico.com> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/joseph/.ansible/cp/ansible-ssh-%h-%p-%r" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 goltastico.com /bin/sh -c 'LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1451435445.95-241163363182251/stat; rm -rf /root/.ansible/tmp/ansible-tmp-1451435445.95-241163363182251/ >/dev/null 2>&1'
ok: [goltastico.com] => (item=vendor) => {"changed": false, "item": "vendor", "stat": {"exists": false}}

TASK: [deploy | Copy project folders] ***************************************** 
skipping: [goltastico.com] => (item={'invocation': {'module_name': u'stat', 'module_complex_args': {'path': u'/srv/www/goltastico.com/current/vendor'}, 'module_args': ''}, 'item': 'vendor', u'stat': {u'exists': False}, u'changed': False})

TASK: [deploy | Check for composer.json in project root or project_subtree_path] *** 
<goltastico.com> ESTABLISH CONNECTION FOR USER: root
<goltastico.com> REMOTE_MODULE stat path=/srv/www/goltastico.com/releases/20151229183020/composer.json
<goltastico.com> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/joseph/.ansible/cp/ansible-ssh-%h-%p-%r" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 goltastico.com /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1451435447.11-216060973139655 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1451435447.11-216060973139655 && echo $HOME/.ansible/tmp/ansible-tmp-1451435447.11-216060973139655'
<goltastico.com> PUT /var/folders/qw/s03zm3m10kg7ygwq2gjk2jqc0000gn/T/tmpFzZcn4 TO /root/.ansible/tmp/ansible-tmp-1451435447.11-216060973139655/stat
<goltastico.com> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/joseph/.ansible/cp/ansible-ssh-%h-%p-%r" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 goltastico.com /bin/sh -c 'LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1451435447.11-216060973139655/stat; rm -rf /root/.ansible/tmp/ansible-tmp-1451435447.11-216060973139655/ >/dev/null 2>&1'
ok: [goltastico.com] => {"changed": false, "stat": {"atime": 1451434276.4368849, "checksum": "8dfa62a3e5103e06bcd809965367730a6e36fa5c", "ctime": 1451435441.7971256, "dev": 51713, "exists": true, "gid": 0, "gr_name": "root", "inode": 1051217, "isblk": false, "ischr": false, "isdir": false, "isfifo": false, "isgid": false, "islnk": false, "isreg": true, "issock": false, "isuid": false, "md5": "afb6d6a83903f0e9a78c919a30d4ab82", "mode": "0644", "mtime": 1451434276.4368849, "nlink": 1, "path": "/srv/www/goltastico.com/releases/20151229183020/composer.json", "pw_name": "root", "rgrp": true, "roth": true, "rusr": true, "size": 1417, "uid": 0, "wgrp": false, "woth": false, "wusr": true, "xgrp": false, "xoth": false, "xusr": false}}

TASK: [deploy | Fail if composer.json not found] ****************************** 
skipping: [goltastico.com]

TASK: [deploy | Install Composer dependencies] ******************************** 
<goltastico.com> ESTABLISH CONNECTION FOR USER: root
<goltastico.com> REMOTE_MODULE command chdir=/srv/www/goltastico.com/releases/20151229183020 composer install --no-ansi --no-dev --no-interaction --no-progress --optimize-autoloader --no-scripts
<goltastico.com> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/joseph/.ansible/cp/ansible-ssh-%h-%p-%r" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 goltastico.com /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1451435449.46-250339614875046 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1451435449.46-250339614875046 && echo $HOME/.ansible/tmp/ansible-tmp-1451435449.46-250339614875046'
<goltastico.com> PUT /var/folders/qw/s03zm3m10kg7ygwq2gjk2jqc0000gn/T/tmpVGpqTn TO /root/.ansible/tmp/ansible-tmp-1451435449.46-250339614875046/command
<goltastico.com> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/joseph/.ansible/cp/ansible-ssh-%h-%p-%r" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 goltastico.com /bin/sh -c 'LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1451435449.46-250339614875046/command; rm -rf /root/.ansible/tmp/ansible-tmp-1451435449.46-250339614875046/ >/dev/null 2>&1'
failed: [goltastico.com] => {"cmd": "composer install --no-ansi --no-dev --no-interaction --no-progress --optimize-autoloader --no-scripts", "failed": true, "rc": 2}
msg: [Errno 2] No such file or directory

PLAY RECAP ******************************************************************** 
           to retry, use: --limit @/Users/joseph/deploy.retry

goltastico.com             : ok=14   changed=5    unreachable=0    failed=1   
localhost                  : ok=0    changed=0    unreachable=0    failed=0 

I have done this:

  1. ./deploy.sh production goltastico.com caused error which is why I ran the playbook with debug to show here.
  2. I am on yesterdays version of Trellis

Just a sidenote I am on an rackspace mycloud server and below is my wordpress_sites.yml file:

wordpress_sites:
  goltastico.com:
    site_hosts:
      - goltastico.com
    local_path: ../site # path targeting local Bedrock site directory (relative to Ansible root)
    repo: git@bitbucket.org:goltastico/goltastico-com.git
    branch: master
    subtree_path: site # relative path to your Bedrock/WP directory in your repo (above) if it is not the root (like the roots-example-project structure)
    permalink_structure: "/%year%/%monthnum%/%day%/%postname%/"

This file is there. When I run: which composer it doesnt do anything. When I run composer it says:

No command 'composer' found, did you mean:
 Command 'compose' from package 'mime-support' (main)
composer: command not found

is this something I did wrong? This is the contents of that directory:

root@web01:/srv/www/goltastico.com/releases/20151229185852# ls -ls
total 60
 4 -rw-r--r-- 1 root root  2620 Dec 29 18:11 CHANGELOG.md
 4 -rw-r--r-- 1 root root  1417 Dec 29 18:11 composer.json
16 -rw-r--r-- 1 root root 12308 Dec 29 18:11 composer.lock
 4 drwxr-xr-x 3 root root  4096 Dec 29 18:11 config
 4 -rw-r--r-- 1 root root   110 Dec 29 18:11 CONTRIBUTING.md
 0 -rw-r--r-- 1 root root     0 Dec 29 18:59 DEPLOY_UNFINISHED
 4 -rw-r--r-- 1 root root  1044 Dec 29 18:11 LICENSE.md
 4 -rw-r--r-- 1 root root  3281 Dec 29 18:11 README.md
 4 -rw-r--r-- 1 root root  1169 Dec 29 18:11 ruleset.xml
 4 drwxr-xr-x 2 root root  4096 Dec 29 18:59 site
 4 drwxr-xr-x 7 root root  4096 Dec 29 18:11 trellis
 4 drwxr-xr-x 3 root root  4096 Dec 29 18:11 web
 4 -rw-r--r-- 1 root root    13 Dec 29 18:11 wp-cli.yml

@codingideas Have you run server.yml yet to provision the server? It would install composer, etc. (see remote server setup)

For example, I can reproduce your errors if I install git on a bare Ubuntu server then run deploy.yml with web_user: root, but there’s a ton more that should be installed first using server.yml.

3 Likes

Thank you Phil! That may have been the missing ingredient because it’s now installing but I ran into a seperate issue:

stderr: Error: YIKES! It looks like you're running this as root. You probably meant to run this as the user that your WordPress install exists under.

but does this create a user for me? It says: If you’d like to run it as the user that this site is under, you can run the following to become the respective user: sudo -u USER -i – wp

but if change web_user: to any invented name it doesn’t work.

# Documentation: https://roots.io/trellis/docs/ssh-keys/
admin_user: goltastico

users:
  - name: "{{ web_user }}"
    groups:
      - "{{ web_group }}"
    keys:
      - "{{ lookup('file', '~/.ssh/id_rsa.pub') }}"
      # - https://github.com/codingideas.keys
  - name: "{{ admin_user }}"
    groups:
      - sudo
    keys:
      - "{{ lookup('file', '~/.ssh/id_rsa.pub') }}"
      # - https://github.com/codingideas.keys

web_user: root
web_group: www-data
web_sudoers:
  - "/usr/sbin/service hhvm *"
  - "/usr/sbin/service php5-fpm *"

I’d recommend changing back to the default web_user: web (not root). Then rerun server.yml so that the users role can create this user named web. Then when you run deploy.yml, it will automatically run as web user, the user who owns the files dealt with during deploy. All that should avoid the warning about running as root.

1 Like

We’re close. :frowning: So 104.192.143.3 is my bitbucket. I’ve tried to add both my laptops and the servers ssh keys in the projects deployment keys i.e. https://bitbucket.org/goltastico/goltastico-com/admin/deploy-keys/ and under my user account ssh keys: https://bitbucket.org/account/user/komimarketing/ssh-keys/

but no luck. :confused:

TASK: [deploy | Clone project files] ****************************************** 
failed: [goltastico.com] => {"cmd": "/usr/bin/git ls-remote origin -h refs/heads/master", "failed": true, "rc": 128}
stderr: Warning: Permanently added the RSA host key for IP address '104.192.143.1' to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

msg: Warning: Permanently added the RSA host key for IP address '104.192.143.1' to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

It’s strange that the Clone project files task connected earlier, but not now.

Just to confirm, the key value (public ssh key) at
https://bitbucket.org/goltastico/goltastico-com/admin/deploy-keys/ and
https://bitbucket.org/account/user/komimarketing/ssh-keys/
should correspond to the value on your local machine at ~/.ssh/id_rsa.pub

Most likely you’ll need to do some ssh agent forwarding setup or troubleshooting (and as a mac user, be sure you’ve run ssh-add -K). You’ll find a number of related threads here on Discourse.

1 Like

Hello, Thanks for being awesome Phil! Ive ran ssh-add -K on my local machine. I’ve setup a config file ~/.ssh/config with ssh port fowarding on. From my server I ran this:

root@web01:~# ssh -T git@bitbucket.org
logged in as komimarketing.

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

everything seems to be correct on my local machine:

Josephs-MacBook-Pro:trellis joseph$ ssh-add -l
4096 SHA256:qMoZFyWftk5NHKlhkLcCti2ulO8g4pgZHNnWL/oLtAI /Users/joseph/.ssh/id_rsa (RSA)
Josephs-MacBook-Pro:trellis joseph$ eval `ssh-agent` 
Agent pid 26735
Josephs-MacBook-Pro:trellis joseph$ ssh -T git@bitbucket.org
logged in as komimarketing.

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

I don’t know if you have any more ideas? Ive tried to run the server.yml to provision the server to see if it made any difference and it hasn’t. :confused: Below is a debugged output.

Josephs-MacBook-Pro:trellis joseph$ ansible-playbook deploy.yml -e "site=goltastico.com env=production" -vvvv

PLAY [Ensure necessary variables are defined] ********************************* 

TASK: [Ensure environment is defined] ***************************************** 
skipping: [localhost]

PLAY [Deploy WP site] ********************************************************* 

GATHERING FACTS *************************************************************** 
<goltastico.com> ESTABLISH CONNECTION FOR USER: web
<goltastico.com> REMOTE_MODULE setup
<goltastico.com> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/joseph/.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 goltastico.com /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1451446211.22-84198616338600 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1451446211.22-84198616338600 && echo $HOME/.ansible/tmp/ansible-tmp-1451446211.22-84198616338600'
<goltastico.com> PUT /var/folders/qw/s03zm3m10kg7ygwq2gjk2jqc0000gn/T/tmpeg4N3d TO /home/web/.ansible/tmp/ansible-tmp-1451446211.22-84198616338600/setup
<goltastico.com> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/joseph/.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 goltastico.com /bin/sh -c 'LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /home/web/.ansible/tmp/ansible-tmp-1451446211.22-84198616338600/setup; rm -rf /home/web/.ansible/tmp/ansible-tmp-1451446211.22-84198616338600/ >/dev/null 2>&1'
ok: [goltastico.com]

TASK: [deploy | Initialize] *************************************************** 
<goltastico.com> ESTABLISH CONNECTION FOR USER: web
<goltastico.com> REMOTE_MODULE deploy_helper state=present path=/srv/www/goltastico.com
<goltastico.com> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/joseph/.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 goltastico.com /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1451446218.44-158859469154598 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1451446218.44-158859469154598 && echo $HOME/.ansible/tmp/ansible-tmp-1451446218.44-158859469154598'
<goltastico.com> PUT /var/folders/qw/s03zm3m10kg7ygwq2gjk2jqc0000gn/T/tmp71jxu2 TO /home/web/.ansible/tmp/ansible-tmp-1451446218.44-158859469154598/deploy_helper
<goltastico.com> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/joseph/.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 goltastico.com /bin/sh -c 'LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /home/web/.ansible/tmp/ansible-tmp-1451446218.44-158859469154598/deploy_helper; rm -rf /home/web/.ansible/tmp/ansible-tmp-1451446218.44-158859469154598/ >/dev/null 2>&1'
ok: [goltastico.com] => {"ansible_facts": {"deploy_helper": {"current_path": "/srv/www/goltastico.com/current", "new_release": "20151230033022", "new_release_path": "/srv/www/goltastico.com/releases/20151230033022", "previous_release": "20151230021555", "previous_release_path": "/srv/www/goltastico.com/releases/20151230021555", "project_path": "/srv/www/goltastico.com", "releases_path": "/srv/www/goltastico.com/releases", "shared_path": "/srv/www/goltastico.com/shared", "unfinished_filename": "DEPLOY_UNFINISHED"}}, "changed": false, "state": "present"}

TASK: [deploy | Check whether project source path is a git repo] ************** 
<goltastico.com> ESTABLISH CONNECTION FOR USER: web
<goltastico.com> REMOTE_MODULE stat path=/srv/www/goltastico.com/shared/source/.git
<goltastico.com> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/joseph/.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 goltastico.com /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1451446222.45-246660769615521 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1451446222.45-246660769615521 && echo $HOME/.ansible/tmp/ansible-tmp-1451446222.45-246660769615521'
<goltastico.com> PUT /var/folders/qw/s03zm3m10kg7ygwq2gjk2jqc0000gn/T/tmpER4u4S TO /home/web/.ansible/tmp/ansible-tmp-1451446222.45-246660769615521/stat
<goltastico.com> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/joseph/.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 goltastico.com /bin/sh -c 'LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /home/web/.ansible/tmp/ansible-tmp-1451446222.45-246660769615521/stat; rm -rf /home/web/.ansible/tmp/ansible-tmp-1451446222.45-246660769615521/ >/dev/null 2>&1'
ok: [goltastico.com] => {"changed": false, "stat": {"atime": 1451434275.1768587, "ctime": 1451441778.280832, "dev": 51713, "exists": true, "gid": 0, "gr_name": "root", "inode": 919031, "isblk": false, "ischr": false, "isdir": true, "isfifo": false, "isgid": false, "islnk": false, "isreg": false, "issock": false, "isuid": false, "mode": "0755", "mtime": 1451441778.280832, "nlink": 8, "path": "/srv/www/goltastico.com/shared/source/.git", "pw_name": "root", "rgrp": true, "roth": true, "rusr": true, "size": 4096, "uid": 0, "wgrp": false, "woth": false, "wusr": true, "xgrp": true, "xoth": true, "xusr": true}}

TASK: [deploy | Get current git remote URL] *********************************** 
<goltastico.com> ESTABLISH CONNECTION FOR USER: web
<goltastico.com> REMOTE_MODULE command chdir=/srv/www/goltastico.com/shared/source git config --get remote.origin.url
<goltastico.com> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/joseph/.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 goltastico.com /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1451446225.77-51773774511911 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1451446225.77-51773774511911 && echo $HOME/.ansible/tmp/ansible-tmp-1451446225.77-51773774511911'
<goltastico.com> PUT /var/folders/qw/s03zm3m10kg7ygwq2gjk2jqc0000gn/T/tmpoO8H0e TO /home/web/.ansible/tmp/ansible-tmp-1451446225.77-51773774511911/command
<goltastico.com> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/joseph/.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 goltastico.com /bin/sh -c 'LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /home/web/.ansible/tmp/ansible-tmp-1451446225.77-51773774511911/command; rm -rf /home/web/.ansible/tmp/ansible-tmp-1451446225.77-51773774511911/ >/dev/null 2>&1'
ok: [goltastico.com] => {"changed": false, "cmd": ["git", "config", "--get", "remote.origin.url"], "delta": "0:00:00.002810", "end": "2015-12-30 03:30:28.523428", "rc": 0, "start": "2015-12-30 03:30:28.520618", "stderr": "", "stdout": "git@bitbucket.org:goltastico/goltastico-com.git", "stdout_lines": ["git@bitbucket.org:goltastico/goltastico-com.git"], "warnings": ["Consider using git module rather than running git"]}

TASK: [deploy | Update git remote URL] **************************************** 
skipping: [goltastico.com]

TASK: [deploy | Clone project files] ****************************************** 
<goltastico.com> ESTABLISH CONNECTION FOR USER: web
<goltastico.com> REMOTE_MODULE git version=master dest=/srv/www/goltastico.com/shared/source repo=
<goltastico.com> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/joseph/.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 goltastico.com /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1451446228.72-262914010951980 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1451446228.72-262914010951980 && echo $HOME/.ansible/tmp/ansible-tmp-1451446228.72-262914010951980'
<goltastico.com> PUT /var/folders/qw/s03zm3m10kg7ygwq2gjk2jqc0000gn/T/tmpBecCC3 TO /home/web/.ansible/tmp/ansible-tmp-1451446228.72-262914010951980/git
<goltastico.com> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/joseph/.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 goltastico.com /bin/sh -c 'LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /home/web/.ansible/tmp/ansible-tmp-1451446228.72-262914010951980/git; rm -rf /home/web/.ansible/tmp/ansible-tmp-1451446228.72-262914010951980/ >/dev/null 2>&1'
failed: [goltastico.com] => {"failed": true}
msg: Failed to download remote objects and refs:  error: cannot open .git/FETCH_HEAD: Permission denied



PLAY RECAP ******************************************************************** 
           to retry, use: --limit @/Users/joseph/deploy.retry

goltastico.com             : ok=4    changed=0    unreachable=0    failed=1   
localhost                  : ok=0    changed=0    unreachable=0    failed=0

ssh fording is confirmed to be working with a ssh_config file.

Host goltastico.com ForwardAgent yes User root

I’ve tried with both user root and web with the same result. Below is the output of ssh -v goltastico.com and as you can see it’s logging me in

Josephs-MacBook-Pro:trellis joseph$ ssh -v goltastico.com
OpenSSH_6.9p1, LibreSSL 2.1.8
debug1: Reading configuration data /Users/joseph/.ssh/config
debug1: /Users/joseph/.ssh/config line 1: Applying options for goltastico.com
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug1: Connecting to goltastico.com [162.242.156.57] port 22.
debug1: Connection established.
debug1: identity file /Users/joseph/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/joseph/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/joseph/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/joseph/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/joseph/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/joseph/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/joseph/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/joseph/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.9
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.3
debug1: match: OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.3 pat OpenSSH_6.6.1* compat 0x04000000
debug1: Authenticating to goltastico.com:22 as 'root'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client chacha20-poly1305@openssh.com <implicit> none
debug1: kex: client->server chacha20-poly1305@openssh.com <implicit> none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:r9YgjhjlOa0qE8na61R4zcIgYHtQLU1e1iMXPYAHPQo
debug1: Host 'goltastico.com' is known and matches the ECDSA host key.
debug1: Found key in /Users/joseph/.ssh/known_hosts:9
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /Users/joseph/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 535
debug1: Authentication succeeded (publickey).
Authenticated to goltastico.com ([162.242.156.57]:22).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: Requesting authentication agent forwarding.
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8
Welcome to Ubuntu 14.04.2 LTS (GNU/Linux 3.13.0-58-generic x86_64)

 * Documentation:  https://help.ubuntu.com/
Last login: Wed Dec 30 03:20:06 2015 from 177.245.2.127
root@web01:~# 

ssh-add -L shows the key is there in both web01 and my local machine.

root@web01:~# ssh-add -L
ssh-rsa myPrivateRandomKeyStringSere /Users/joseph/.ssh/id_rsa

I wonder if we should start with a fresh clone of your project repo to your server. You could remove the cloned project code like this:

ssh root@goltastico.com "rm -rf /srv/www/goltastico.com/shared/source/*"

Then try rerunning deploy.yml. If that doesn’t work, I’d suggest destroying/rebuilding the whole server from scratch and running server.yml and deploy.yml fresh now that you’ve refined your setup a bit.

This is you manually initiating an ssh connection without specifying a user, so it falls back to the default user for your local machine (I assume). To connect as web you could run

ssh web@goltastico.com

However, all that is irrelevant because deploy.yml specifies a connection as remote_user as confirmed by your debug output ESTABLISH CONNECTION FOR USER: web. Because of this, I suggest you remove the unnecessary User root from your local ssh config file to prevent confusion in the future .

1 Like

@codingideas looks like you’re close to solving the issue thanks to the wonderful @fullyint so I’m going to hijack this to ask a question:

We’re always trying to improve our documentation so I’m just hoping to get some insight into how you originally just ran the deployment without provisioning first. Was something confusing in our docs? Or could have something have been made more clear? Thanks :slightly_smiling:

2 Likes

I think it’s a lot to really wrap your head around. When I open your example project I need to go through each requirement and honestly it was a oversight on my end. Though I have read the documentation 2-3 times this round. It’s a lot.

I’ve tried to get this ‘workflow’ setup 4 times in the past with no luck. :confused: and my coworkers who work with me have tried to get this setup with no luck. I am going to have to run through this again on my co-workers computer so at that stage I ‘WILL’ make a youtube video on how to set this up from nothing.

It would be cool if wp-cli could set all this up for you. @fullyint is amazing. I’m glad he caught this thread. He’s amazing. I wish he had a ‘if I helped you donate here’ and I would. haha.

2 Likes

I am at the last bit. haha. :blush: but i swear it doesnt want to work for me. it hates me. :frowning:

TASK: [deploy | Finalize the deploy] ****************************************** 
<goltastico.com> ESTABLISH CONNECTION FOR USER: web
<goltastico.com> REMOTE_MODULE deploy_helper state=finalize path=/srv/www/goltastico.com release=20151230050520
<goltastico.com> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/joseph/.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 goltastico.com /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1451451987.15-212063923148117 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1451451987.15-212063923148117 && echo $HOME/.ansible/tmp/ansible-tmp-1451451987.15-212063923148117'
<goltastico.com> PUT /var/folders/qw/s03zm3m10kg7ygwq2gjk2jqc0000gn/T/tmpVcz_NH TO /home/web/.ansible/tmp/ansible-tmp-1451451987.15-212063923148117/deploy_helper
<goltastico.com> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/joseph/.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 goltastico.com /bin/sh -c 'LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /home/web/.ansible/tmp/ansible-tmp-1451451987.15-212063923148117/deploy_helper; rm -rf /home/web/.ansible/tmp/ansible-tmp-1451451987.15-212063923148117/ >/dev/null 2>&1'
changed: [goltastico.com] => {"changed": true, "state": "finalize"}

TASK: [deploy | WordPress Installed?] ***************************************** 
<goltastico.com> ESTABLISH CONNECTION FOR USER: web
<goltastico.com> REMOTE_MODULE command chdir=/srv/www/goltastico.com/releases/20151230050520 wp core is-installed
<goltastico.com> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/joseph/.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 goltastico.com /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1451451990.03-70071553215497 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1451451990.03-70071553215497 && echo $HOME/.ansible/tmp/ansible-tmp-1451451990.03-70071553215497'
<goltastico.com> PUT /var/folders/qw/s03zm3m10kg7ygwq2gjk2jqc0000gn/T/tmpkheIEz TO /home/web/.ansible/tmp/ansible-tmp-1451451990.03-70071553215497/command
<goltastico.com> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/joseph/.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 goltastico.com /bin/sh -c 'LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /home/web/.ansible/tmp/ansible-tmp-1451451990.03-70071553215497/command; rm -rf /home/web/.ansible/tmp/ansible-tmp-1451451990.03-70071553215497/ >/dev/null 2>&1'
failed: [goltastico.com] => {"changed": false, "cmd": ["wp", "core", "is-installed"], "delta": "0:00:00.091892", "end": "2015-12-30 05:06:33.246583", "failed": true, "failed_when_result": true, "rc": 1, "start": "2015-12-30 05:06:33.154691", "stdout_lines": [], "warnings": []}
stderr: Error: Error establishing a database connection

Well, great endurance! There are a number of threads on discourse about Error establishing a database connection. However, before even exploring those threads, I’d suggest you first wipe the server and rerun server.yml and deploy.yml. It’s very common that users who have had several failed iterations have their first successful run when they rebuild their server fresh.

If the fresh start approach doesn’t work, and looking through the threads about Error establishing a database connection doesn’t yield any insights, my next recommendation would be to see if you can get a vanilla trellis clone to work, making essentially no modifications other than your server IP and domain name. Compared to the long hard road of starting with a bunch of customizations and trying to get Trellis to work, it seems like a quick and easy road to get Trellis working with its defaults so that you know that your environment is ready and only then adding in customizations a piece at a time.

2 Likes

Step 1) trashed server. Done.
Step 2) add ssh key to authorized_hosts. Done.
Step 3) add new ip for domain in /etc/hosts file. ( just to http://goltastico.com sits on a different server that wasn’t moved properly. so Im setting it up correctly) Done.
Step 4) rerun server.yml. Done
Step 5) rerun deploy.yml. Same thing:

failed: [104.239.229.122] => {"changed": false, "cmd": ["wp", "core", "is-installed"], "delta": "0:00:00.083484", "end": "2015-12-30 06:22:53.808794", "failed": true, "failed_when_result": true, "rc": 1, "start": "2015-12-30 06:22:53.725310", "stdout_lines": [], "warnings": []} stderr: Error: Error establishing a database connection

Removed trellis. and running : git clone --depth=1 git@github.com:roots/trellis.git && rm -rf trellis/.git

Changed files:

  • cache
  • remote database was turned on

Went and installed ansible-galaxy install -r requirements.yml -p vendor/roles

Trashed server again. Just in case. Ran through it and it works! :slight_smile: heck yea, I feel good because I didnt give up. haha. after 2 full days of migrating a site to use this ‘stack’ locally and setting up deployment. I feel good. w00t!

Question: when I deploy it takes me to wp/wp-admin/install.php and thats normal? I need to migrate the database from local -> remote?

1 Like

Congratulations! I really admire you for sticking with it. There really are a lot of pieces but you’re digesting it well. If you keep at it like this you’ll soon catch yourself feeling that it’s pretty intuitive and glad for the payoff of productivity.

It is normal to see the install screen on your first deploy, before you have run the install or imported a database. It’s up to you how to proceed. One option would be to run the install, then export your dev database with a tool to do the appropriate find/replace (e.g., wp migrate db pro, wp-cli, etc.), then import into your remote. As for ongoing db syncing, you’ll find some discussion here on discourse, with the WP Migrate DB plugin probably endorsed most often.

2 Likes